% Matlab diary from cs111, Oct 22 2007. % % This is what I typed in class. % % Type it into Matlab yourself to % reproduce the output I showed. A = [.6 .7 ; .8 .9] eigshow(A) B = [2 1 ; -1 2] eigshow(B) b = [1 ; 7] x = A \ b r = b - A*x b bb = [ 1.01 ; 6.93] xx = A \ bb x = A\b norm(x,2) norm(x,1) norm(x,inf) norm(x) x x(2) = -199 norm(x,inf) x(2) = -201 norm(x,inf) max(abs(x)) norm(x,2) sqrt ( sum ( x .^ 2)) clc A b bb norm(b) norm(bb) norm(b-bb) b-bb norm(b-bb) norm(b-bb) / norm(b) x = A\b xx = A \ bb norm(x-xx) / norm(x) A b = [1.3 ; 1.7] x = A\b bb = [1.31 ; 1.69]; norm(b-bb) / norm(b) xx = A \ bb norm(x-xx) / norm(x) eigshow(A) cond(A,2) eigshow(B) cond(B,2) B A norm(x-xx) / norm(x) cond(A) norm(b-bb) / norm(b) b diary off