ScatteredInterpolant is giving NaN as an answer when using 'natural' method.
10 views (last 30 days)
Show older comments
Hello,
I'm using scatteredIntepolant to interpolate an electric field. when using 'linear' as a method to interpolate the field, I get an answer and all is fine but precision wise it's not so great. For that, I decided to use the 'natural' method, as it is stated to be more accurate, though for whatever reason, I keep getting NaN as an answer.
To interpolate the field, I create an interpolant as follows:
interpE = scatteredInterpolant(Xout(:),Yout(:),Zout(:),Ex_Field_out(:),'natural');
then I interpolate the field at a position (x0,y0,z0) using interpE(x0,y0,z0) for any x0 y0 z0 falling into the zone of interpolation, i.e., within the range of positions of Xout, Yout and Zout.
The answer, for some reason, is always NaN, unless it was calculated over the same data points, i.e., interpE(Xout(1),Yout(1),Zout(1)) will give basically the correct answer, as that was basically the input.
I tried also to interpolate only the real or imag part of Ex_Field_out, although I think that is already done internally in the function, but yet even with that, it still gives NaN.
Any help? Thank you.
5 Comments
Walter Roberson
on 12 Sep 2023
Unfortunately I am not familiar with natural neighbour interpolation, and do not understand the wikipedia description at the moment.
Answers (0)
See Also
Categories
Find more on Surface and Mesh Plots in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!