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

Chapter 5 Curve Fitting

The document discusses different types of spline interpolation, including linear splines which are piecewise linear functions, quadratic splines which are piecewise quadratic polynomials in each interval, and cubic splines which are piecewise cubic polynomials that satisfy certain continuity conditions at the interval knots in order to have a continuously differentiable function. The number of unknown coefficients for each type of spline is determined based on the required continuity conditions at the interval knots.
Copyright
© Attribution Non-Commercial (BY-NC)
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
151 views

Chapter 5 Curve Fitting

The document discusses different types of spline interpolation, including linear splines which are piecewise linear functions, quadratic splines which are piecewise quadratic polynomials in each interval, and cubic splines which are piecewise cubic polynomials that satisfy certain continuity conditions at the interval knots in order to have a continuously differentiable function. The number of unknown coefficients for each type of spline is determined based on the required continuity conditions at the interval knots.
Copyright
© Attribution Non-Commercial (BY-NC)
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 12

Chapter 5 Curve Fitting : Splines

5.1 Introduction

Fig. 5.1
Fig. 5.2

5.2 Linear Splines


o Piecewise interpolating polynomial :

Fig. 5.3 Notation used to drive splines.

(n-1) intervals and n data points

o Piecewise linear interpolating funtions

n set data points :

Piecewise linear polynomial in interval:

, i = 1, 2, …, n-1

Fig. 5.4 (a) linear spline, (b) quadratic spline, (c) cubic spline

5.3 Quadratic Splines

Piecewise quadratic polynomial in interval :

(5.5)
In each interval we need 3 conditions. So total 3(n-1) conditions.

1. : (n-1) eqns

2. : (n-1) eqns

3. : (n-2) eqns
rd
The 3 condition is not satisfied for , :

4. or : 2 eqns

Total number of equations : 3(n-1)

By 1st condition:

(5.6)

By 2nd condition:

(5.7)

Let ,

(5.8)

By 3rd condition:

Then

(5.9)
i=2,3,…,n-1;

By 4th condition:
[Ex 15.2]

1 3.0 2.5

2 4.5 1.0

3 7.0 2.5

4 9.0 0.5

Unknowns ( bi ) :

st
2 condition:

nd
3 condition :

5.4 Piecewise cubic spline

n data points

(5-10)
There are 4(n-1) unknowns. We need 4(n-1) conditions.

1)

(5-11)

(5-12)

2)

(5-13)

3)

1st derivative conditions: (n-2).

(5-14)

(5-15)

4) 2nd derivative conditions: (n-2).

(5-16)

, (5-17)

(5-18)

(5-18) is substituted in (5-13):

(5-19)

(5-18) is substituted in (5-15):

(5-20)

(5-23)

Rewrite the equation (5-19):


(5-21)

(5-22)

(5-21) and (5-22) are substituted in (5-23):

(5-24)

for

In equation (15-24), there are (n-3) equations and (n-1) unknowns. Hence

we need an extra 2 conditions:

How to give extra conditions?

Type:

1) natural spline :

(∵ See equation (5-17))

In equation (5-24), Take the interior points (i=2, …, n-2):

i=2:

i=3:

i = n-2 :

Matrix form :

[Ex 5.3]

1 3.0 2.5

2 4.5 1.0

3 7.0 2.5

4 9.0 0.5
Suppose that x1  z1  x2 , xn1  z 2  xn , and suppose that f ( z1 ), f ( z 2 ) are

known. Then use the extra condition


s( z1 )  f ( z1 ) , s( z 2 )  f ( z 2 ) (not-a-knot interpolation boundary conditions)

 Periodic spline:
 Complete spline:

[ Matlab function ] lookfor spline


y=spline(x_nodes, y_nodes, x)
If one uses the statements
pp=spline(x_nodes, y_nodes)
[breaks, coefs, l, k, d]=unmkpp(pp)

yi = interp1(x, y, xi, 'method')

yi = interp1(x, y, xi, 'spline')

yi = interp1(x, y, xi, 'linear')

yi = interp1(x, y, xi, 'cubic')

[Ex] x=0:10;

y=sin(x);

xi=0:0.25:1

yi=interp1(x,y,xi);

plot(x,y,'o',xi,yi)
yi=interp1(x,y,xi.'spline');
Homework:
Is there a choice of coefficients {a, b,c,} for which the following function is a cubic

spline?

You might also like