Finding the Smallest Eigenvalue with Power Iteration in MatLab

In summary, the conversation discusses using the eig() function in MATLAB to find eigenvalues and the confusion around determining the smallest eigenvalue. The conversation also mentions the use of the power iteration method to find eigenvalues without using eig().
  • #1
liquidFuzz
97
3
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
  • #2
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
 
  • #3
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.
 
  • #4
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
 
  • #5
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..?
 

1. What is an eigenvalue and why is it important?

An eigenvalue is a number that represents a scaling factor for a given vector in a linear transformation. It is important because it allows us to understand how a transformation affects a vector and can help us solve systems of equations, analyze matrices, and make predictions in various fields such as physics, engineering, and economics.

2. How do I find eigenvalues using MatLab?

There are several ways to find eigenvalues in MatLab, but one common method is to use the eig() function. This function takes in a matrix as an input and returns a vector of its eigenvalues. For example, if A is a matrix, we can find its eigenvalues by typing eig(A) in the MatLab command window.

3. Can I find complex eigenvalues using MatLab?

Yes, MatLab can find both real and complex eigenvalues. However, the eig() function only returns real eigenvalues by default. To find complex eigenvalues, we need to add an additional input to the function, such as eig(A,'nobalance') or eig(A,'matrix').

4. How can I check if my eigenvalues are correct?

One way to check if your eigenvalues are correct is by using the eigshow() function in MatLab. This function allows you to visualize the eigenvalues of a matrix and compare them to the theoretical values. Additionally, you can also calculate the determinant of the matrix and compare it to the product of its eigenvalues, which should be equal.

5. Can I find eigenvalues for a non-square matrix?

No, the concept of eigenvalues only applies to square matrices. If you have a non-square matrix, you can use the svd() function in MatLab to find its singular values, which are similar to eigenvalues in that they represent scaling factors for a transformation.

Similar threads

  • MATLAB, Maple, Mathematica, LaTeX
Replies
32
Views
2K
  • MATLAB, Maple, Mathematica, LaTeX
Replies
1
Views
858
  • MATLAB, Maple, Mathematica, LaTeX
Replies
6
Views
2K
  • MATLAB, Maple, Mathematica, LaTeX
Replies
6
Views
1K
  • MATLAB, Maple, Mathematica, LaTeX
Replies
1
Views
5K
  • MATLAB, Maple, Mathematica, LaTeX
Replies
2
Views
817
  • MATLAB, Maple, Mathematica, LaTeX
Replies
2
Views
2K
  • MATLAB, Maple, Mathematica, LaTeX
Replies
1
Views
2K
  • MATLAB, Maple, Mathematica, LaTeX
Replies
4
Views
560
  • MATLAB, Maple, Mathematica, LaTeX
Replies
1
Views
3K
Back
Top