Hello,
I'm trying to find the eigenvalues and eigenvectors of an invertible matrix. The eig function returns me complex values.
But the matrix is invertible: I invert it on Pascal.
How to explain and especially how to solve this problem please?
The matrix I am trying to invert is the inv(C)*A matrix, from the attached files.
Thanks,
Michael

5 件のコメント

Matt J
Matt J 2022 年 1 月 22 日
Invertible matrices can have complex eigenvalues. That in itself is not a sign of a problem.
Michael cohen
Michael cohen 2022 年 1 月 22 日
Correct, I meant that it is a diagonalizable matrix !
Matt J
Matt J 2022 年 1 月 22 日
A diagonalizable matrix can also be invertible with complex eigenvalues. A simple example is C=1i*eye(N).
In any case, I do not see the complex eigenvalues for the matrix you've provided.
load(websave('t','https://www.mathworks.com/matlabcentral/answers/uploaded_files/869735/matrix_C.mat'))
isreal(eig(C))
ans = logical
1
Michael cohen
Michael cohen 2022 年 1 月 22 日
編集済み: Michael cohen 2022 年 1 月 22 日
Thank you, but in fact it is the matrix_invC.A.mat that I try to diagonalize :)
Matt J
Matt J 2022 年 1 月 22 日
編集済み: Matt J 2022 年 1 月 22 日
That matrix is not symmetric, so there is no reason to think it will have real eigenvalues.

サインインしてコメントする。

 採用された回答

Torsten
Torsten 2022 年 1 月 22 日
編集済み: Torsten 2022 年 1 月 22 日

0 投票

Use
E = eig(A,C)
instead of
E = eig(inv(C)*A)
or
E = eig(C\A)

4 件のコメント

Michael cohen
Michael cohen 2022 年 1 月 22 日
Thank you very much,
What is the difference between these two functions? Matlab documentation speaks of "generalized eigenvalues" for eig(A,C), what does that mean?
Moreover, I don't have quite the same results when comparing the real part of the first method eig(C\A) and the one you propose, is it normal ?
Thanks in advance
Matt J
Matt J 2022 年 1 月 22 日
編集済み: Matt J 2022 年 1 月 22 日
Moreover, I don't have quite the same results when comparing the real part of the first method eig(C\A) and the one you propose,
There is essentially no difference in the results of the two methods:
load matrices;
E0=sort( real(eig(C\A)) );
E=sort( eig(A,C) );
I=1:248;
plot(I,E0,'x', I,E,'--'); legend('eig(C\A)','eig(A,C)','interpreter','none')
Torsten
Torsten 2022 年 1 月 22 日
編集済み: Torsten 2022 年 1 月 22 日
Although negligible, eig(A,C) produces no imaginary parts.
E = eig(A,C) solves for the lambda-values that satisfy
A*x = lambda*C*x (*)
for a vector x~=0.
If C is invertible, these are the eigenvalues of inv(C)*A (as you can see by multiplying (*) with
inv(C) ).
Michael cohen
Michael cohen 2022 年 1 月 23 日
Wouah, thank you very much. It’s very clear and allow us to solve our problem 🙏

サインインしてコメントする。

その他の回答 (1 件)

Matt J
Matt J 2022 年 1 月 22 日
編集済み: Matt J 2022 年 1 月 22 日

0 投票

It turns out that B=C\A does have real eigenvalues in this particular case, but floating point errors approximations produce a small imaginary part that can be ignored.
load matrices
E=eig(C\A);
I=norm(imag(E))/norm(real(E))
I = 3.3264e-18
So just discard the imaginary values,
E=real(E);

2 件のコメント

Michael cohen
Michael cohen 2022 年 1 月 23 日
Thank you very much @Matt J for all those explanations !
Matt J
Matt J 2022 年 1 月 23 日
You 're welcome but please Accept-click one of the answers.

サインインしてコメントする。

カテゴリ

ヘルプ センター および File ExchangeLinear Algebra についてさらに検索

製品

リリース

R2020b

タグ

質問済み:

2022 年 1 月 22 日

コメント済み:

2022 年 1 月 23 日

Community Treasure Hunt

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

Start Hunting!

Translated by