Hi, I have a square symmetric matrix (5,5) with complex entries,the output eigenvalues when I use eig(T) are all complex .I want to determine the smallest negative eigenvalue.I don't know how ,any one can help.

2 Kommentare

Sean de Wolski
Sean de Wolski am 5 Dez. 2011
smallest as in the closest to infinity or closest to zero?
zayed
zayed am 5 Dez. 2011
smallest is the minimum one,so if it's negative it will be closest to minus infinity,if it's positive it will be closest to zero.

Melden Sie sich an, um zu kommentieren.

 Akzeptierte Antwort

Walter Roberson
Walter Roberson am 5 Dez. 2011

0 Stimmen

"smallest" is not defined for complex numbers. "negative" is not defined for complex numbers either.
You can compare real parts, or you can compare imaginary parts, or you can compare magnitudes.
[vals, idx] = min(real(E));
E(idx)
or
[vals, idx] = min(imag(E));
E(idx)
or
[vals, idx] = min(abs(E));
E(idx)

8 Kommentare

zayed
zayed am 5 Dez. 2011
What a bout math concerning complex nmbers does this accurate ,because I read a bout Euler's theorm, but I don't if this applicaple in matlab.
Walter Roberson
Walter Roberson am 6 Dez. 2011
Euler's Theorem http://en.wikipedia.org/wiki/Euler%27s_theorem is completely irrelevant to this question.
MATLAB stores complex numbers as a pair of arrays, one for the real part and one for the imaginary part. real() and imag() copy the appropriate part _exactly_ with no loss of precision at all.
If you are concerned that abs() might perhaps not have sufficient precision, then you could instead use hypot(real(E), imag(E)) as hypot takes special care to avoid overflow and underflow; see http://www.mathworks.com/help/techdoc/ref/hypot.html
zayed
zayed am 6 Dez. 2011
I didn't get how to use it ,please.
Walter Roberson
Walter Roberson am 6 Dez. 2011
You don't get how to use _what_?
I already posted complete code for selecting the eigenvalue with minimum real component, with minimum complex component, or with minimum magnitude.
If you are asking how to use hypot as a replacement for abs() in order to take in to account possible overflow or underflow (which is not very likely in your situation, but just-in-case):
[vals, idx] = min(hypot(real(E), imag(E)));
E(idx)
which just replaces abs(E) with the hypot() code I showed above.
In previous threads, for your purposes you defined the minimum eigenvalue as being the one with the most negative real component. Your code to implement that looked acceptable -- not as efficient as what I wrote above, but workable. Was there a problem when you used that code?
zayed
zayed am 6 Dez. 2011
In previous thread ,if you remember we don't use gamma in finding the root of the equation.I have a code(EIGIFP) that finds the minimum or the maximum eigenvalue,but for symmetric matrix with real entries,which is different from my matrix (T -in previous thread) with complex entries.
I can't post this code because I found it in a website with permission to use for education or research not for distribution.
http://www.ms.uky.edu/~qye/software.html
zayed
zayed am 6 Dez. 2011
??? Undefined command/function 'hypot'.
Walter Roberson
Walter Roberson am 6 Dez. 2011
hypot has been in versions since sometime in 2008 or before; I have not traced it further.
When I read Loren's blog about hypot, I see in the comments that abs() is also implemented robustly, so there would be no advantage to using hypot() over using abs(), so you might as well not bother.
http://blogs.mathworks.com/loren/2008/02/07/why-hypot/
If you are looking for the eigenvalue with the smallest magnitude (such as min(abs(E)) would find), then you could instead use
gamma = eigs(T,1,'sm');
which will find just the one eigenvalue. Smallest magnitude could be positive or negative for the real or imaginary components, though -- the eigenvalue closest to 0. There is unfortunately no way with eigs to pick out just the complex eigenvalue with the real component or imaginary component closest to negative infinity: you will have to use one of the above min() forms for that.
zayed
zayed am 6 Dez. 2011
Did you see previous comment a bout EIGIFP.

Melden Sie sich an, um zu kommentieren.

Weitere Antworten (0)

Kategorien

Mehr zu Linear Algebra finden Sie in Hilfe-Center und File Exchange

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by