%Lecture 22 % Illustrating the power algorithm A=rand(2) % get the real eigevalues and eigenvectors [V,D]=eig(A) % illustrate the power iteration x=[1 1]' % initialize x=A*x % repeat usig the uparrow till the vector appears to converge (in direction) % remark on the fact x either is blowing up or going to zero in magnitude % go to lecture slides and illustrate solutions to this problem via % normalization % % % % illustrating the QR algorithm without shifts A=rand(3) [V,D]=eig(A); [Q,R]=qr(A);A=R*Q; % repeat using uparrow % remark on slow convergence to triangular form % remark on % % % illusrate QR algorithm with shifts A=rand(3); n = size(A,1); I = eye(n,n); s = A(n,n); [Q,R] = qr(A-s*I); A = R*Q+s*I % repeat with uparrow % remark on faster convergence