Determine in an interpolation the contribution of each node nearby
Mostrar comentarios más antiguos
Hello,
I applied an interpolation using the cubic spline on a set of points. Is there any possible way I can find the contribution of the neighbouring nodes to the interpolation in the location I'm on? I know all nodes affects the interpolation but basically I want to find for each node, what are the most significant nodes that are mostly affecting the interpolation.
Thank you
Respuesta aceptada
Más respuestas (1)
Walter Roberson
el 14 de Oct. de 2022
As an approximation, and restricted to the case where the x coordinates of the spline are strictly increasing:
If you were to interp1() the query x coordinate against the indices of the x coordinates asking for 'nearest'
num_x = length(spline)x);
query_y = interp1(spline_x, spline_y, 'spline')
idx = interp1(spline_x, 1:num_x, query_x, 'nearest');
Now for idx > 1 & idx < num_x then spline_x(idx-1), spline_x(idx), spline_x(idx+1) and corresponding y values are three nearest nodes. From there you could calculate the distance between spline_x, spline_y to those three points, and use some kind of inverse distance to get weighting factors to give you an idea of how much the nodes contributed.
This will not be exact: to be exact you should take into account the derivative conditions.
Perhaps there is a better way by using spline() and pulling apart the piecewise polynomial.
Categorías
Más información sobre Interpolation en Centro de ayuda y File Exchange.
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!
