matlab画三维图,帮忙检查一下,运行后没有显示错误,但是只有坐标,没有图
forx1=-20:5:-13.33;y1=2:1:65;z1=10.679077*y1+76.22395;endforx2=-12.78:5:-2.22;y2=2:1:...
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*x;
z4=10.679077*y+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];
mesh(X,Y,Z)
axis tight; 展开
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*x;
z4=10.679077*y+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];
mesh(X,Y,Z)
axis tight; 展开
展开全部
% 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
追问
是一个分段的函数,怎么样才能画出三维网格的图?
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询