griddata(grid数据格式介绍)
知识大全 2022-08-01 18:30www.worldometers.cn知识大全
griddata的作用是数据网格化。其一般用法格式为
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')
运行结果