Labfans是一个针对大学生、工程师和科研工作者的技术社区。 | 论坛首页 | 联系我们(Contact Us) |
![]() |
![]() |
#1 |
高级会员
注册日期: 2019-11-21
帖子: 3,006
声望力: 66 ![]() |
![]()
I have a problem in which I have to interpolate 4D data d = f(a, b, c) often, because the interpolation happens within an optimisation routine. Now, at first I programmed this using Matlab's interpn function. However, the program obviously became very slow, because the cubic splines had to be constructed upon each iteration within the optimisation.
I have read about 2D spline interpolation and I am basically looking for its 4D equivalent: pp = spline(a,b,c,d). Also, I found the scatteredInterpolant function (I have a non-uniform grid), but this function only gives me options for 'linear', 'nearest', or 'natural' and not the 'spline' option I'm looking for. I could imagine that Matlab would have the function that is underneath the interpn function available, but I can't seem to find it. Does anyone know such a function that returns the piecewise polynomial or some other form of a spline function for a 4D interpolant, preferably Matlab-original? P.s. I have also looked into a workaround; typing edit interpn, I have tried copying the Matlab function interpn, naming it differently and editing it such that it returns F instead of Vq, the interpolating function. However, doing this it says it doesn't recognise the methodandextrapval function, the first nested Matlab built-in it encounters. 更多... |
![]() |
![]() |