ZI = griddata(x,y,z,XI,YI) %x、y、z——数据,XI,YI——X-Y平面上档空的网格数据
应用实例:
>>x = rand(100,1)*4-2; y = rand(100,1)*4-2;
>>z = x.*exp(-x.^2-y.^2);
>>ti = -2:.25:2;
>>[XI,YI] = meshgrid(ti,ti);
>>ZI = griddata(x,y,z,XI,YI);
>>mesh(XI,YI,ZI), hold
>>plot3(x,y,z,'o'), hold off
>> xlabel('x'),ylabel('y'),zlabel('z')
运行结果