Chapter 5 Curve Fitting
Chapter 5 Curve Fitting
5.1 Introduction
Fig. 5.1
Fig. 5.2
, i = 1, 2, …, n-1
∴
Fig. 5.4 (a) linear spline, (b) quadratic spline, (c) cubic spline
(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
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 :
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)
(5-14)
(5-15)
(5-16)
, (5-17)
(5-18)
(5-19)
(5-20)
(5-23)
(5-22)
(5-24)
for
In equation (15-24), there are (n-3) equations and (n-1) unknowns. Hence
Type:
1) natural spline :
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 , xn1 z 2 xn , and suppose that f ( z1 ), f ( z 2 ) are
Periodic spline:
Complete spline:
[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?