Plotting eigenvalues in complex plane of a sparse matrix
Afficher commentaires plus anciens
I have a 198 x 198 matrix whose eigenvalues I want to plot in complex plane. However, what I want to achieve in plot seems to be 4 complex eigenvalues (having nonzero imaginary part) and a continuum of real eigenvalues. The desired plot looks like

What I have been able to achieve so far is through the following code
clear
k=49;n=2*k+1;p=2.5;v=5;T=1;b=(v*T^2*exp(2*i*p))/(1+T^2)^2;g=v/(1+T^2)^2;
format short
e = ones(n,1)*[1 -2*cos(p) 1];
A = spdiags(e,[-1 0 1],n,n);
A(k+1,k+1)=-2*cos(p)-g;
full(A);
e1 = ones(n,1)*[-1 2*cos(p) -1];
B = spdiags(e1,[-1 0 1],n,n);
B(k+1,k+1)=2*cos(p)+g;
full(B);
C=zeros(n,n);
C(k+1,k+1)=b;
D=zeros(n,n);
D(k+1,k+1)=-b;
E=[A,C;D,B];
full(E); % The full sparse matrix whose eigenvalues are to be plotted
d = eig(full(E))
plot(d,'o')
axis([-5 5 -.5 .5])
xlabel('Real')
ylabel('Imaginary')
Leading to the following output

Réponse acceptée
Plus de réponses (1)
Vinay kumar singh
le 18 Sep 2020
0 votes
>> [V, d] = eig(full(E));
>> residuals = full(E)*V-V*d;
>> max(abs(residuals), [], 'all') % syntax introduced in R2018b
ans =
6.5221e-15
Catégories
En savoir plus sur Linear Algebra dans Centre d'aide et File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!