用一些已知点的坐标,用matlab画空间曲面?A=[1,0,02;1,12.5,02;1,25,02;0.99,50,02;0.99,100,02;0.99,200,02;0.98,400,02;0.96,800,02;0.94,1600,02;0.91,3200,02;1,0,05;1,12.5,05;1,25,05;1,50,05;0.99,100,05;0.99,200,05;0.98,400,05;0.96,800,05;0.9
来源:学生作业帮助网 编辑:六六作业网 时间:2024/11/28 16:09:09
用一些已知点的坐标,用matlab画空间曲面?A=[1,0,02;1,12.5,02;1,25,02;0.99,50,02;0.99,100,02;0.99,200,02;0.98,400,02;0.96,800,02;0.94,1600,02;0.91,3200,02;1,0,05;1,12.5,05;1,25,05;1,50,05;0.99,100,05;0.99,200,05;0.98,400,05;0.96,800,05;0.9
用一些已知点的坐标,用matlab画空间曲面?
A=[1,0,02;1,12.5,02;1,25,02;0.99,50,02;0.99,100,02;0.99,200,02;0.98,400,02;0.96,800,02;0.94,1600,02;0.91,3200,02;
1,0,05;1,12.5,05;1,25,05;1,50,05;0.99,100,05;0.99,200,05;0.98,400,05;0.96,800,05;0.92;1600,05;0.87,3200,05;
1,0,10;1,12.5,10;1,25,10;0.99,50,10;0.98,100,10;0.98,200,10;0.96,400,10;0.94,800,10;0.9,1600,10;0.81,3200,10;
1,0,15;1,12.5,15;0.99,25,15;0.99,50,15;0.98,100,15;0.97,200,15;0.95,400,15;0.92;800,15;0.88,1600,15;0.78,3200,15;
1,0,18;1,12.5,18;0.99,25,18;0.98,50,18;0.97,100,18;0.96,200,18;0.94,400,18;0.88,800,18;0.81,1600,18;0.72;3200,18;
1,0,20;0.99,12.5,20;0.99,25,20;0.97,50,20;0.95,100,20;0.92;200,20;0.85,400,20;0.76,800,20;0.66,1600,20;0.56,3200,20;
1,0,25;0.99,12.5,25;0.98,25,25;0.97,50,25;0.93,100,25;0.88,200,25;0.79,400,25;0.7,800,25;0.59,1600,25;0.48,3200,25;
1,0,28;0.99,12.5,28;0.98,25,28;0.96,50,28;0.92;100,28;0.84,200,28;0.75,400,28;0.65,800,28;0.54,1600,28;0.44,3200,28];
x=A(:,1);y=A(:,2);z=A(:,3);
scatter(x,y,5,z)%散点图
figure
[X,Y,Z]=griddata(x,y,z,linspace(0.4,1)',linspace(0,3200),'v4');%插值
pcolor(X,Y,Z);shading interp%伪彩色图
figure,contourf(X,Y,Z) %等高线图
figure,surf(X,Y,Z)%三维曲面
输入后总会出现:
Error using ==> vertcat
All rows in the bracketed expression must have the same
number of columns.
知道了,是数据里的分割符出错了!另外运行时出现:
In griddata at 75?Undefined function orvariable 'shadinginterp'.
这是怎么回事?
用一些已知点的坐标,用matlab画空间曲面?A=[1,0,02;1,12.5,02;1,25,02;0.99,50,02;0.99,100,02;0.99,200,02;0.98,400,02;0.96,800,02;0.94,1600,02;0.91,3200,02;1,0,05;1,12.5,05;1,25,05;1,50,05;0.99,100,05;0.99,200,05;0.98,400,05;0.96,800,05;0.9
那肯定是你数据A每行数字不一样多的缘故