Question: Problem 4. Take m = 50, n = 12. Using MATLAB's linspace, define t to be the m-vector corre- sponding to linearly spaced grid points

Problem 4. Take m = 50, n = 12. Using MATLAB's linspace, define t to be the m-vector corre- sponding to linearly spaced grid points from 0 to 1. Using MATLAB's vander and fliplr, define A to be the m x n matrix associated with least squares fitting on this grid by a polynomial of order n - 1. Take b to be the function cos(4t) evaluated on the grid. Now, calculate and print (to 16 digit precision) the least squares coefficient vector x by the following three methods. (a) Solving the normal equation explicitly computing (AT A)-1. (b) Using the MATLAB implementation of the classical Gram-Schmidt algorithm cgs. (c) QR factorization using MATLAB's qr, which is based on the Householder triangularization. (d) x = A \\ b in MATLAB, which is also based on QR factorization. (e) The calculations above will produce five lists of twelve coefficients. In each list, shade with red pen (or highlighter/marker) the digits appear to be wrong (affected by rounding error). Comment on what differences you observe. Do the normal equations exhibit instability? You do not have to explain your observations
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
