How to obtain eigenvalues as functions of a variable?
Show older comments
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 Comments
Ameer Hamza
on 31 Mar 2020
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.
Pedro Camacho
on 31 Mar 2020
David Goodmanson
on 31 Mar 2020
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 .
Accepted Answer
More Answers (0)
Categories
Find more on Linear Algebra in Help Center and File Exchange
Products
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!