Modify the power method so that the stopping condition is changed to
| ((Axn-un xn)/|Xn|) | <tolerance
where xn, μn are the current estimates of the eigenvector and eigenvalue. Demonstrate the validity of your code by running it on the matrix
3 -1 0
-1 2 -1
0 -1 3
A = gallery('circul',3)
[V,D] = eig(A)
[d,ind] = sort(diag(D))
Ds = D(ind,ind)
Vs = V(:,ind)
e1 = norm(A*V-V*D);
e2 = norm(A*Vs-Vs*Ds);
e = abs(e1 - e2)
Comments
Leave a comment