|On this page…|
You can work with splines in Curve Fitting Toolbox™ in several ways.
Using the Curve Fitting 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, e.g., by addition.
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 an overview of splines, and interactive and programmatic spline fitting.
The Curve Fitting Toolbox spline functions are a collection of tools for creating, viewing, and analyzing spline approximations of data. Splines are smooth piecewise polynomials that can be used to represent functions over large intervals, where it would be impractical to use a single approximating polynomial.
The spline functionality includes a graphical user interface (GUI) that provides easy access to functions for creating, visualizing, and manipulating splines. The toolbox also contains functions that enable you to evaluate, plot, combine, differentiate, and integrate splines. Because all toolbox functions are implemented in the open MATLAB® language, you can inspect the algorithms, modify the source code, and create your own custom functions.
Key spline features:
GUIs that let you create, view, and manipulate splines and manage and compare spline approximations
Functions for advanced spline operations, including differentiation, integration, break/knot manipulation, and optimal knot placement
Support for piecewise polynomial form (ppform) and basis form (B-form) splines
Support for tensor-product splines and rational splines (including NURBS)
You can access all spline functions from the splinetool GUI. You can use the GUI to:
Vary spline parameters and tolerances
View and modify data, breaks, knots, and weights
View the error of the spline, or the spline's first or second derivative
Observe the toolbox commands that generated your spline
Create and import data, including built-in instructive data sets, and save splines to the workspace
To programmatically fit splines, see Construction for descriptions of types of splines and numerous examples.