matlab 三维 插值

来源:百度知道 编辑:UC知道 时间:2024/07/04 00:12:16
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);