Labfans是一个针对大学生、工程师和科研工作者的技术社区。 论坛首页 | 联系我们(Contact Us)
MATLAB爱好者论坛-LabFans.com
返回   MATLAB爱好者论坛-LabFans.com > 其它 > 资料存档
资料存档 资料存档
回复
 
主题工具 显示模式
旧 2019-11-23, 20:41   #1
poster
高级会员
 
注册日期: 2019-11-21
帖子: 3,006
声望力: 66
poster 正向着好的方向发展
默认 How do I construct a piecewise polynomial (cubic spline) for 4D data in MATLAB?

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.



更多...
poster 当前离线   回复时引用此帖
回复


发帖规则
不可以发表新主题
不可以发表回复
不可以上传附件
不可以编辑自己的帖子

启用 BB 代码
论坛禁用 表情符号
论坛启用 [IMG] 代码
论坛启用 HTML 代码



所有时间均为北京时间。现在的时间是 17:43


Powered by vBulletin
版权所有 ©2000 - 2025,Jelsoft Enterprises Ltd.