Math Assignment 3: Solving Least Squares & Analyzing Matrix Exponentials (Math 477/577), Assignments of Linear Algebra

A computer assignment for a math course (math 477/577) focusing on solving least squares problems using different methods and analyzing matrix exponentials. Students are required to write matlab code and submit the results for each question. Question 1 involves defining a matrix a and vector b for a polynomial fitting problem, and calculating the least squares solution using five different methods: normal equations, modified gram-schmidt qr factorization, standard qr factorization, direct solution, and singular value decomposition (svd). Question 2 requires students to write a program to plot the norm of the matrix exponential eta on a log scale for a random matrix a and compare it to the straight line etα(a) where α(a) is the spectral abscissa. Ten random matrices are to be analyzed, and students are expected to discuss the results.

Typology: Assignments

Pre 2010

Uploaded on 08/18/2009

koofers-user-t2e
koofers-user-t2e 🇺🇸

10 documents

1 / 1

Toggle sidebar

This page cannot be seen from the preview

Don't miss anything!

bg1
Math 477/577 Computer Assignment 3 Charles Tier
For each question, please submit the Matlab code along with an execution of the code.
1. For this question let m= 50 and n= 12. Define tas an m-vector consisting of a linearly
space grid from 0 to 1 using MATLAB’s linspace command. Using MATLAB’s vander
and fliplr, define an m×nmatrix Afor the least squares problems of fitting the grid by a
polynomial of degree n1. Let bbe the function cos(4t)evaluated on the grid. Calculate
and print (to 16 digit precision) the least squares solution xby the following 5 methods:
(a) Formation and solution by the normal equations using MATLAB’s \command.
(b) QR factorization computed using a routine mgs that you must write that uses the mod-
ified Gram-Schmidt.
(c) QR factorization using MATLAB’s qr.
(d) x=A\b.
(e) SVD using MATLAB’s svd.
You should produce 5 table of twelve coefficients. In each list, use a red pen to circle the
digits that appear to be incorrect due to rounding error. Explain the differences.
2. Let Aby a 10 ×10 random matrix with entries drawn from the standard normal distribution
minus twice the identity. Write a program to plot ketAk2for t[0,2] on a log scale. Com-
pare the result to the straight line e(A)where α(A) = max <(λj)is the spectral abscissa
of A. Run the program for ten random matrices Aand discuss the results. What property of
a matrix leads to the graph of ketAk2that is oscillatory as t ?
Hints: The definition of the matrix exponential is
etA =
X
k=0
Aktk
k!.
Use randm and expm to deal with normally distributed random numbers and matrix expo-
nentials, respectively.

Partial preview of the text

Download Math Assignment 3: Solving Least Squares & Analyzing Matrix Exponentials (Math 477/577) and more Assignments Linear Algebra in PDF only on Docsity!

Math 477/577 Computer Assignment 3 Charles Tier

For each question, please submit the Matlab code along with an execution of the code.

  1. For this question let m = 50 and n = 12. Define t as an m-vector consisting of a linearly space grid from 0 to 1 using MATLAB’s linspace command. Using MATLAB’s vander and fliplr, define an m × n matrix A for the least squares problems of fitting the grid by a polynomial of degree n − 1. Let b be the function cos(4t) evaluated on the grid. Calculate and print (to 16 digit precision) the least squares solution x by the following 5 methods:

(a) Formation and solution by the normal equations using MATLAB’s \ command. (b) QR factorization computed using a routine mgs that you must write that uses the mod- ified Gram-Schmidt. (c) QR factorization using MATLAB’s qr. (d) x = A\b. (e) SVD using MATLAB’s svd.

You should produce 5 table of twelve coefficients. In each list, use a red pen to circle the digits that appear to be incorrect due to rounding error. Explain the differences.

  1. Let A by a 10 × 10 random matrix with entries drawn from the standard normal distribution minus twice the identity. Write a program to plot ‖etA‖ 2 for t ∈ [0, 2] on a log scale. Com- pare the result to the straight line etα(A)^ where α(A) = max <(λj ) is the spectral abscissa of A. Run the program for ten random matrices A and discuss the results. What property of a matrix leads to the graph of ‖etA‖ 2 that is oscillatory as t → ∞? Hints: The definition of the matrix exponential is

etA^ =

∑^ ∞

k=

Ak^ t

k k!.

Use randm and expm to deal with normally distributed random numbers and matrix expo- nentials, respectively.