cubic spline interpolation of a function that yields NaNs when evaluated at some of the grid points.
6 次查看(过去 30 天)
显示 更早的评论
Hi i want to cubic spline interpolate an unknown function defined over a 3 dimensional domain, whose values i know at the gridpoints of some 3D grid. This can conveniently be done with griddedinterpolant, which even allows extrapolation.
Yet my unknown function is not defined on a part of the grid, hence it takes the value NaN at some gridpoints, like:
4 3 2 1
3 2 1 NaN
2 1 NaN NaN
1 NaN NaN NaN
If i now use griddedinterpolant, the interpolant gives NaN, whether inside or outside the boundaries of the grid.
Is there some way to overcome this problem? Is there a way to get a cubic spline interpolation for a function that yields NaNs on some parts of the grid, on which the interpolant is defined?
Any advice is greatly appreciated!
0 个评论
回答(3 个)
Image Analyst
2013-6-29
You're not going to be using coordinates down there anyway - you can't since you don't know what they are - so just set them to anything, such as 1, and do your spline. It doesn't really matter what you do down there. Now if you needed to extrapolate into the nan zone, that's a different question. I might use John DÉrrico's polyfitn() to do that. (See the File Exchange).
0 个评论
另请参阅
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!