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!