数据插补二维

时间:2019-05-31 13:35:31

标签: matlab-figure

我有3个向量x(纬度),y(经度)和z(温度)。我想根据纬度和经度绘制温度的表面图。 %%%%%%%%%%数据示例

x y z -22.683 351.742 163.377 -22.653 353.880 162.842 -24.429 352.028 165.464 -25.304 353.662 166.293 -26.080 350.964 168.410 -26.891 351.265 163.149 -26.510 353.360 164.340 -28.334 352.206 167.365 -27.047 354.279 160.497 -29.298 353.313 162.117 -28.130 355.123 161.040 -29.558 354.607 158.820 -30.747 354.560 159.748 -30.343 353.643 163.050 -32.135 353.952 161.295 -31.873 352.739 158.819 -33.459 352.041 156.667 -34.617 353.650 161.459 -35.113 352.193 157.221 -35.842 353.723 159.710 -36.780 353.010 157.850 -37.625 353.854 158.033 -38.345 352.193 157.760 -39.253 353.372 159.990 -40.020 352.450 153.937 -40.890 354.644 159.620 -41.573 352.185 156.371 -42.437 354.723 160.590 -43.268 351.733 154.670 -44.865 351.833 156.360 -45.605 352.847 156.620 -46.435 352.212 156.100 -46.940 353.117 156.330 -47.978 352.670 155.300 -49.275 353.432 154.937 -49.100 354.521 157.207 -50.569 354.319 156.186 -50.197 355.384 158.470 -51.543 355.330 154.043 -50.996 356.339 160.752 -52.505 356.308 154.183 -51.825 357.317 156.362 -53.178 357.570 155.255 -52.561 358.235 154.576 -53.197 358.587 156.187 -52.323 358.771 155.725

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

我希望曲面图靠近数据点

使用下面的代码,我具有表面数据,但表面并不靠近数据点。

    %%%%%%%%%%%%%%%%%%%%%%%%%%%   

function createfigure(x,y,z)   
%%%%%%%%%%%%%%%%%%%%%   
figure;   
[X , Y] = meshgrid(min(x):0.01:max(x),min(y):0.01:max(y));   
[xi,yi,zi]=griddata(x,y,z,X,Y);    
contourf(xi,yi,zi,'edgecolor','none','LevelStep',0.01);   
h=colorbar('location','Eastout');    
colormap('jet');    
hold on     
plot (x,y,'.','Color',[0 0 0])   
     %%%%%%%%%%%%%%%%%%%%%%%%%%%  

我希望在数据点附近有一个曲面图

0 个答案:

没有答案