Main Content

Spline Fitting

About Splines in Curve Fitting Toolbox

You can work with splines in Curve Fitting Toolbox™ in several ways.

Using the Curve Fitter app or the fit function you can:

  • Fit cubic spline interpolants to curves or surfaces

  • Fit smoothing splines and shape-preserving cubic spline interpolants to curves (but not surfaces)

  • Fit thin-plate splines to surfaces (but not curves)

The toolbox also contains specific splines functions to allow greater control over what you can create. For example, you can use the csapi function for cubic spline interpolation. Why would you use csapi instead of the fit function 'cubicinterp' option? You might require greater flexibility to work with splines for the following reasons:

  • You want to combine the results with other splines, for example, by addition.

  • You want vector-valued splines. You can use csapi with scalars, vectors, matrices, and ND-arrays. The fit function only allows scalar-valued splines.

  • You want other types of splines such as ppform, B-form, tensor-product, rational, and stform thin-plate splines.

  • You want to create splines without data.

  • You want to specify breaks, optimize knot placement, and use specialized functions for spline manipulation such as differentiation and integration.

If you require specialized spline functions, see the following sections for interactive and programmatic spline fitting.

Interactive Spline Fitting

You can access all spline functions from the Spline Tool (splinetool).

See Introducing Spline Fitting.

Programmatic Spline Fitting

To programmatically fit splines, see Spline Construction for descriptions of types of splines and numerous examples.