How can I interpolate data with the function ScatteredInterpolant (or else) within the boundaries of the input data only?

1 回表示 (過去 30 日間)
Hi,
I'm testing interpolation functions to create grid data (Data Terrain Model) from contour lines stored in an xyz file that I imported in the structure contour_grid:
[xi,yi] = meshgrid(Xmin:res:Xmax, Ymin:res:Ymax);
f = scatteredInterpolant(contour_grid.X,contour_grid.Y,contour_grid.Z);
f.Method = 'natural';
zi= f(xi,yi);
My problem is that the ScatteredInterpolant function struggles to output sensible values outside of the contour lines. It makes sense since it does not have enough points to interpolate properly/sensibly. See "lip" below":
I would like to find a way not to output any data outside of the area defined by my outermost contour line or alternatively to automatically crop the grid domain accordingly (keep anything wth x >1.835 x 10^6 for example in that case).
I can't see how the function can be asked to do that. I'm trying to use indices to discard the erroneous data but I cannot formulate it properly.
Can anyone think of a smart way to do that/ has already solved this kind of issue?
Thank you,

採用された回答

Star Strider
Star Strider 2019 年 9 月 16 日
Specify 'ExtrapolationMethod' as 'none'.
  4 件のコメント
NP
NP 2019 年 9 月 17 日
Not all pages refering to scaterredInterpolant seem to mention that parameter. Always worth browsing some more!
Star Strider
Star Strider 2019 年 9 月 17 日
I surfed this page: scatteredInterpolant. There could be version differences in the documentation. This is the documentation for R2019a.

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

その他の回答 (0 件)

カテゴリ

Help Center および File ExchangeInterpolation of 2-D Selections in 3-D Grids についてさらに検索

Community Treasure Hunt

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

Start Hunting!

Translated by