# Spline Construction

Using the Curve Fitting app or the `fit`

function, you can
fit cubic spline interpolants, smoothing splines, and thin-plate
splines. Other Curve Fitting Toolbox™ functions allow more specialized control over spline
construction. For example, you can use the function `csapi`

for cubic spline
interpolation. For more information, see How to Construct Splines.

## Functions

`bspline` | Plot B-spline and its polynomial pieces |

`csape` | Cubic spline interpolation with end conditions |

`csapi` | Cubic spline interpolation |

`csaps` | Cubic smoothing spline |

`cscvn` | “Natural” or periodic interpolating cubic spline curve |

`franke` | Franke's bivariate test function |

`getcurve` | Interactive creation of cubic spline curve |

`ppmak` | Put together spline in ppform |

`rpmak` | Put together rational spline |

`rscvn` | Piecewise biarc Hermite interpolation |

`rsmak` | Put together rational spline for standard geometric shapes |

`spap2` | Least-squares spline approximation |

`spapi` | Spline interpolation |

`spaps` | Smoothing spline |

`spcrv` | Spline curve by uniform subdivision |

`splinetool` | Experiment with some spline approximation methods |

`spmak` | Put together spline in B-form |

`spterms` | Explain spline terms |

`stmak` | Put together function in stform |

`tpaps` | Thin-plate smoothing spline |

`titanium` | Titanium test data |

## Topics

### Introduction to Splines

Tools for interactive and programmatic spline fitting in Curve Fitting Toolbox.

**Curve Fitting Toolbox Splines and MATLAB Splines**

How Curve Fitting Toolbox extends the splines (or
piecewise-polynomial functions) of MATLAB^{®}.

**Types of Splines: ppform and B-form**

Learn about the definitions of the ppform and B-form splines.

**B-Splines and Smoothing Splines**

Learn about the definitions of the B-form and smoothing splines.

**Multivariate and Rational Splines**

Learn how to construct multivariate and rational splines.

Learn about the definition of the ppform spline.

Learn about the definition of B-form splines.

### Fundamental Spline Methods

Use cubic splines to interpolate smooth data, choosing knots and smoothness.

Use vector-valued splines to plot curves through given points.

**Fitting Values at N-D Grid with Tensor-Product Splines**

Use vector-valued splines to approximate gridded data in any number of variables using tensor-product splines.

**Fitting Values at Scattered 2-D Sites with Thin-Plate Smoothing Splines**

Use the thin-plate smoothing spline for work with scattered bivariate data. Tensor-product splines are good for gridded (bivariate and even multivariate) data.

**Constructing and Working with ppform Splines**

Learn how to construct ppform splines.

**Constructing and Working with B-form Splines**

Learn how to construct B-form splines.

**Multivariate Tensor Product Splines**

Learn how to construct multivariate splines.

**Constructing and Working with Rational Splines**

Learn how to construct rational splines.

**Constructing and Working with stform Splines**

Learn how to construct stform splines.

**Least-Squares Approximation by Natural Cubic Splines**

The construction of a least-squares approximant usually requires that one have in hand a basis for the space from which the data are to be approximated.

This section discusses these aspects of a nonlinear ODE problem:

**Construction of the Chebyshev Spline**

This section discusses these aspects of the Chebyshev spline construction:

**Approximation by Tensor Product Splines**

Because the toolbox can handle splines with *vector* coefficients, it is easy to implement interpolation or approximation to gridded data by tensor product splines, as the following illustration is meant to show.

This example shows how to construct splines in various ways using the spline functions in Curve Fitting Toolbox™.

**Construct and Work with the B-form**

This example shows how to construct and work with the B-form of a spline in Curve Fitting Toolbox™.

**Construct and Work with the PPFORM**

This example shows how to construct and work with the ppform of a spline in Curve Fitting Toolbox™.

This example shows how to select and optimize knots using the `optknt`

and `newknt`

commands from Curve Fitting Toolbox™.

### Fitting Splines to Data

This example shows how to use the `csapi`

and `csape`

commands from Curve Fitting Toolbox™ to construct cubic spline interpolants.

This example shows how to use the `csaps`

and `spaps`

commands from Curve Fitting Toolbox™ to construct cubic smoothing splines.

**Fitting a Spline to Titanium Test Data**

This example shows how to use commands from Curve Fitting Toolbox™ to fit a spline to titanium test data with manual and automatic selection of knots.

### Spline Applications

This example shows how to use the `spmak`

, `spcrv`

, `cscvn`

and `rscvn`

commands from Curve Fitting Toolbox™ to construct spline curves in the plane.

**Constructing Spline Curves in 2D and 3D**

This example shows how to use the `cscvn`

command from Curve Fitting Toolbox™ to construct cubic spline curves in two and three dimensions.

This example shows how to use spline commands from Curve Fitting Toolbox™ to smooth a histogram.

**Bivariate Tensor Product Splines**

This example shows how to use the spline commands in Curve Fitting Toolbox™ to fit tensor product splines to bivariate gridded data.

**Solving a Nonlinear ODE with a Boundary Layer by Collocation**

This example shows how to use spline commands from Curve Fitting Toolbox™ solve a nonlinear ordinary differential equation (ODE).

**Construction of a Chebyshev Spline**

This example shows how to use commands from Curve Fitting Toolbox™ to construct a Chebyshev spline.