piecewise cubic spline interpolation

Obtains a piecewise cubic spline from a function, and a function to obtain derivatives is included.

You are now following this Submission

The one-dimensional interpolation is based on segmented g(x)=a+b*x+c*x^2+d*x^3 functions where the knots remain twice continuously differentiable. This guarantees that the interpolation is smooth. Different end knot conditions are implemented. The depth of the interpolation is variable, and can be set to depend on an absolute or relative error tolerance. It is meant to be easy to interpolate expensive functions that take a lot of time, so if local_interpolation is set to one, and the function is locally predictable, knots are actually interpolated and not calculated from the original function which helps to save computational time. The function pwcs_deriv gives derivative up to the third order.

Cite As

Alexander (2026). piecewise cubic spline interpolation (https://uk.mathworks.com/matlabcentral/fileexchange/54286-piecewise-cubic-spline-interpolation), MATLAB Central File Exchange. Retrieved .

General Information

MATLAB Release Compatibility

  • Compatible with any release

Platform Compatibility

  • Windows
  • macOS
  • Linux
Version Published Release Notes Action
1.0