eig return complex values

조회 수: 17 (최근 30일)
Michael cohen
Michael cohen 2022년 1월 22일
댓글: Matt J 2022년 1월 23일
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
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일
Use
E = eig(A,C)
instead of
E = eig(inv(C)*A)
or
E = eig(C\A)
  댓글 수: 4
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일
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.

댓글을 달려면 로그인하십시오.

카테고리

Help CenterFile Exchange에서 Linear Algebra에 대해 자세히 알아보기

태그

제품


릴리스

R2020b

Community Treasure Hunt

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

Start Hunting!

Translated by