
Study with the several resources on Docsity
Earn points by helping other students or get them with a premium plan
This page cannot be seen from the preview
Don't miss anything!

MCS 471 - Computer Problem 2
Write a Matlab function, called myeig , to implement the shifted inverse power method for the eigenvalue problem Ax = λx. The value of the shifted parameter is α and is input by the user. Recall how one might guess the values of α. For example, if α = 0, then this iteration method yields the smallest (in absolute value) eigenvalue and its corresponding eigenvector. The inputs into the function should be the matrix A, the value of α, and the initial starting vector for the iteration. The outputs should be the approximation to the smallest eigenvalue and its corresponding eigenvector. To invert the matrix A in the iteration use Matlab’s LU decomposition command and then invert the L and U separately. The stopping criterion is when the 2 norm of the difference between two consecutive eigenvector iterates is less than 10 −^4. Compare your results with the results obtained using the build-in Matlab command eig:
[lambda, v] = eig(A)
Use the shifts α = 0, 2. 5 , 4. 5 and an initial vector with all ones.
Use the shift α = 0, 4. 2 and the starting vector (1, 2 , 1)^0. Repeat using the same shifts but with the starting vector (1, 1 , 1)^0. Write a short report describing the outcome.
Here is a crude program for the power method
a = [ 0 11 -5;-2 17 -7; -4 26 -10] x = [1 1 1]’ err = 1; while (err-0.001 > = 0) y = a*x; c1 = norm(y,inf); y = y/c1; err = norm(y-x); x=y; end x c