ScatteredInterpolant is giving NaN as an answer when using 'natural' method.

10 visualizaciones (últimos 30 días)
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 comentarios
Walter Roberson
Walter Roberson el 12 de Sept. de 2023
Unfortunately I am not familiar with natural neighbour interpolation, and do not understand the wikipedia description at the moment.
Mhamad Hantro
Mhamad Hantro el 12 de Sept. de 2023
Thanks for trying though :)
I don't know much about the algorithm either, I just looked it up in Matlab's documentation, and read in some blog that although it's more accurate but still it's not the default method due to the fact that it came much later. I did try a simple example where I created a random function, and the interpolation worked, though for some reason, it's not working here.
Thanks again :)

Iniciar sesión para comentar.

Respuestas (0)

Categorías

Más información sobre Surface and Mesh Plots en Help Center y File Exchange.

Productos


Versión

R2023a

Community Treasure Hunt

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

Start Hunting!

Translated by