这里是我的代码插入两个Z表之间的任意数量的不同站。我相信它可以被重写为在interp1()函数中包含所有Z表单。希望这可以让你朝着正确的方向前进。
zLevels = 5; %number of interpolated points between z50 and z75
nStation = 100; %number of (lat,long) pairs to interpolate
for i = 1:nStation %for nStation different (lat, long) pairs generate interp. values
% generate zQuery points between z50 and z75 for each station
zQuery = ((1:zLevels)/zLevels)*range([z50mb_vec(i) z75mb_vec(i)]) + z75mb_vec(i);
% use interp1 to interpolate about the Z axis for U component
U(i,1:zLevels) = interp1([z50mb_vec(i) z75mb_vec(i)],[UwindVec50mb(i) UwindVec75mb(i)],zQuery);
% and for V component
V(i,1:zLevels) = interp1([z50mb_vec(i) z75mb_vec(i)],[VwindVec50mb(i) VwindVec75mb(i)],zQuery);
end
% defining some color codes for each zLevel, otherwise the plot is a mess
% of colors
colorcode = ['r' 'g' 'b' 'm' 'c' 'r' 'g' 'b' 'm' 'c' 'r'];
for j = 1:nStation
for i = 1:zLevels
quiver3(lat_value(j), long_value(j), zQuery(i), U(j,i), V(j,i), 0, colorcode(i));
hold on;
end
end
生成图(Z50数据是蓝绿色,Z75是红色,插片,否则):
是否有可能为你提供一个.MAT文件中的数据被绘制以及用于生成/绘制数据的代码? – Falimond
我为我的天真评论事先表示歉意。除了代码之外,我可以创建一个.mat文件,我认为如果你注释掉read_grib和mex文件的解压部分,你就可以做所有的事情,但我是“.mat”文件的新手,所以我不确定!让我知道! **感谢您在无意间教我关于“.mat”文件:) 通过Dropbox下载:https://www.dropbox.com/s/5bgrwexesqm9a52/Code%26MATfile_WindSim.zip –
从您发布的图片看起来像是最终结果和插值图将看起来像箭头的波浪墙,其中上面显示的彩色片表示对于某个Z值的波浪壁的横截面。如果这是正确的,那么可能interp3不是你正在寻找的函数,而是interp2或interp1可能足以看到你的lat和long值总是固定的。然后,对于每个长/经度坐标,您只需插入一个维度(Z),然后选择多个查询点(相当于添加的横截面)。 – Falimond