Linear Extrapolation with interp2
이전 댓글 표시
Matlab's griddedInterpolant allows for linear interpolation with linear extrapolation in 2D space, i.e.,
griddedInterpolant(X,Y,V,'linear','linear');
However, it seems to be the case that interp2, which I believe uses griddedInterpolant under-the-hood, doesn't allow for this combination. If "linear" is selected as the interpolation method, then the extrapolation must be a scalar. Is there a way to use linear-linear inter-extrapolation with interp2?
댓글 수: 4
John D'Errico
2020년 5월 16일
Why bother? Since you already know how to use griddedInterpolant, the point seems moot.
Matt J
2020년 5월 16일
Why bother? Since you already know how to use griddedInterpolant, the point seems moot.
One reason I can think of is if you are interpolating using gpuArrays. griddedInterpolant is not supported for gpuArray objects, but interp2 is.
John D'Errico
2020년 5월 16일
My question is still valid for Michael to answer as to why. Regardless, you can't force interp2 to do what it is not written to do. Anyway, IF the interp2 call is just going to get sent into griddedInterpolant anyway, then the GPU call would still seem to be a problem, since then interp2 is just a wrapper.
Matt J
2020년 5월 16일
I am curious of Michael's actual motives as well. Irrespectively, though, it is a frustrating problem for gpuArray users... I don't believe the gpuArray version of interp2 is a wrapper for anything. If a GPU version of griddedInterpolant existed, it would make sense for the Parallel Computing Toolbox developers to make it available to us.
채택된 답변
추가 답변 (0개)
카테고리
도움말 센터 및 File Exchange에서 Matrices and Arrays에 대해 자세히 알아보기
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!