MATLAB Answers

Matrix dimensions must agree.

2 views (last 30 days)
mohammad mortezaie
mohammad mortezaie on 12 Sep 2021
Answered: per isakson on 12 Sep 2021
I have below code for a contour plot bu I faced with "Matrix dimensions must agree.".
How can I fix it?
a=1.855;
eb=-3.276;
ep=-1.979;
t0=-1.844;
theta=0;
ee=linspace(-0.3,0.3,200);
EE=linspace(0,10,200);
[e,omega]=meshgrid(ee,EE);
sigma=0.265;
exx=e.*((cos(theta)).^2-sigma.*(sin(theta)).^2);
exy=e.*((1+sigma).*cos(theta).*sin(theta));
eyx=e.*((1+sigma).*cos(theta).*sin(theta));
eyy=e.*((sin(theta))^2-sigma.*(cos(theta)).^2);
delta1x=a/2;
delta1y=a*sqrt(3)/2;
delta2x=a/2;
delta2y=-a*sqrt(3)/2;
delta3x=-a;
delta3y=0;
delta11=a*(1+3.*eyy/4+sqrt(3).*exy/2+exx/4);
delta22=a.*(1+3.*eyy/4-sqrt(3).*exy/2+exx/4);
delta33=a.*(1+exx);
g1=-2.6275;
g2=2*g1;
del1=g1.*(exx+eyy);
del2=g2.*(exx+eyy);
on1=ep+del1 ;
on2=eb+del2;
t1=t0*exp(-3.37.*(delta11/a-1));
t2=t0*exp(-3.37.*(delta22/a-1));
t3=t0*exp(-3.37.*(delta33/a-1));
delta2=0.2;
eta=0.05;
iform=complex(0.0,1.0);
X = linspace(-1.5,1.5,200);
ky= linspace(-2,2,200);
[x,y] = meshgrid(X, ky);
u=0.0;
T=10;
phi=t1.*exp(iform.*x.*delta1x).*exp(iform.*y.*delta1y)+t2.*exp(iform.*x.*delta2x).*exp(iform.*y.*delta2y)+t3.*exp(iform.*x.*delta3x);
H2 = [on1.*ones(size(phi)) phi; conj(phi) on2.*ones(size(phi))];
[v,E]=eig(H2);
E1=E(1);
E2=E(4);
v1=v(:,1);
v2=v(:,2);
phiy=t1.*iform.*delta1y.*exp(iform.*x.*delta1x).*exp(iform.*y.*delta1y)+t2.*iform.*delta2y.*exp(iform.*x.*delta2x).*exp(iform.*y.*delta2y);
H2y=[zeros(size(phiy)) phiy;
conj(phiy) zeros(size(phiy))];
jy12=((v1'.*H2y.*v2).*conj(v1'.*H2y.*v2));
deltaE12=E2-E1;
fermi1=1/(1+exp((E1-u)/T));
fermi2=1/(1+exp((E2-u)/T));
sigma_xx=(iform.*omega.^-1).*(jy12).*(fermi2-fermi1).*( (omega+deltaE12+iform.*delta2).^-1-(omega-deltaE12+iform.*delta2).^-1 );
contour(e,EE,sigma_xx,500)

Answers (1)

per isakson
per isakson on 12 Sep 2021
Because (jy12) is 400x400 and omega is 200x200

Tags

Community Treasure Hunt

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

Start Hunting!