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')
運行結果