matlab 这个程序哪里错了x=[129 140 103.5 88 185.5 195 105.5 157.5 107.5 77 81 162 162 117.5];y=[7.5 141.5 23 147 22.5 137.5 85.5 -6.5 -81 3 56.5 -66.5 84 -33.5];z=[-4-8 -6 -8 -6 -8 -8 -9 -9 -8 -8 -9 -4 -9];cx=75:0.5:200;cy=-70:0.5:150;cz=TRISC
来源:学生作业帮助网 编辑:六六作业网 时间:2024/11/24 23:31:31
matlab 这个程序哪里错了x=[129 140 103.5 88 185.5 195 105.5 157.5 107.5 77 81 162 162 117.5];y=[7.5 141.5 23 147 22.5 137.5 85.5 -6.5 -81 3 56.5 -66.5 84 -33.5];z=[-4-8 -6 -8 -6 -8 -8 -9 -9 -8 -8 -9 -4 -9];cx=75:0.5:200;cy=-70:0.5:150;cz=TRISC
matlab 这个程序哪里错了
x=[129 140 103.5 88 185.5 195 105.5 157.5 107.5 77 81 162 162 117.5];
y=[7.5 141.5 23 147 22.5 137.5 85.5 -6.5 -81 3 56.5 -66.5 84 -33.5];
z=[-4-8 -6 -8 -6 -8 -8 -9 -9 -8 -8 -9 -4 -9];
cx=75:0.5:200;
cy=-70:0.5:150;
cz=TRISCATTEREDINTERP(x,y,z,cx,'cy','cubic');
meshz(cx,cy,cz);
matlab 这个程序哪里错了x=[129 140 103.5 88 185.5 195 105.5 157.5 107.5 77 81 162 162 117.5];y=[7.5 141.5 23 147 22.5 137.5 85.5 -6.5 -81 3 56.5 -66.5 84 -33.5];z=[-4-8 -6 -8 -6 -8 -8 -9 -9 -8 -8 -9 -4 -9];cx=75:0.5:200;cy=-70:0.5:150;cz=TRISC
TriScatteredInterp没有‘cubic’这个选项,并且你的z也少了一个数,x和y都是14个数,z只有13个...
照着TriScatteredInterp的例子写:
x=[129 140 103.5 88 185.5 195 105.5 157.5 107.5 77 81 162 162 117.5];
y=[7.5 141.5 23 147 22.5 137.5 85.5 -6.5 -81 3 56.5 -66.5 84 -33.5];
z=[-4-8 -6 -8 -6 -8 -8 -9 -9 -8 -8 -9 -4 -9 -7];
% 在z的最后加了一个-7,LZ自己改吧...
F = TriScatteredInterp(x',y',z','linear');
cx=75:0.5:200;
cy=-70:0.5:150;
[qx,qy] = meshgrid(cx,cy);
qz = F(qx,qy);
mesh(qx,qy,qz);
hold on;
plot3(x,y,z,'o');