Gridded Interpolation in a certain volume and leave outside with NaN values
4 次查看(过去 30 天)
显示 更早的评论
the following scrpt creates this plot:
load('var.mat')
scatter3(xq(:),yq(:),zq(:),2,'k','filled'); hold on
scatter3(x,y,z,10,'r','filled')
![](https://www.mathworks.com/matlabcentral/answers/uploaded_files/707647/image.png)
From the data, you can see that xq,yq,zq and cq are a gridded data.
I want to use griddedInterpolant function to "fill" the cq(which contains NaN) values inside to x,y,z,c positions with an interpolation of c info. and remain all the points "outside" the red points as NaN.
0 个评论
采纳的回答
KSSV
2021-8-10
load('var.mat') ;
scatter3(xq(:),yq(:),zq(:),2,'k','filled'); hold on
scatter3(x,y,z,10,'r','filled')
F = scatteredInterpolant(x,y,z,c,'nearest') ;
cq0 = cq ;
for i = 1:583
i
cq(:,:,i) = F(xq(:,:,i),yq(:,:,i),zq(:,:,i)) ;
end
3 个评论
KSSV
2021-8-10
Read the document......you have an option to play around with that..you need to use Extrapolation method to none.
更多回答(0 个)
另请参阅
类别
在 Help Center 和 File Exchange 中查找有关 Interpolating Gridded Data 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!