# Follow a complex eigenvalue in a spectrum at different times

6 views (last 30 days)
Gaétan Andriano on 15 Nov 2021
Commented: Gaétan Andriano on 15 Nov 2021
I solve here a complex system (more precisely the Orr-Sommerfeld equation) where I obtain complex eigenvalues at the output of my code. I can therefore plot the spectrum (imaginary part versus real part) which is associated with my solution. At different times of my simulation, the spectrum obtained will not have exactly the same look. The number of eigenvalues remain unchanged but their real and imaginary part will evolve.
My question is the following: I would like to follow an eigenvalue in time but I don't see how to do it.
For example, as illustrated in the attached figure, I would like to track the eigenvalue circled in red at 3 different times. Currently, this eigenvalue is not on the same line of my vector on the 3 instants (at the beginning I am line 41, then 43 and finally 45). If I continued afterwards, it would not follow a logical sequence.
If one of you has an idea I'm interested because I don't know how to do it.
Do not hesitate to ask me questions if it is not clear.

Christine Tobler on 15 Nov 2021
You could try using the matchpairs function:
rng default;
d = randn(20, 1) + 1i*randn(20, 1);
d2 = d + 0.1*(randn(20, 1) + 1i*randn(20, 1));
M = matchpairs(abs(d - d2.'), 10);
plot(real(d), imag(d), 'x');
hold on;
plot(real(d2), imag(d2), 'o')
evBeforeAfter = [d(M(:, 1)), d2(M(:, 2))].';
plot(real(evBeforeAfter), imag(evBeforeAfter), 'k-')
Gaétan Andriano on 15 Nov 2021
Thank you a lot !

### Categories

Find more on Linear Algebra in Help Center and File Exchange

R2021a

### Community Treasure Hunt

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

Start Hunting!