ScatteredInterpolant is giving NaN as an answer when using 'natural' method.
9 次查看(过去 30 天)
显示 更早的评论
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 个评论
Walter Roberson
2023-9-12
Unfortunately I am not familiar with natural neighbour interpolation, and do not understand the wikipedia description at the moment.
回答(0 个)
另请参阅
类别
在 Help Center 和 File Exchange 中查找有关 Surface and Mesh Plots 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!