MATLAB Answers

help for creating a 2D lookup table .

19 views (last 30 days)
vvf vvff
vvf vvff on 23 Feb 2020
Commented: vvf vvff on 25 Feb 2020
I want to create a table F so that I could searh values ffrom the table by F(x,y). When I am using the scatteredInterpolant , some points i get inf values. Why it happens ??? for the neighboring values around x y , I got the right values. Thank you so much !!!!!!!!!!!!!!!!!!!
  2 Comments
Walter Roberson
Walter Roberson on 24 Feb 2020
Suppose that you had two points (realmin, 0) and (3*realmin,10) and you ask to interpolate at 2*realmin. Δy = 10, Δx = 2*realmin. Δy/Δx = 5/realmin. But 1/realmin is the largest non-infinite number, so that is 5 times (almost infinity) which is infinity.
Therefore it is possible with locations very close together for interpolation to generate inf even though none of the data is inf or nan.

Sign in to comment.

Accepted Answer

Walter Roberson
Walter Roberson on 24 Feb 2020
My comment shows how inf can occur for non-infinite values even when examining data inside the region.
However, probably what is happening for you is that you are asking for values at a location outside the maximum triangulation of the scattered data, and you have your interpolation configured to return inf in that case.
More typical is for people to leave interpolation at the default, in which case requesting values outside of the triangulation gets you nan instead of inf.
  3 Comments
vvf vvff
vvf vvff on 25 Feb 2020
Thank you ! I haven't noticed that

Sign in to comment.

More Answers (0)

Community Treasure Hunt

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

Start Hunting!