Mesh plot, not able to match size of Z and X

1 次查看(过去 30 天)
t=0.2;
p=1;
for kx = -3:.1:3
q=1;
for ky = -3:.1:3
energy_ary(p,q)= -2*t*(cos(kx)+cos(ky));
y_ary(p,q)= ky;
q=q+1;
end
x_ary(p)=kx;
p=p+1;
end
x = x_ary ;
y = y_ary ;
[XX,YY] = meshgrid(x,y);
ZZ = energy_ary' ;
contourf(XX,YY,ZZ) ;

回答(1 个)

VBBV
VBBV 2023-4-15
编辑:VBBV 2023-4-15
t=0.2;
p=1;
for kx = -3:.1:3
q=1;
for ky = -3:.1:3
energy_ary(p,q)= -2*t*(cos(kx)+cos(ky));
y_ary(q)= ky;
q=q+1;
end
x_ary(p)=kx;
p=p+1;
end
x = x_ary ;
y = y_ary ;
[XX,YY] = meshgrid(x,y);
ZZ = energy_ary' ;
contourf(XX,YY,ZZ) ;

类别

Help CenterFile Exchange 中查找有关 Scatter Plots 的更多信息

标签

Community Treasure Hunt

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

Start Hunting!

Translated by