Azzera filtri
Azzera filtri

Problem in Eigen values plot

3 visualizzazioni (ultimi 30 giorni)
AVM
AVM il 25 Giu 2020
Commentato: AVM il 28 Giu 2020
I would like to plot the First five minimum eigenvalues in assending order w.r.t. ''g '' of the following Matrix using for loop. But am really confuse to sort the minimum eigevlaues. Can anybody help me to solve that?
clc;
syms g
omega=1.0;
D = 1.0;
n=15;
I1=eye(n);
I2=eye(2);
matdimension= n-1;
tempvector = 0:1:matdimension;
tempvector = sqrt(tempvector);
tempmatrix = diag(tempvector);
anni= circshift(tempmatrix,-1);
crea = anni';
sc=(crea)^2;
sanni=(anni)^2;
num=crea*anni;
c=crea+anni;
d=sc+sanni;
sigx=[0,1;1,0];
sigy=[0,-1i;1i,0];
sigz=[1,0; 0,-1];
sigp=(1/2)*(sigx+1i.*sigy);
sigm=(1/2)*(sigx -1i.*sigy);
g=0:0.01:2.0;
for i = 1:length(g)
A= omega.*kron(I2,num) + (D./2).* kron(sigz,I1) + g(i).*kron(sigx,c);
[~,v]=eig(A);
end
%plot(g,p1,'r',g,p2,'r',g,p3,'r',g,p4,'r',g,p5,'r')
%ax = gca;
%set(gca,'XMinorTick','on','YMinorTick','on')

Risposta accettata

Takumi
Takumi il 26 Giu 2020
Using sort function, you can sort the elements of matrix in ascending order.
clc;
close all
clear
syms g
omega=1.0;
D = 1.0;
n=15;
I1=eye(n);
I2=eye(2);
matdimension= n-1;
tempvector = 0:1:matdimension;
tempvector = sqrt(tempvector);
tempmatrix = diag(tempvector);
anni= circshift(tempmatrix,-1);
crea = anni';
sc=(crea)^2;
sanni=(anni)^2;
num=crea*anni;
c=crea+anni;
d=sc+sanni;
sigx=[0,1;1,0];
sigy=[0,-1i;1i,0];
sigz=[1,0; 0,-1];
sigp=(1/2)*(sigx+1i.*sigy);
sigm=(1/2)*(sigx -1i.*sigy);
g=0:0.01:2.0;
for i = 1:length(g)
A= omega.*kron(I2,num) + (D./2).* kron(sigz,I1) + g(i).*kron(sigx,c);
[~,v]=eig(A);
V=diag(v);
Vsort = sort(V);
Vsort(1) % minimum eigenvalue
Vsort(1:5) % First five minimum eigenvalues
end

Più risposte (0)

Categorie

Scopri di più su Linear Algebra in Help Center e File Exchange

Community Treasure Hunt

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

Start Hunting!

Translated by