How to obtain eigenvalues as functions of a variable?

I want to solve an eigenvalue problem as such:
In which the matrix B is constant, and the matrix A varies with the term u. My objective is to analyze the variation of each eigenvalue with u (for example):
u=0:100;
B=[1 2 3 4;5 6 7 8;9 10 11 12;13 14 15 16];
lambda=zeros(size(B,1),size(u,2));
for i=1:size(u,2)
A=[u(i)*5 7 u(i)*10 9;10 15 17 20;11 13 12 20;3 7 1 9];
lambda(:,i)=eig(A,B);
end
If I am not wrong, I believe that each time MATLAB solves the eigenvalue problem, the order in which it places each eigenvalue in the output column vector is completely random (please correct me if I am wrong). For me, this is a problem because I want to determine how each eigenvalue varies, so I would like the '"same" eigenvalue to be placed (or sorted) in the same position (row) every time. Because I am working with big matrices, with complex eigenvalues, in which the variations are very unpredictable, I have no criteria to use the function sort().
I have also tried to use symbolic computation, defining u as a symbolic variable, and trying to obtain each eigenvalue as symbolic expressions, functions of u (for example):
syms u
B=[1 2 3 4;5 6 7 8;9 10 11 12;13 14 15 16];
B=sym(B);
A=[u*5 7 u*10 9;10 15 17 20;11 13 12 20;3 7 1 9];
S=B\A;
lambda=eig(S);
But this solution proved to be unsustainable, due to my computer's poor memory (I don't know if there is any way to improve this approach).
Is there any way to keep track of each eigenvalue and know to which eigenvalue it "corresponds"? (sorry if I am not very clear)

댓글 수: 3

Since you mentioned that there are no criteria for sorting the eigenvalues, how do you determine which order is correct? For example, for one value of u, the eigenvalues were
diag([0.1 0.5 -0.2 -0.3])
and then after changing the value of u, you get
diag([1 2 -0.9 -0.2])
How do you determine if the 2nd order is consistent or not? If you can describe the criteria in words, then most probably it can be implemented in the code.
What I meant is that the order in which they appear in the output vector is not important, but it has to be consistent. So, there is no appearent reason to use sort().
Because each eigenvalue is a root of the characteristic polynomial, what is important is that all the eigenvalues in the same row corresponds to the "same" root. That is why I tried the symbolic approach.
Hi Ameer,
You can sort the eigenvalues with, say, sort(eigvalues,'abs') and get a dependable order. But if you want to follow the eigenvalues by continuity in the variable u, you might have to use small steps for u. That works, but it is of course a time comsuming process .

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

 채택된 답변

the cyclist
the cyclist 2020년 3월 31일
편집: the cyclist 2020년 3월 31일

0 개 추천

Take a look at John D'Errico's eigenshuffle function in the File Exchange. I believe it does what you want (and there is some theoretical discussion there as well).

추가 답변 (0개)

카테고리

도움말 센터File Exchange에서 Linear Algebra에 대해 자세히 알아보기

제품

태그

질문:

2020년 3월 31일

댓글:

2020년 3월 31일

Community Treasure Hunt

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

Start Hunting!

Translated by