作业帮 > 综合 > 作业

matlab 三维 插值

来源:学生作业帮 编辑:作业帮 分类:综合作业 时间:2024/05/14 19:51:00
matlab 三维 插值
width=1:3;
depth=1:5;
temps=[82 81 80 82 84; 79 63 61 65 81; 84 84 82 85 86];
mesh(width,depth,temps);
di=1:.2:3;
wi=1:.2:5;
zcubic=interp2(width,depth,temps,wi,di,'cubic');
mesh(wi,di,zcubic);
提示:Error using ==> interp2
XI and YI must be the same size or vectors of different orientations.
这个错在哪里
depth=1:3; %这两个好像写反了
width=1:5; %这两个好像写反了
temps=[82 81 80 82 84; 79 63 61 65 81; 84 84 82 85 86];
mesh(width,depth,temps);
figure; %这里要重新开一个界面,否则刚刚画的图就要被下面的图覆盖了,就白画了.
[di,wi]=meshgrid(1:.2:3,1:.2:5);%这一步最关键!
zcubic=interp2(width,depth,temps,wi,di,'cubic');
mesh(wi,di,zcubic);