![]() |
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 [URL="https://nl.mathworks.com/help/matlab/ref/interpn.html"]interpn[/URL] 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 [URL="https://nl.mathworks.com/help/matlab/ref/spline.html"]2D spline interpolation[/URL] and I am basically looking for its 4D equivalent: pp = spline(a,b,c,d). Also, I found the [URL="https://nl.mathworks.com/help/matlab/ref/scatteredinterpolant.html#bvkmyb8-Method"]scatteredInterpolant[/URL] 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. [url=https://stackoverflow.com/questions/59003492/how-do-i-construct-a-piecewise-polynomial-cubic-spline-for-4d-data-in-matlab]更多...[/url] |
所有时间均为北京时间。现在的时间是 21:19。 |
Powered by vBulletin
版权所有 ©2000 - 2025,Jelsoft Enterprises Ltd.