Problem in Eigen values plot

조회 수: 1 (최근 30일)
AVM
AVM 2020년 6월 25일
댓글: AVM 2020년 6월 28일
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')

채택된 답변

Takumi
Takumi 2020년 6월 26일
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
  댓글 수: 1
AVM
AVM 2020년 6월 28일
@Takumi: Thanks for your reply.

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

추가 답변 (0개)

카테고리

Help CenterFile Exchange에서 Linear Algebra에 대해 자세히 알아보기

태그

Community Treasure Hunt

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

Start Hunting!

Translated by