hw3p1sol

Hw3p1sol - We see that the factorization and solution are all extremely accurate up to roundoff error and Q is orthogonal up to roundoff error This

Info iconThis preview shows page 1. Sign up to view the full content.

View Full Document Right Arrow Icon
Sheet1 Page 1 % % Math 5316 - Spring 2009 % Homework 3 Problem 1 % Solution % facterr=zeros(200,1) solerr=zeros(200,1) ortherr=zeros(200,1) for k=1:200 A=randn(500,10) x=randn(10,1) b=A*x [Q R]=qr(A) y=R(1:10,:)\(Q(:,1:10)'*b) facterr(k)=norm(Q*R-A)/norm(A) solerr(k)=norm(x-y)/norm(x) ortherr(k)=norm(Q'*Q-eye(500)) end figure hist(log10(facterr)) title(' QR factorization errors ') figure hist(log10(solerr)) title(' Least squares solution errors ') figure hist(log10(ortherr)) title(' Loss of orthogonality of Q ')
Background image of page 1
This is the end of the preview. Sign up to access the rest of the document.

Unformatted text preview: % % We see that the factorization and solution % are all extremely accurate - up to roundoff error -% and Q is orthogonal up to roundoff error. % This shows that the QR factorization was always stable. % % Note that the extra accuracy of the solution compared % with the earlier homework results can be explained by % the fact that the matrices generated were less likely % to be ill-conditioned as they have 10 rather than 100 % singular values....
View Full Document

This note was uploaded on 05/08/2009 for the course MATH 5316 taught by Professor Dr.thomashagstrom during the Spring '09 term at SMU.

Ask a homework question - tutors are online