Gridded Interpolation in a certain volume and leave outside with NaN values

1 回表示 (過去 30 日間)
Philippe Corner
Philippe Corner 2021 年 8 月 10 日
コメント済み: Philippe Corner 2021 年 8 月 10 日
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')
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.

採用された回答

KSSV
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
KSSV 2021 年 8 月 10 日
Read the document......you have an option to play around with that..you need to use Extrapolation method to none.
Philippe Corner
Philippe Corner 2021 年 8 月 10 日
Yes, you were right. It worked now. I appreciate a lot your help

サインインしてコメントする。

その他の回答 (0 件)

カテゴリ

Help Center および File ExchangeInterpolation についてさらに検索

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by