MATLAB Finding the Smallest Eigenvalue with Power Iteration in MatLab

  • Thread starter Thread starter liquidFuzz
  • Start date Start date
  • Tags Tags
    Eigenvalue Matlab
AI Thread Summary
The discussion revolves around finding eigenvalues of a matrix without using the built-in eig() function in MATLAB. The user is attempting to implement a power iteration method to compute the smallest eigenvalue but initially finds that their approach seems to yield the largest eigenvalue instead. They express confusion regarding the computation of the smallest eigenvalue and how to modify their code accordingly. The conversation highlights the use of the min function to find the smallest eigenvalue from the vector of eigenvalues returned by eig(), but notes that this can be misleading when dealing with complex numbers. The user also seeks clarification on how to properly implement inverted power iteration to achieve their goal of finding the smallest eigenvalue.
liquidFuzz
Messages
107
Reaction score
6
I'm tinkering with a code snippet where a part finds eigenvalues.
Code:
eig(A);
The thing is, I tried to do it not using eig() to grasp this and got stuck. Could anyone shed some light on this..? How do I find the smallest eigenvalue?
 
Physics news on Phys.org
Hmm... I might be a little bit closer. This seems to compute the biggest eigenvalue.
Code:
    while (abs(lambda - lambda_old) > tol)
        lambda_old = lambda;
        lambda = y'*A*z/norm(z, 2);   %this part should be altered to compute the smallest.
    end
 
d = eig(A) returns a vector of the eigenvalues of matrix A (notice, I'm assigning it to 'd')

to find the smallest value in a vector:

smallest = min(d)

so, all you really have is:

Code:
d = eig(A)
sm = min(d)

where sm is the smallest eigenvalue.
Not quite what MATLAB calls the smallest when mixing complex numbers with real numbers.
 
ok, weird... so:

according to min, the first entry in A is the "smallest"
Code:
A =

  1.000000000000000 + 1.000000000000000i
 -1.000000000000000 + 1.000000000000000i

>> min(A)

ans =

  1.000000000000000 + 1.000000000000000i

but according to the lessthan sign, the second entry is the "smallest"

Code:
 >> if A(1) < A(2)
dips('YES')
end
>>if A(2) < A(1)
disp('YES')
end
YES
 
I'm trying to set up a power iteration - not using eig(). I'm pretty sure I get the power iteration right, but the inverted power iteration to get the smallest..?
 

Similar threads

Replies
32
Views
4K
Replies
6
Views
2K
Replies
1
Views
5K
Replies
2
Views
3K
Replies
5
Views
2K
Back
Top