Professional Documents
Culture Documents
B. D. Mulmi
Institute of Engineering
Feb, 2016
Linear Interpolation
Polynomial Interpolation
f0,1 (x)
for
x0 x x1
f1,2 (x)
for
x1 x x2
f (x) =
...
...
...
hi (x xi )
6
hi
yi+1 (x xi ) yi (x xi+1 )
+
hi
Where, Mi = yi00
00
Mi+1 = yi+1
hi = xi+1 xi
xi+1 xi xi xi1
or,
yi yi1
If n = 4:
For i = 1 :
For i = 2 :
For i = 3 :
y1 y0
M0 (h0 ) + 2M1 (h0 + h1 ) + M2 (h1 ) = 6
h1
h0
y2 y1
M1 (h1 ) + 2M2 (h1 + h2 ) + M3 (h2 ) = 6
h2
h1
y3 y2
M2 (h2 ) + 2M3 (h2 + h3 ) + M4 (h3 ) = 6
h3
h2
h0
0
0
2(h0 + h1 )
h1
0
0
h1
2(h1 + h2 )
h2
0
0
h2
2(h2 + h3 ) h3
M0
M1
M2
M3
M4
y1 /h1 y0 /h0
[x1 , x2 ] [x0 , x1 ]
= 6 y2 /h2 y1 /h1 = 6 [x2 , x3 ] [x1 , x2 ]
y3 /h3 y2 /h2
[x3 , x4 ] [x2 , x3 ]
If x is equally spaced:
Mi1 + 4Mi + Mi+1 =
6 2
yi1
h2
If n = 4,
6 2
y0
h2
6
M1 + 4M2 + M3 = 2 2 y1
h
6
M2 + 4M3 + M4 = 2 2 y2
h
M0 + 4M1 + M2 =
or,
1 4 1 0 0
0 1 4 1 0
0 0 1 4 1
In Natural Cubic
4
1
0
M0
M1
M2
M3
M4
y0
6
=
2 y1
h2
2 y2
Spline, M0 = Mn = 0
2
1 0
M1
y0
6
4 1 M2 = 2 2 y 1
h
M3
1 4
2 y2
Example
Using Cubic Spline Interpolation Technique, compute y(3), y(5),
and y(7) from the following data:
x
y
2
7
4
6
6
9
8
11
10
8
Solution:
Here, n = 4
and x is in equally-spaced interval i.e., h = 2
Let, M0 , M1 , ..., Mn be the 2nd derivatives at x = x0 , x1 , ..., xn
Thus, we have,
M0
y0
1 4 1 0 0
M
1
0 1 4 1 0 M2 = 6 2 y 1
h2
2 y2
0 0 1 4 1 M3
M4
y0
4 1 0
M1
1 4 1 M2 = 6 2 y 1
h2
2 y2
0 1 4
M3
or,
4 1 0
M1
4
6
1 4 1 M2 = 1
4
0 1 4
M3
5
or,
x
2
y
7
2 y
-1
4
3
6.0
4 1 0
M1
1 4 1 M2 = 1.5
M3
7.5
0 1 4
11
-5
-3
10
On solving, we get,
M1 = 1.5804
M2 = 0.3214
-1
2
M3 = 1.7946
i
x
y
M
0
2
7
0
4
10
8
0
h(x x1 )
+
6
h
h
1.5804
(5 6)3
f (5) =
2(5 6)
6
2
0.3214
(5 4)3
9(5 4) 6(5 6)
2(5 4)
+
6
2
2
= 7.1839