matlab - 两个坐标向量和一个对称赋值向量插值的不对称结果
问题描述
我有两个坐标向量 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');
解决方案
看来您有一个常规网格,因此您需要使用or[5 x 5]
来代替。griddata
interp2
griddedInterpolant
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');
推荐阅读
- python - 在熊猫的新列中移动行中的值
- javascript - 从引导导航栏滚动到元素
- sql-server - Service Pack 到 SQL Server 容器
- c# - 以编程方式从文件打开网页并单击链接以处理响应 C#
- javascript - 使用 HTML Div 的 Javascript/Jquery onClick 不起作用
- javascript - 脚本属性 text/some-library 的映射如何工作
- javascript - Javascript双向参考问题
- python - 将 csv 从 gcs 迁移到 postgresql
- sql - SQL WHERE 条件为列表,列类型为数组
- javascript - vue.js:HTML 元素显示 - 如果不切换更改