Project Assignment #2, due Monday December 6, 1999


[1]  Take m=50, n=12.  Using Matlab's linspace, define t to be the m-vector corresponding to linearly spaced grid points from 0 to 1.  Using Matlab's vander and fliplr,define A to be m x n matrix associated with least squares fitting on this grid by a polynomial of degree n-1.  Take b to be the function cos(4t) evaluated on the grid.  Now, calculate and print (to sixteen-digit precision, Matlab's command "format long" may be useful) the least squares coeffcient vector x by the following methods:
(a) Formation and solution of the normal equations, using Matlab's \ operator.
(b) Formation and solution of the normal equations, using Matlab's inv command to compute the inverse.
(c) x = A\b in Matlab.
(d)The calculations above will produce three lists of 12 coefficients.  In each list, mark the digits that appear to be wrong (affected by rounding error).  Comment on what differences you observe.  Do the normal equations exhibit instability? 

[2]  Roots of Polynomials
    Do Exercise 5.2.13
[3]  The Characteristic Equation
    Do Exercise 5.3.36, 5.3.38
[4]  Eigenvectors
    Implement meig in Appendix B, and compute the eigenvalues, their multiplicities, and the corresponding eigenvectors of Exercise 5.3.11 and 5.3.36.
[5]  Matrix Polynomials
    Do Exercise 5.6.10

Note: In contrast to the first assignment, do not submit the assignment per e-mail, but turn it in as "hard copy" (since it turned out to be easier to correct the assignment in "paper form").

Please note ! ! !

Problem 1: t=linspace(0,1,50) gennerates a row vector, but we need column vectors, hence set t=t', then b=cos(4*t) will also be a column vector.

Problem 4: there are several typos in gthe book in meig.m and mcol.m :
In meig.m: replace S=mrrf(S,'[])' by S=mrrf(S',[])'
                replace [a,b]=siz(S) by b=rank(S)

In mcol.m: replace Z=zeros(Z) by Z=zeros(size(A))
                replace if A==zeros(A) by if A == zeros(size(A))