hw2p4sol

hw2p4sol - Results may be inaccurate. RCOND =...

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

View Full Document Right Arrow Icon
Sheet1 Page 1 % % Problem 2.6.6 in Watkins % for n=4:4:16 H=hilb(n) z=ones(n,1) b=H*z x=H\b r=b-H*x relerr=norm(x-z)/norm(z) relres=norm(r)/norm(b) errest=cond(H)*relres disp(sprintf('relerr=%3.2e relres=%3.2e errest=%3.2e',relerr,relres,errest)) end relerr=1.87e-013 relres=4.06e-017 errest=6.30e-013 relerr=1.01e-007 relres=1.26e-016 errest=1.92e-006 Warning: Matrix is close to singular or badly scaled. Results may be inaccurate. RCOND = 2.458252e-017. relerr=8.19e-002 relres=1.33e-016 errest=2.26e+000 Warning: Matrix is close to singular or badly scaled.
Background image of page 1
This is the end of the preview. Sign up to access the rest of the document.

Unformatted text preview: Results may be inaccurate. RCOND = 6.986608e-019. relerr=2.91e+000 relres=2.52e-016 errest=1.10e+002 % % We see that the relative residuals are always small - the algorithm % was stable. Howver, the accuracy of the solution deteriorates % rapidly with increasing n. This is because the problem becomes unstable % That is, the condition number grows rapidly with n. Note that % the actual relative errors are always smaller than the error estimate....
View Full Document

Ask a homework question - tutors are online