matlab画三维图,帮忙检查一下,运行后没有显示错误,但是只有坐标,没有图

2024-11-27 03:37:51
推荐回答(1个)
回答1:

% X Y 是 239×4 矩阵,Z 是 1×239 数组,只能画3维线图

for x1=-20:5:-13.33;

   y1=2:1:65;

   z1=10.679077*y1+76.22395;

end

for x2=-12.78:5:-2.22;

    y2=2:1:65;

    z2=10.679077*y2+77.2795;

end

for x3=-1.67:5:20.56;

    y3=2:1:65;

    z3=10.679077*y3+81.003257+1.637691*x3+0.037138134*x3.^2;

end

for x4=21.11:5:50;

    y4=2:1:78.505651-0.65833856*x4;

    z4=10.679077*y4+99.116096+1.587052*x4;

end

x=[x1 x2 x3 x4];

y=[y1 y2 y3 y4];

[X,Y]=meshgrid(x,y);

Z=[z1 z2 z3 z4];

plot3(X,Y,Z);

grid