1 interpolasi. direct method of interpolation 3 what is interpolation ? given (x 0,y 0 ), (x 1,y 1...
TRANSCRIPT
1
INTERPOLASI
Direct Method of Interpolation
3
What is Interpolation ?Given (x0,y0), (x1,y1), …… (xn,yn), find the value of ‘y’ at a value of ‘x’ that is not given.
Figure 1 Interpolation of discrete.
4
Interpolants
Polynomials are the most common choice of interpolants because they are easy to:
Evaluate Differentiate, and Integrate
5
Direct MethodGiven ‘n+1’ data points (x0,y0), (x1,y1),………….. (xn,yn),pass a polynomial of order ‘n’ through the data as
given below:
where a0, a1,………………. an are real constants. Set up ‘n+1’ equations to find ‘n+1’ constants. To find the value ‘y’ at a given value of ‘x’, simply
substitute the value of ‘x’ in the above polynomial.
.....................10n
n xaxaay
6
Example 1 The upward velocity of a rocket is given as a
function of time in Table 1.
Find the velocity at t=16 seconds using the direct method for linear interpolation.
0 0
10 227.04
15 362.78
20 517.35
22.5 602.97
30 901.67
Table 1 Velocity as a function of time.
Figure 2 Velocity vs. time data for the rocket example
s ,t m/s ,tv
7
Linear Interpolation taatv 10
78.3621515 10 aav
35.5172020 10 aav
Solving the above two equations gives,
93.1000 a 914.301 a
Hence .2015,914.3093.100 tttv
m/s 7.39316914.3093.10016 v
00 , yx
xf1
11, yx
x
y
Figure 3 Linear interpolation.
8
Example 2 The upward velocity of a rocket is given as a
function of time in Table 2.
Find the velocity at t=16 seconds using the direct method for quadratic interpolation.
0 0
10 227.04
15 362.78
20 517.35
22.5 602.97
30 901.67
Table 2 Velocity as a function of time.
Figure 5 Velocity vs. time data for the rocket example
s ,t m/s ,tv
9
Quadratic Interpolation
2210 tataatv
04.227101010 2210 aaav
78.362151515 2210 aaav
35.517202020 2210 aaav
Solving the above three equations gives
05.120 a 733.171 a 3766.02 a
Quadratic Interpolation
00 , yx
11, yx
22 , yx
xf2
y
x
Figure 6 Quadratic interpolation.
10
Quadratic Interpolation (cont.)
10 12 14 16 18 20200
250
300
350
400
450
500
550517.35
227.04
y s
f range( )
f x desired
2010 x s range x desired
2010,3766.0733.1705.12 2 ttttv
2163766.016733.1705.1216 v
m/s 19.392
The absolute relative approximate error obtained between the results from the first and second order polynomial is
%38410.0
10019.392
70.39319.392
a
a
11
Example 3 The upward velocity of a rocket is given as a
function of time in Table 3.
Find the velocity at t=16 seconds using the direct method for cubic interpolation.
0 0
10 227.04
15 362.78
20 517.35
22.5 602.97
30 901.67
Table 3 Velocity as a function of time.
Figure 6 Velocity vs. time data for the rocket example
s ,t m/s ,tv
12
Cubic Interpolation
33
2210 tatataatv
33
2210 10101004.22710 aaaav
33
2210 15151578.36215 aaaav
33
2210 20202035.51720 aaaav
33
2210 5.225.225.2297.6025.22 aaaav
2540.40 a 266.211 a 13204.02 a 0054347.03 a
y
x
xf3
33 , yx
22 , yx
11, yx
00 , yx
Figure 7 Cubic interpolation.
13
Cubic Interpolation (contd)
10 12 14 16 18 20 22 24200
300
400
500
600
700602.97
227.04
y s
f range( )
f x desired
22.510 x s range x desired
5.2210,0054347.013204.0266.212540.4 32 tttttv
m/s 06.392
160054347.01613204.016266.212540.416 32
v
The absolute percentage relative approximate error between second and third order polynomial is
a
%033269.0
10006.392
19.39206.392
a
14
Comparison Table
Order of Polynomial
1 2 3
m/s 16tv 393.7 392.19 392.06
Absolute Relative Approximate Error
---------- 0.38410 % 0.033269 %
Table 4 Comparison of different orders of the polynomial.
15
Distance from Velocity ProfileFind the distance covered by the rocket from t=11s to t=16s ?
5.2210,0054606.013064.0289.213810.4 32 tttttv
m 1605
40054347.0
313204.0
2266.212540.4
0054347.013204.0266.212540.4
1116
16
11
432
16
11
32
16
11
tttt
dtttt
dttvss
16
Acceleration from Velocity Profile
5.2210,0054347.013204.0266.212540.4 32 ttttFind the acceleration of the rocket at t=16s given that
5.2210 ,016382.026130.0289.21
0054347.013204.0266.212540.4
2
32
ttt
tttdt
d
tvdt
dta
2
2
m/s 665.29
16016304.01626408.0266.2116
a
Lagrange Method of Interpolation
18
What is Interpolation ?
Given (x0,y0), (x1,y1), …… (xn,yn), find the value of ‘y’ at a value of ‘x’ that is not given.
19
Interpolants
Polynomials are the most common choice of interpolants because they are easy to:
EvaluateDifferentiate, and Integrate.
20
Lagrangian Interpolation
Lagrangian interpolating polynomial is given by
n
iiin xfxLxf
0
)()()(
where ‘ n ’ in )(xf n stands for the thn order polynomial that approximates the function )(xfy
given at )1( n data points as nnnn yxyxyxyx ,,,,......,,,, 111100 , and
n
ijj ji
ji xx
xxxL
0
)(
)(xLi is a weighting function that includes a product of )1( n terms with terms of ij
omitted.
21
Example The upward velocity of a rocket is given as a
function of time in Table 1. Find the velocity at t=16 seconds using the Lagrangian method for linear interpolation.
Table Velocity as a function of time
Figure. Velocity vs. time data for the rocket example
(s) (m/s)
0 010 227.0415 362.7820 517.35
22.5 602.9730 901.67
t )(tv
22
Linear Interpolation
10 12 14 16 18 20 22 24350
400
450
500
550517.35
362.78
y s
f range( )
f x desired
x s1
10x s0
10 x s range x desired
)()()(1
0ii
itvtLtv
)()()()( 1100 tvtLtvtL
78.362,15 00 tt
35.517,20 11 tt
23
Linear Interpolation (contd)
1
00 0
0 )(
jj j
j
tt
tttL
10
1
tt
tt
1
10 1
1 )(
jj j
j
tt
tttL
01
0
tt
tt
)()()( 101
00
10
1 tvtt
tttv
tt
tttv
)35.517(1520
15)78.362(
2015
20
tt
)35.517(1520
1516)78.362(
2015
2016)16(
v
)35.517(2.0)78.362(8.0
7.393 m/s.
24
Quadratic InterpolationFor the second order polynomial interpolation (also called quadratic interpolation), we
choose the velocity given by
2
0
)()()(i
ii tvtLtv
)()()()()()( 221100 tvtLtvtLtvtL
25
Example The upward velocity of a rocket is given as a
function of time in Table 1. Find the velocity at t=16 seconds using the Lagrangian method for quadratic interpolation.
Table Velocity as a function of time
Figure. Velocity vs. time data for the rocket example
(s) (m/s)
0 010 227.0415 362.7820 517.35
22.5 602.9730 901.67
t )(tv
26
Quadratic Interpolation (contd)
10 12 14 16 18 20200
250
300
350
400
450
500
550517.35
227.04
y s
f range( )
f x desired
2010 x s range x desired
,100 t 04.227)( 0 tv
,151 t 78.362)( 1 tv
,202 t 35.517)( 2 tv
2
00 0
0 )(
jj j
j
tt
tttL
20
2
10
1
tt
tt
tt
tt
2
10 1
1 )(
jj j
j
tt
tttL
21
2
01
0
tt
tt
tt
tt
2
20 2
2 )(
jj j
j
tt
tttL
12
1
02
0
tt
tt
tt
tt
27
Quadratic Interpolation (contd)
m/s19.392
35.52712.078.36296.004.22708.0
35.5171520
1516
1020
101678.362
2015
2016
1015
101604.227
2010
2016
1510
151616
212
1
02
01
21
2
01
00
20
2
10
1
v
tvtt
tt
tt
tttv
tt
tt
tt
tttv
tt
tt
tt
tttv
The absolute relative approximate error obtained between the results from the first and second order polynomial is
a
%38410.0
10019.392
70.39319.392
a
28
Cubic Interpolation
10 12 14 16 18 20 22 24200
300
400
500
600
700602.97
227.04
y s
f range( )
f x desired
22.510 x s range x desired
For the third order polynomial (also called cubic interpolation), we choose the velocity given by
3
0
)()()(i
ii tvtLtv
)()()()()()()()( 33221100 tvtLtvtLtvtLtvtL
29
Example The upward velocity of a rocket is given as a
function of time in Table 1. Find the velocity at t=16 seconds using the Lagrangian method for cubic interpolation.
Table Velocity as a function of time
Figure. Velocity vs. time data for the rocket example
(s) (m/s)
0 010 227.0415 362.7820 517.35
22.5 602.9730 901.67
t )(tv
30
Cubic Interpolation (contd) 04.227,10 oo tvt 78.362,15 11 tvt
35.517,20 22 tvt 97.602,5.22 33 tvt
3
00 0
0 )(
jj j
j
tt
tttL
30
3
20
2
10
1
tt
tt
tt
tt
tt
tt;
3
10 1
1 )(
jj j
j
tt
tttL
31
3
21
2
01
0
tt
tt
tt
tt
tt
tt
3
20 2
2 )(
jj j
j
tt
tttL
32
3
12
1
02
0
tt
tt
tt
tt
tt
tt;
3
30 3
3 )(
jj j
j
tt
tttL
23
2
13
1
03
0
tttt
tttt
tt
tt
10 12 14 16 18 20 22 24200
300
400
500
600
700602.97
227.04
y s
f range( )
f x desired
22.510 x s range x desired
31
Cubic Interpolation (contd)
m/s06.392
97.6021024.035.517312.078.362832.004.2270416.0
97.602205.22
2016
155.22
1516
105.22
101635.517
5.2220
5.2216
1520
1516
1020
1016
78.3625.2215
5.2216
2015
2016
1015
101604.227
5.2210
5.2216
2010
2016
1510
151616
323
2
13
1
13
12
32
3
12
1
02
0
231
3
21
2
01
01
30
3
20
2
10
1
v
tvtt
tt
tt
tt
tt
tttv
tt
tt
tt
tt
tt
tt
tvtt
tt
tt
tt
tt
tttv
tt
tt
tt
tt
tt
tttv
The absolute relative approximate error obtained between the results from the first and second order polynomial is
a
%033269.0
10006.392
19.39206.392
a
32
Comparison Table
Order of Polynomial
1 2 3
v(t=16) m/s 393.69 392.19 392.06
Absolute Relative
Approximate Error
--------0.38410
%0.033269
%
33
Distance from Velocity Profile
Find the distance covered by the rocket from t=11s to
t=16s ?
,00544.013195.0265.21245.4)( 32 ttttv 5.2210 t
16
11
)()11()16( dttvss
16
11
32 )00544.013195.0265.21245.4( dtttt
1611
432
]4
00544.03
13195.02
265.21245.4[ttt
t
1605 m
)5727.2)(300065045()1388.4)(33755.7125.47(
)9348.1)(45008755.52()36326.0)(67505.10875.57()(2323
2323
tttttt
tttttttv
34
Acceleration from Velocity Profile
,
Find the acceleration of the rocket at t=16s given that
32 00544.013195.0265.21245.4 tttdt
dtv
dt
dta
201632.026390.0265.21 tt
2)16(01632.0)16(26390.0265.21)16( a
665.29 2/ sm
,00544.013195.0265.21245.4)( 32 ttttv 5.2210 t
Newton’s Divided Difference Method of
Interpolation
36
What is Interpolation ?
Given (x0,y0), (x1,y1), …… (xn,yn), find the value of ‘y’ at a value of ‘x’ that is not given.
37
Interpolants
Polynomials are the most common choice of interpolants because they are easy to:
EvaluateDifferentiate, and Integrate.
38
Newton’s Divided Difference Method
Linear interpolation: Given pass a linear interpolant through the data
where
),,( 00 yx ),,( 11 yx
)()( 0101 xxbbxf
)( 00 xfb
01
011
)()(
xx
xfxfb
39
Example The upward velocity of a rocket is given as a
function of time in Table 1. Find the velocity at t=16 seconds using the Newton Divided Difference method for linear interpolation.
Table. Velocity as a function of time
Figure. Velocity vs. time data for the rocket example
0 010 227.0415 362.7820 517.35
22.5 602.9730 901.67
)s( t )m/s( )(tv
40
Linear Interpolation
10 12 14 16 18 20 22 24350
400
450
500
550517.35
362.78
y s
f range( )
f x desired
x s1
10x s0
10 x s range x desired
,150 t 78.362)( 0 tv
,201 t 35.517)( 1 tv
)( 00 tvb 78.362
01
011
)()(
tt
tvtvb
914.30
)()( 010 ttbbtv
41
Linear Interpolation (contd)
10 12 14 16 18 20 22 24350
400
450
500
550517.35
362.78
y s
f range( )
f x desired
x s1
10x s0
10 x s range x desired
)()( 010 ttbbtv
),15(914.3078.362 t 2015 t
At 16t
)1516(914.3078.362)16( v
69.393 m/s
42
Quadratic InterpolationGiven ),,( 00 yx ),,( 11 yx and ),,( 22 yx fit a quadratic interpolant through the data.
))(()()( 1020102 xxxxbxxbbxf
)( 00 xfb
01
011
)()(
xx
xfxfb
02
01
01
12
12
2
)()()()(
xx
xx
xfxf
xx
xfxf
b
43
Example The upward velocity of a rocket is given as a
function of time in Table 1. Find the velocity at t=16 seconds using the Newton Divided Difference method for quadratic interpolation.
Table. Velocity as a function of time
Figure. Velocity vs. time data for the rocket example
0 010 227.0415 362.7820 517.35
22.5 602.9730 901.67
)s( t )m/s( )(tv
44
Quadratic Interpolation (contd)
10 12 14 16 18 20200
250
300
350
400
450
500
550517.35
227.04
y s
f range( )
f x desired
2010 x s range x desired
,100 t 04.227)( 0 tv
,151 t 78.362)( 1 tv
,202 t 35.517)( 2 tv
45
Quadratic Interpolation (contd)
)( 00 tvb
04.227
01
011
)()(
tt
tvtvb
1015
04.22778.362
148.27
02
01
01
12
12
2
)()()()(
tt
tt
tvtv
tt
tvtv
b
1020
1015
04.22778.362
1520
78.36235.517
10
148.27914.30
37660.0
46
Quadratic Interpolation (contd)
))(()()( 102010 ttttbttbbtv
),15)(10(37660.0)10(148.2704.227 ttt 2010 t
At ,16t
)1516)(1016(37660.0)1016(148.2704.227)16( v 19.392 m/s
The absolute relative approximate error a obtained between the results from the first
order and second order polynomial is
a 100x19.392
69.39319.392
= 0.38502 %
47
General Form
))(()()( 1020102 xxxxbxxbbxf
where
Rewriting))(](,,[)](,[][)( 1001200102 xxxxxxxfxxxxfxfxf
)(][ 000 xfxfb
01
01011
)()(],[
xx
xfxfxxfb
02
01
01
12
12
02
01120122
)()()()(
],[],[],,[
xx
xx
xfxf
xx
xfxf
xx
xxfxxfxxxfb
48
General FormGiven )1( n data points, nnnn yxyxyxyx ,,,,......,,,, 111100 as
))...()((....)()( 110010 nnn xxxxxxbxxbbxf
where
][ 00 xfb
],[ 011 xxfb
],,[ 0122 xxxfb
],....,,[ 0211 xxxfb nnn
],....,,[ 01 xxxfb nnn
49
General formThe third order polynomial, given ),,( 00 yx ),,( 11 yx ),,( 22 yx and ),,( 33 yx is
))()(](,,,[
))(](,,[)](,[][)(
2100123
1001200103
xxxxxxxxxxf
xxxxxxxfxxxxfxfxf
0b
0x )( 0xf 1b
],[ 01 xxf 2b
1x )( 1xf ],,[ 012 xxxf 3b
],[ 12 xxf ],,,[ 0123 xxxxf
2x )( 2xf ],,[ 123 xxxf
],[ 23 xxf
3x )( 3xf
50
Example The upward velocity of a rocket is given as a
function of time in Table 1. Find the velocity at t=16 seconds using the Newton Divided Difference method for cubic interpolation.
Table. Velocity as a function of time
Figure. Velocity vs. time data for the rocket example
0 010 227.0415 362.7820 517.35
22.5 602.9730 901.67
)s( t )m/s( )(tv
51
Example
The velocity profile is chosen as))()(())(()()( 2103102010 ttttttbttttbttbbtv
we need to choose four data points that are closest to 16t
,100 t 04.227)( 0 tv
,151 t 78.362)( 1 tv ,202 t 35.517)( 2 tv ,5.223 t 97.602)( 3 tv
The values of the constants are found as: b0 = 227.04; b1 = 27.148; b2 = 0.37660; b3 = 5.4347×10−3
52
Example
b0 = 227.04; b1 = 27.148; b2 = 0.37660; b3 = 5.4347×10−3
0b
100 t 04.227 1b
148.27 2b
,151 t 78.362 37660.0 3b
914.30 3104347.5
,202 t 35.517 44453.0
248.34
,5.223 t 97.602
53
ExampleHence
))()(())(()()( 2103102010 ttttttbttttbttbbtv
)20)(15)(10(10*4347.5
)15)(10(37660.0)10(148.2704.2273
ttt
ttt
At ,16t
)2016)(1516)(1016(10*4347.5
)1516)(1016(37660.0)1016(148.2704.227)16(3
v
06.392 m/s
The absolute relative approximate error a obtained is
a 100x06.392
19.39206.392
= 0.033427 %
54
Comparison Table
Order of Polynomial
1 2 3
v(t=16) m/s
393.69 392.19 392.06
Absolute Relative Approximate Error
---------- 0.38502 %
0.033427 %
55
Distance from Velocity Profile
Find the distance covered by the rocket from t=11s tot=16s ?
)20)(15)(10(10*4347.5
)15)(10(37660.0)10(148.2704.227)(3
ttt
ttttv 5.2210 t
32 0054347.013204.0265.212541.4 ttt 5.2210 t So
16
11
1116 dttvss
dtttt )0054347.013204.0265.212541.4( 3216
11
16
11
432
40054347.0
313204.0
2265.212541.4
tttt
m 1605
56
Acceleration from Velocity Profile
Find the acceleration of the rocket at t=16s given that
32 0054347.013204.0265.212541.4)( ttttv
32 0054347.013204.0265.212541.4)()( tttdt
dtv
dt
dta
2016304.026408.0265.21 tt
2)16(016304.0)16(26408.0265.21)16( a
2/ 664.29 sm