This preview shows pages 1–2. Sign up to view the full content.
16.1)
The function, powermethod, performs the Power Method on a given symmetric matrix A
nxn
until
the change between vectors obtained is less than a given tolerance. After the tolerance has been met,
the program outputs the number of iterations to achieve the tolerance, the largest eigenvalue of A, and
a vector which is equal to one of the eigenvectors of A divided by the norm of that eigenvector. As A
increased in size, never did the number of iterations reach beyond 6 times the dimension of A.
Otherwise, the number of iterations needed varied greatly inside of that bound. The following is the
code for powermethod:
function
[i ev ew] = powermethod(A,tol)
% PowerMethod performs the Power Method on
% a given symmetric matrix A.
% A  square matrix
% tol  tolerance to determine when x has stopped changing
% Obtain the column dimension of A
n = size(A,1);
x = ones(n,1);
% Set the two vectorswhich will be compared to see if
% the Power Method is producing a new ev or notto
% two dummy vectors whose difference is outside of the tolerance
This preview has intentionally blurred sections. Sign up to view the full version.
View Full Document
This is the end of the preview. Sign up
to
access the rest of the document.
 Spring '08
 Staff

Click to edit the document details