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!