Problem in Eigen values plot

1 visualización (últimos 30 días)
AVM
AVM el 25 de Jun. de 2020
Comentada: AVM el 28 de Jun. de 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')

Respuesta aceptada

Takumi
Takumi el 26 de Jun. de 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
  1 comentario
AVM
AVM el 28 de Jun. de 2020
@Takumi: Thanks for your reply.

Iniciar sesión para comentar.

Más respuestas (0)

Categorías

Más información sobre Linear Algebra en Help Center y File Exchange.

Etiquetas

Community Treasure Hunt

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

Start Hunting!

Translated by