Interpolating data to find the values at NaN locations in the region.

2 ビュー (過去 30 日間)
waqas
waqas 2020 年 11 月 18 日
コメント済み: waqas 2020 年 11 月 19 日
I have a field which, when I plot, results in NaN values in between the known values. I want to interpolate the values on these NaN locations in the (blue) region only and keep rest of the region as NaN. I could not figure how exactly to achieve it.
Attached is .mat file of the field and following is the code to get the same plot.
ax = pcolor((v)); colormap(parula(50)); %caxis([30 50])
axis tight equal;colorbar
ax.LineStyle = 'none';ax.EdgeColor = 'flat';ax.FaceColor = 'flat';
ax.FaceAlpha = 1;
axis ij on equal

採用された回答

Andrei Bobrov
Andrei Bobrov 2020 年 11 月 19 日
編集済み: Andrei Bobrov 2020 年 11 月 19 日
[m,n] = size(v);
[i,j] = ndgrid(1:m,1:n);
lo = ~isnan(v);
F = scatteredInterpolant(i(lo),j(lo),v(lo));
vout = F(i,j);
lo2 = lo;
lo2(97:132,4:118) = true;
vout(~lo2) = NaN;
  1 件のコメント
waqas
waqas 2020 年 11 月 19 日
Thankyou. I was able to make changes to my code to get the desired results.

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

その他の回答 (0 件)

カテゴリ

Help Center および File ExchangeGet Started with Image Processing Toolbox についてさらに検索

Community Treasure Hunt

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

Start Hunting!

Translated by