MATLAB Functions Help Desk

spline

Purpose

Cubic spline interpolation

Syntax

Description

The spline function interpolates between data points using cubic spline fits.

yi = spline(x,y,xi) accepts vectors x and y that contain coarsely spaced data, and vector xi that specifies a new, more finely spaced abscissa. The function uses cubic spline interpolation to find a vector yi corresponding to xi.

pp = spline(x,y) returns the pp-form of the cubic spline interpolant, for later use with ppval and other spline functions.

Examples

The two vectors

represent the census years from 1900 to 1990 and the corresponding United States population in millions of people. The expression

uses the cubic spline to extrapolate and predict the population in the year 2000. The result is

The statements

interpolate the data with a cubic spline, evaluate that spline for each year from 1900 to 2000, and plot the result.

Algorithm

spline is a MATLAB M-file. It uses the M-files ppval, mkpp, and unmkpp. These routines form a small suite of functions for working with piecewise polynomials. spline uses these functions in a fairly simple fashion to perform cubic spline interpolation. For access to the more advanced features, see the M-files and the Spline Toolbox.

See Also

interp1     One-dimensional data interpolation (table lookup)

ppval       Evaluate piecewise polynomial

References

[1] de Boor, C., A Practical Guide to Splines, Springer-Verlag, 1978.



[ Previous | Help Desk | Next ]