Spline Interpolation: Problems
Spline Interpolation: Problems
Spline Interpolation: Problems
Problems:
When ‘n’ becomes large, in many cases, polynomials can lead to erroneous
results because of round-off errors and overshoot.
Solution:
Use lower-order polynomials to subsets (2 consecutive data points) of data
points Such connecting polynomials are called spline functions.
Linear spline fit a straight line for each interval between knots & the data must
be in order.
Solution
Use higher order polynomial splines.
To ensure smoothness at knot, equate the derivatives at knots
b) Quadratic Spline Interpolation
Data points: (x0,y0), (x1,y1),…….,(xn-1,yn-1), (xn,yn)
Quadratic spline fit a quadratic polynomial for each interval between knots
.
a n x n 1 b n x n 1 c n f(x n 1 )
2
a i x i b i x i ci f(x i )
2
b) Quadratic Spline Interpolation
2. The first derivatives of two quadratic splines are continuous (i.e. the same) at the
interior knots
Since there are (n-1) interior points, there are (n-1) such equations!
3. Assume the first spline is linear or the 2nd derivative is zero at the first knot.
2n + (n-1) + 1 = 3n equations
Since there are (n-1) interior points, there are (n-1) such equations!
3. Assume the first spline is linear or the 2nd derivative is zero at the first knot.
2n + (n-1) + 1 = 3n equations
2. The first derivatives of two cubic spline are continuous at the inner knots.
There are (n-1) equations.
4. The second derivatives at the end knots are zero –assume a ‘natural’ spline.
There are 2 equations.
(Need to specify the end condition Refer to the end knot conditions)
Thus, there are 4n equations to solve simultaneously to determine a’s, b’s, c’s and d’s.
c) Cubic Spline Interpolation
Variety of the end knots condition
1. Natural end conditions - assume the second derivative at the end knots are zero function
become straight line at the end knots.
2. Clamped end conditions - assume the first derivatives at the first and last knots are known –
need to specify the desired slope at the end knots.
3. “Not-a-knot” end conditions – to force continuity of the third derivative at the second and
next-to-last knots (results in the first two intervals having the same spline function and the
last two intervals having the same spline function)
Spline Interpolation – Example
Fit the data with the quadratic splines and evaluate the function at x = 2.7.
20
X f(x) 15
1 1
2 4
10
3 9 5
4 16
0
0 1 2 3 4 5
Spline Interpolation – Example
Solution:
Since we have 4 data points, we need 3 intervals and 9 conditions to solve for the quadratic
splines.
Solving for the unknown constants yield The quadratic splines for each interval are then,
a1 = 0 b1 = 3 c1 = - 2 •f1 (x) = 3x - 2 1 1≤ x ≤ 2
a2 = 2 b2 = - 5 c2 = 6 •f2 (x) = 2x2 - 5x + 6 2 ≤ x ≤ 3
a3 = 0 b3 = 7 c3 = - 12 •f3 (x) = 7x - 12 3≤x≤4