PlanetMath (more info)
 Math for the people, by the people.
Encyclopedia | Requests | Forums | Docs | Wiki | Random | RSS  
Login
create new user
name:
pass:
forget your password?
Main Menu
Owner confidence rating: Very low Entry average rating: Very high
cubic spline interpolation (Definition)

Suppose we are given $ N+1$ data points $ \{(x_{k},y_{k})\}$ such that

$\displaystyle a=x_{0}<\dots<x_{N}.$ (1)

Then the function $ S(x)$ is called a cubic spline interpolation if there exists $ N$ cubic polynomials $ S_{k}(x)$ with coefficients $ s_{k,i}\,\,0\leq i\leq 3$ such that the following hold.

  1. $ S(x)=S_{k}(x)=\sum_{i=0}^{3}s_{k,i}(x-x_{k})^{i} \; \;\;\forall x\in [x_{k},x_{k+1}]\;\;\;0\leq k \leq N-1$
  2. $ S(x_{k})=y_{k}\;\;\;0\leq k \leq N$
  3. $ S_{k}(x_{k+1})=S_{k+1}(x_{k+1})\;\;\;0\leq k \leq N-2$
  4. $ S^{\prime}_{k}(x_{k+1})=S^{\prime}_{k+1}(x_{k+1})\;\;\;0\leq k \leq N-2$
  5. $ S^{\prime \prime}_{k}(x_{k+1})=S^{\prime \prime}_{k+1}(x_{k+1})\;\;\;0\leq k \leq N-2$

The set of points $ \eqref{knot}$ are called the knots. The set of cubic splines on a fixed set of knots, forms a vector space for cubic spline addition and scalar multiplication.

So we see that the cubic spline not only interpolates the data $ \{(x_{k},y_{k})\}$ but matches the first and second derivatives at the knots. Notice, from the above definition, one is free to specify constraints on the endpoints. One common end point constraint is $ S^{\prime\prime}(a)=0\;\;S^{\prime\prime}(b)=0$, which is called the natural spline. Other popular choices are the clamped cubic spline, parabolically terminated spline and curvature-adjusted spline. Cubic splines are frequently used in numerical analysis to fit data. Matlab uses the command spline to find cubic spline interpolations with not-a-knot end point conditions. For example, the following commands would find the cubic spline interpolation of the curve $ 4\cos(x)+1$ and plot the curve and the interpolation marked with o's.

x = 0:2*pi;
y = 4*cos(x)+1;
xx = 0:.001:2*pi;
yy = spline(x,y,xx);
plot(x,y,'o',xx,yy)



Anyone with an account can edit this entry. Please help improve it!

"cubic spline interpolation" is owned by yota. [ full author list (2) | owner history (7) ]
(view preamble)

View style:

Log in to rate this entry.
(view current ratings)

Cross-references: interpolation, curve, MATLAB, end point, endpoints, second derivatives, multiplication, scalar, addition, vector space, fixed set, knots, coefficients, polynomials, function, points
There is 1 reference to this entry.

This is version 4 of cubic spline interpolation, born on 2003-06-11, modified 2006-10-19.
Object id is 4339, canonical name is CubicSplinInterpolation.
Accessed 34005 times total.

Classification:
AMS MSC65-01 (Numerical analysis :: Instructional exposition )

Pending Errata and Addenda
None.
[ View all 4 ]
Discussion
Style: Expand: Order:
forum policy
Continuous but not matched. by jtr on 2005-07-19 16:43:44
"but matches the first and second derivatives at the knots."

The derivatives are continuous across boundaries but do not in general match the TRUE derivatives anywhere. I assume what you are implying is that the derivatives of the spline on either side of a knot are MATCHED to one another. The original statement seemed misleading on first read.
[ reply | up ]
cubic spline by tensorking on 2004-10-06 02:08:46


This is my entry and I wrote every word of it. I never orphaned it and you should be ashamed of yourself for putting you name on something that you had absolutly to contribution in.
[ reply | up ]
classification by jduchon on 2004-05-25 05:44:41
There is an "Interpolation" section (41A05) and a "Spline approximation"
section (41A15) in MSC. When you browse the encyclopedia by subjects,
having only one classification for each entry may get one miss many
relevant entries. So I suggest to add these two if possible.

Other point: the "natural" and "not-a-knot" end point conditions are the
same, which should be stated.

[ reply | up ]
Matlab? by igor on 2003-06-13 02:15:40
I'm a little concerned with the use of Matlab as an illustrating example.

First, it does not show an algorithm that computes a cubic spline interpolation, it just shows an example of how to use an already implemented routine in Matlab. I don't think this should be PlanetMath's job, the place for this is in Matlab documentation.

Second, if there's a piceof code with a 'plot' command, why not include the plot output in the article?

Third, Matlab is proprietary software, and I think it's a little against the spirit of this site to advertise it. If you look at GNU Octave, together with the Octave-forge package, it can execute the exact same piece of code.

I'm sure this issue will come up again in the future, so I would like to see some discussion. On these questions in general:
* Should PlanetMath try to be language neutral?
* If not, should Free software be pefered to proprietary software?
* If yes, should there be some "standard" syntax for the pseudocode
 used to demonstrate algorithms?
[ reply | up ]

Interact
post | correct | update request | add derivation | add example | add (any)