Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

part a) asks for LU decomposition Problem 04 Take 'n = 50, n = 12. Using MATLAB's I inspace, define t to be the m-vector

part a) asks for LU decomposition image text in transcribed
image text in transcribed
image text in transcribed
Problem 04 Take 'n = 50, n = 12. Using MATLAB's I inspace, define t to be the m-vector corresponding to linearly spaced grid points from 0 to l. Using MATLAB's vander and f 1 pl r, define A to be the m 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) (10 points) Solve the normal equation explicitly by computing using LU decomposition. (There is an example for how to solve an equation of the formm Ax b in the the MATLAB documentation. Type 'lu' in the search rectangle and then click on examples and scroll down.) (b) (10 points) Using the MATLAB implementation CGS.m of the classical Gram-Schmidt algo- (c) (10 points) Using the MATLAB implementation MGS.m of the modified Gram-Schmidt algo (d) (10 points) QR factorization using MATLAB's qr,which is based on the Householder triangu rithm CGS, which can be downloaded from CANVAS. rithm MGS, which can be downloaded from CANVAS larization. (e) 10 points) x Alb in MATLAB, which is also based on QR factorization (f) (10 points) The calculations above will produce five lists of twelve coefficients. In each list, use the "textcolor colorwords" function in LaTeX textcolor(red)(This sentence will be in red.] This sentence will be in red to highlight the digits that appear to be incorrect; i.e., affected by rounding error. Comment on the differences you observe. Do the normal equations exhibit instability? Although, explanations for what you observe are welcome, you are not required to explain your observations. function [Q,R]-mgs (A) % Implementation of the Modified Gram-Schmidt orthogonalization % of column vectors of the input matrix A. [m,n]-size(A); zeros (m,n); R - zeros (n,n); for j-1:n R(j,j)norm (V(:,j),2); for k-(j+1) n end % for (k) end % for (j) function [Q,R]-cgs (A) % Implementation of the classical Gram-Schmidt Orthogonalization 8 of column vectors of the input matrix A [m,n]=size(A) ; V=A; Qzeros (m,n); R zeros (n,n): for k-1:n for j-1:(k-1 end R(k,k) norm(V(:,k)); end

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Secrets Of Analytical Leaders Insights From Information Insiders

Authors: Wayne Eckerson

1st Edition

1935504347, 9781935504344

More Books

Students also viewed these Databases questions