Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

Create a matlab function that employs the Power Method (PM) to find the largest

ID: 3863393 • Letter: C

Question

Create a matlab function that employs the Power Method (PM) to find the largest eigenvalue (evalue) and eigenvector (evector) of a matrix X. The prototype of the function should look like the following. function [evalue, evector] PM_eigen (X); Be sure to check that the matrix is square and to limit the number of iterations to some large count (1000). Use some method to indicate to the calling function that no solution was found (evalue = NaN)? A comment block describing the function is important, be sure to have one in your function. It should be complete with inputs and outputs described.

Explanation / Answer

pm_eigen.m

function [evector,evalue] = pm_eigen(A)

dd=1;
x=ones(1,size(A,1))';
n=10;
iter = 0;
while(dd > 0.01 & iter < 1000)
iter = iter + 1;
y=A*x;
dd=abs(norm(x)-n);
n=norm(x);
x=y/n;
pause
end
evector=x;
evalue=n;
end

Sample Output:

Hire Me For All Your Tutoring Needs
Integrity-first tutoring: clear explanations, guidance, and feedback.
Drop an Email at
drjack9650@gmail.com
Chat Now And Get Quote