How can I put meshgride data in a matrix and calculate eigenvalues and eigenvectors?
2 次查看(过去 30 天)
显示 更早的评论
I have below code for creating a meshgrid of k_x and k_y in order to put them in the 2*2 matrix and calculate eigenvectors and eigenvalues. But i recived the error "Dimensions of arrays being concatenated are not consistent.". How can I fix it?
My code is:
a=1.855;
eb=-3.276;
ep=-1.979;
t0=-1.844;
delta1x=a/2;
delta1y=a*sqrt(3)/2;
delta2x=a/2;
delta2y=-a*sqrt(3)/2;
delta3x=-a;
delta3y=0;
onsite1=ep;
onsite2=eb;
t1=1;
t2=2;
t3=3;
iform=complex(0.0,1.0);
kx=-2:0.05:2;
ky=-2:0.05:2;
[k_x,k_y]=meshgrid(kx,ky);
phi=t1.*exp(iform.*k_x.*delta1x).*exp(iform.*k_y.*delta1y)+t2.*exp(iform.*k_x.*delta2x).*exp(iform.*k_y.*delta2y)+t3.*exp(iform.*k_x.*delta3x);H2=[onsite1 phi;conj(phi) onsite2];
[v,E]=eig(H2);
0 个评论
回答(1 个)
Walter Roberson
2021-9-5
I had to guess about what you were doing.
a=1.855;
eb=-3.276;
ep=-1.979;
t0=-1.844;
delta1x=a/2;
delta1y=a*sqrt(3)/2;
delta2x=a/2;
delta2y=-a*sqrt(3)/2;
delta3x=-a;
delta3y=0;
onsite1=ep;
onsite2=eb;
t1=1;
t2=2;
t3=3;
iform=complex(0.0,1.0);
kx=-2:0.05:2;
ky=-2:0.05:2;
[k_x,k_y]=meshgrid(kx,ky);
phi=t1.*exp(iform.*k_x.*delta1x).*exp(iform.*k_y.*delta1y)+t2.*exp(iform.*k_x.*delta2x).*exp(iform.*k_y.*delta2y)+t3.*exp(iform.*k_x.*delta3x);
H2 = [onsite1*ones(size(phi)) phi; conj(phi) onsite2*ones(size(phi))];
[v,E]=eig(H2);
size(v), size(E)
另请参阅
类别
在 Help Center 和 File Exchange 中查找有关 Eigenvalues & Eigenvectors 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!