0% found this document useful (0 votes)
23 views

Splines Interpolation

This document discusses cubic splines for data interpolation. [1] Cubic splines use piecewise cubic polynomials to smoothly interpolate data points, as opposed to single polynomials used in interpolation. [2] Linear splines connect data points with straight lines, but lack smoothness. Cubic splines address this by using cubic polynomials between points. [3] The document provides an example cubic spline and verifies it satisfies the properties of interpolating data points and having continuous derivatives at points.
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
23 views

Splines Interpolation

This document discusses cubic splines for data interpolation. [1] Cubic splines use piecewise cubic polynomials to smoothly interpolate data points, as opposed to single polynomials used in interpolation. [2] Linear splines connect data points with straight lines, but lack smoothness. Cubic splines address this by using cubic polynomials between points. [3] The document provides an example cubic spline and verifies it satisfies the properties of interpolating data points and having continuous derivatives at points.
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 17

Interpolation

Cubic splines

Josept Revuelta Ph.D.


Introduction

Splines represent an alternative approach to data interpolation. In polynomial


interpolation, a single formula, given by a polynomial, is used to meet all data
points. The idea of splines is to use several formulas, each a low-degree
polynomial, to pass through the data points. We see that in polynomial
interpolation, we use a unique formula up to degree n-1.
The simplest example of a spline is a linear spline, in which one “connects the
dots’’ with straight-line segments. Assume that we are given a set of data points
(x1,y1), . . . , (xn,yn) with x1 < · · · < xn. A linear spline consists of the (n−1)-line
segments that are drawn between neighboring pairs of points.
Introduction
Figure (a) shows a linear spline where, between each neighboring pair of
points (xi,yi ), (xi+1,yi+1), the linear function y = ai + bix is drawn through the two
points. The given data points in the figure are (1,2), (2,1), (4,4), and (5,3).
Introduction
The linear spline is given by:

The linear spline successfully interpolates an arbitrary set of n data points.


However, linear splines lack smoothness. Cubic splines are meant to
address this shortcoming of linear splines. A cubic spline replaces linear
functions between the data points by degree 3 (cubic) polynomials.
Introduction

An example of a cubic spline that interpolates the same points (1,2), (2,1), (4,4),
and (5,3) is shown in Figure (b). The equations defining the spline are

Note the smooth transition from one Si to the next at the base points, or
“knots,’’ x = 2 and x = 4.
Warning!

“Given n points (x1,y1), . . . , (xn,yn), there is obviously one and only one linear
spline through the data points. This will not be true for cubic splines. We
will find that there are infinitely many through any set of data points. Extra
conditions will be added when it is necessary to nail down a particular spline
of interest.”
Properties of splines
To be a little more precise about the properties of a cubic spline, we make the
following definition: Assume that we are given the n data points (x1,y1), . . . ,
(xn,yn), where the xi are distinct and in increasing order. A cubic spline S(x)
through the data points (x1,y1), . . . , (xn,yn) is a set of cubic polynomials
These polynomials have the following properties:

Property 1 Si(xi) = yi and Si(xi+1) = yi+1 for i = 1,...,n − 1. This property


guarantees that the spline S(x) interpolates the data points.

Property 2 S’i−1(xi ) = S’i(xi) for i = 2,...,n − 1. This property forces the


slopes of neigboring parts of the splines to agree where they meet.

Property 3 S’’i−1(xi) = S’’i(xi) for i = 2,...,n − 1. This property does the


same for the curvature, represented by second derivative.
Example 1
Check that {S1,S2,S3} satisfies all cubic spline properties for the data points (1,2),
(2,1), (4,4), and (5,3).

Property 1. There are n = 4 data points. We must check

These follow easily from


the defining equations.
Property 2. The first derivatives of the spline functions are

We must check S’1(2) = S’2(2) and S’2(4) = S’3(4). The first is

and the second is

both of which check out.


Property 3. The second derivatives are

We must check S1”(2) = S2”(2) and S2”(4) = S3”(4), both of which are
true so we can conclude that defining equations are in fact cubic
splines.
Constructing a spline from a set of data points means finding the coefficients bi,ci,di
that make Properties 1–3 hold. However, we need to impose some additional
conditions for the within part and end points of the splines. For the moment, we
can start with the natural splines:
Example 2
Find the natural cubic spline through (0,3), (1,−2), and (2,1)
The x-coordinates are x1 = 0, x2 = 1, and x3 = 2. The y-coordinates are a1 =
y1 = 3, a2 = y2 = −2, and a3 = y3 = 1, and the differences are δ1 = δ2 = 1, Δ1 =−5,
and Δ2 = 3. The tridiagonal matrix equation is

The solution is [c1,c2,c3] = [0,6,0].


Now we can compute di’s and bi’s

Therefore, the cubic spline is


Let’s now move to MATLAB:
End conditions

• Curvature-adjusted cubic spline.


• Clamped cubic spline
• Parabolically terminated cubic spline
• Not-a-knot cubic spline
Additional exercises

You might also like