(nearest、linear、cubic、spline)对peaks函数的插值效果图,函数命令如下:
[x y z]=peaks(10);
mesh(x,y,z)
[xi,yi]=meshgrid(-3:.1:3,-3:.1:3);
n=interp2(x,y,z,xi,yi,'nearest');
l=interp2(x,y,z,xi,yi,'linear');
c=interp2(x,y,z,xi,yi,'cubic');
s=interp2(x,y,z,xi,yi,'spline');
subplot(2,2,1);mesh(xi,yi,n);
subplot(2,2,2);mesh(xi,yi,l);
subplot(2,2,3);mesh(xi,yi,c);
subplot(2,2,4);mesh(xi,yi,s);