View Full Version : Finding eigenvalue - MatLab
liquidFuzz
Oct30-11, 12:40 PM
I'm tinkering with a code snippet where a part finds eigenvalues.
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?
liquidFuzz
Oct30-11, 01:22 PM
Hmm... I might be a little bit closer. This seems to compute the biggest eigenvalue.
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
Pythagorean
Oct30-11, 03:45 PM
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:
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.
Pythagorean
Oct30-11, 03:53 PM
ok, weird... so:
according to min, the first entry in A is the "smallest"
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"
>> if A(1) < A(2)
dips('YES')
end
>>if A(2) < A(1)
disp('YES')
end
YES
liquidFuzz
Oct30-11, 04:12 PM
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..?
vBulletin® v3.8.7, Copyright ©2000-2012, vBulletin Solutions, Inc.