首页 > 解决方案 > 两个坐标向量和一个对称赋值向量插值的不对称结果

问题描述

我有两个坐标向量 x 什么是 x 方向的向量和 y 什么是 y 方向的向量和一个对应的 z 值向量,称为“z”。我现在想将这个非均匀数据插入到一个非常精细的均匀坐标网格中。但不知何故,尽管实际的 z 值是对称的,但结果是不对称的: 见输出。有人会如何解决这个简单的问题吗?这是我的代码:

  x = [0;0;0;0;0;50;50;50;50;50;95;95;95;95;95;100;100;100;100;100;150;150;150;150;150];
  y = [0;250;500;750;1000;0;250;500;750;1000;0;250;500;750;1000;0;250;500;750;1000;0;250;500;750;1000];

  XspanVector = 1:1:150;
  YspanVector = 1:1:1000;

  [xx,yy] = meshgrid(obsXspanVector,obsYspanVector);

  z = [2000 3000 15165 3000 2000 2000 3000 35750519 3000 2000 2000 3000 113059 3000 2000 2000 3000 109117 3000 2000 2000 3000 36863 3000 2000];

  % Interpolate to grid
  zz = griddata(x,y,z',xx,yy,'linear');

  % Plot
  contourf(xx,yy,10.*log10(zz),'LineColor','none');

标签: matlabplotinterpolation

解决方案


看来您有一个常规网格,因此您需要使用or[5 x 5]来代替。griddatainterp2griddedInterpolant

xi = reshape(xObsG,5,5);
yi = reshape(yObsG,5,5);
zi = reshape(obsMaxIntInterpFlyoverSum,5,5);
z  = interp2(xi,yi,zi,xxObsG,yyObsG);

contourf(xxObsG,yyObsG,10.*log10(z),'LineColor','none');

对称的


推荐阅读