6 04 Interpolasi Spline Sjk
Transcript of 6 04 Interpolasi Spline Sjk
-
7/21/2019 6 04 Interpolasi Spline Sjk
1/25
Spline Method of
n erpo a on
-
7/21/2019 6 04 Interpolasi Spline Sjk
2/25
Why Splines ?2251)( xxf +=
Table : Six e uidistantl s aced oints in [-1 1]
x 2
251
1
x
y+
=
- . .
-0.6 0.1
-
. .
0.2 0.5
0.6 0.1
Figure : 5th order polynomial vs. exact function1.0 0.038461
-
7/21/2019 6 04 Interpolasi Spline Sjk
3/25
Why Splines ?
0.8
1.2
0.4
y
-0.4
-1 -0.5 0 0.5 1
-0.8
x
19th Order Polynomial f (x) 5th Order Polynomial
Figure : Higher order polynomial interpolation is a bad idea
-
7/21/2019 6 04 Interpolasi Spline Sjk
4/25
Linear Interpolation
Given ( ) ( ) ( )( )nnnn yxyxyxyx ,,,......,,,, 111100 , fit linear splines to the data. This simply involvesforming the consecutive data through straight lines. So if the above data is given in an ascending
order, the linear splines are given by )( ii xfy =
Figure : Linear splines
-
7/21/2019 6 04 Interpolasi Spline Sjk
5/25
Linear Interpolation (contd)
),(
)()(
)()( 001
01
0 xxxx
xfxf
xfxf
+= 10 xxx
)()( 12 xfxf
,1
12
1xx 21
.
.
.
),()()(
)( 11
1
1
+= n
nn
nn
n xxxx
xfxfxf
nn xxx 1
Note the terms of
1)()( ii xfxf 1 ii
in the above function are simply slopes between 1ix and ix .
-
7/21/2019 6 04 Interpolasi Spline Sjk
6/25
Example
he upward velocity of a rocket is given as afunction of time in Table 1. Find the velocity at.
Table Velocity as a
function of time
(s) (m/s)
0 0
10 227.04
t )(tv
15 362.7820 517.35
22.5 602.97
Figure. Velocity vs. time datafor the rocket example
30 901.67
-
7/21/2019 6 04 Interpolasi Spline Sjk
7/25
Linear Interpolation
550517.35,150 =t 78.362)( 0 =tv
,201=t 35.517)( 1 =tv
450
500
y s
f range( )
)()()(
)()( 001
01
0 tttt
tvtvtvtv
+=
400
f x desired )15(
1520
..78.362
+= t
)15(913.3078.362)( += ttv
10 12 14 16 18 20 22 24350362.78
x s1
10+x s0
10 x s range, x desired,
At ,16=t
)1516(913.3078.362)16( +=v
.= m/s
-
7/21/2019 6 04 Interpolasi Spline Sjk
8/25
Quadratic Interpolation
Given ( ) ( ) ( ) ( )nnnn yxyxyxyx ,,,,......,,,, 111100 , fit quadratic splines through the data. The splines
are given by
,)( 112
1 cxbxaxf ++= 10 xxx
,222
2 cxbxa ++= 21 xxx .
.
.
,2nnn
cxbxa ++= nn xxx 1
,i
,i
,i = , , ,
-
7/21/2019 6 04 Interpolasi Spline Sjk
9/25
Quadratic Interpolation (contd)
Each quadratic spline goes through two consecutive data points
)( 01012
01 xfcxbxa =++
2
111111 .
.
.
)( 112
1 =++ iiiiii xfcxbxa
)(2
iiiiii xfcxbxa =++ .
.
.
)( 112
1 =++ nnnnnn xfcxbxa
)(2
nnnnnn xfcxbxa =++
This condition gives 2n equations
-
7/21/2019 6 04 Interpolasi Spline Sjk
10/25
Quadratic Splines (contd)
The first derivatives of two quadratic splines are continuous at the interior points.
For example, the derivative of the first spline
11
2
1 cxbxa ++ is 112 bxa +
The derivative of the second spline
22
2
2 cxbxa ++ is 222 bxa +
and the two are equal at 1xx= giving
212111 22 bxabxa +=+
022 212111 =+ bxabxa
-
7/21/2019 6 04 Interpolasi Spline Sjk
11/25
Quadratic Splines (contd)Similarly at the other interior points,
022 323222 =+ bxabxa
.
.
.
022 11 =+ ++ iiiiii bxabxa
.
.
.
022 1111 =+ nnnnnn bxabxa
- . = .
We can assume that the first spline is linear, that is 01=a
-
7/21/2019 6 04 Interpolasi Spline Sjk
12/25
Quadratic Splines (contd)
This gives us 3n equations and 3n unknowns. Once we find the 3n constants,we can find the function at any value of x using the splines,
,)( 112
1 cxbxaxf ++= 10 xxx
,222
2 cxbxa ++= 21 xxx
.
.
.
,2 nnn cxbxa ++= nn xxx 1
-
7/21/2019 6 04 Interpolasi Spline Sjk
13/25
Quadratic Spline Example
The upward velocity of a rocket is given as a function of time.Using quadratic splinesa
b) Find the acceleration at t=16 secondsc) Find the distance covered between t=11 and t=16 seconds
Table Velocity as a
function of time
(s) (m/s)
0 0
10 227.04
t )(tv
.20 517.35
22.5 602.97
gure. e oc y vs. me a afor the rocket example
.
-
7/21/2019 6 04 Interpolasi Spline Sjk
14/25
Solution2= ,111
,2 ctbta ++= 1510 t
,332
3 ctbta ++= 2015 t,44
2
4 ctbta ++= 5.2220 t
,555 ctbta ++= 305.22 t
-
7/21/2019 6 04 Interpolasi Spline Sjk
15/25
Each Spline Goes Throughwo Consecutive Data Points
,111 cav = t2 =111
04.227)10()10( 112
1 =++ cba
-
7/21/2019 6 04 Interpolasi Spline Sjk
16/25
Each Spline Goes Throughwo Consecutive Data Points
2
t v(t)
s m/s
.222 =
78.362)15()15( 222
2 =++ cba
0 0
10 227.04
78.362)15()15( 332
3 =++ cba
35.5172020 2 =++ cba15 362.78
20 517.3535.517)20()20( 44
2
4 =++ cba2
22.5 602.97
30 901.67
... 44497.602)5.22()5.22( 55
2
5 =++ cba
67.901)30()30( 555 =++ cba
-
7/21/2019 6 04 Interpolasi Spline Sjk
17/25
Interior Data Points
,111
cav = t
,222
2 ctbta ++= 1510 t
( ) ( )222
211
2
1 ++=++ ctbtad
ctbta
d
1010 == tt
( ) ( )2211 22 +=+ btabta
( ) ( ) 2211 102102 baba +=+
020202211
=+ baba
-
7/21/2019 6 04 Interpolasi Spline Sjk
18/25
Derivatives are continuous at
n er or a a o n s
0)10(2)10(2 =+ babaAt t=10
0152152 =+ babaAt t=15
=At t=20
At t=22.5
.. 5544
-
7/21/2019 6 04 Interpolasi Spline Sjk
19/25
Last Equation
1
-
7/21/2019 6 04 Interpolasi Spline Sjk
20/25
Final Set of Equations 0000000000000100 1a
78.362
04.227
04.227
000000000115225000
000000000110100000
000000000000110100
2
1
1
a
c
b
= 97.602
35.517
35.517
.
00015.2225.506000000000
000120400000000000
000000120400000000
3
2
2
b
a
c
0
67.901
97.602
00000000001200120
130900000000000000
15.2225.506000000000000
4
4
3
b
a
c
0
00
01450145000000000
0000140014000000000000001300130000
5
5
4
b
ac
5c
-
7/21/2019 6 04 Interpolasi Spline Sjk
21/25
Coefficients of Spline
i i i
1 0 22.704 0
. . .
3
0.1356 35.66
141.614 1.6048 33.956 554.55
-
7/21/2019 6 04 Interpolasi Spline Sjk
22/25
Final Solution,704.22)( ttv = 100 t
,88.88928.48888.02
++= tt 1510 t61.14166.351356.0 2 += tt 2015 t
,55.554956.336048.1 2 += tt 5.2220 t
13.15286.2820889.0 2 += tt 305.22 t
-
7/21/2019 6 04 Interpolasi Spline Sjk
23/25
Velocit at a Particular Pointa) Velocity at t=16
,704.22)( ttv = 100 t2= ,...
,61.14166.351356.0 2 += tt 2015 t2 = ,... .
,13.15286.2820889.0 2 += tt 305.22 t
( ) ( ) ( ) 61.1411666.35161356.016 2 +=v.
-
7/21/2019 6 04 Interpolasi Spline Sjk
24/25
b) The quadratic spline valid at t=16 is
16 = tvd
a
g ven y
16=tdt
61.14166.351356.0 2 += tttv 2015 t
)61.14166.351356.0()( 2 += ttd
ta
,66.352712.0 += t 2015 t2
..=a .=
-
7/21/2019 6 04 Interpolasi Spline Sjk
25/25
Distance from Velocity Profile
t=16s.( ) ( )=
16
)(1116 dttvSS11
( ) 1510,88.88928.48888.02
2 ++= ttttv
,... =
( ) ( ) ( ) ( ) ( )111616 15 16
+== dttvdttvdttvSS
( ) ( )61.14166.351356.088.88928.48888.016
2
15
2
11 11 15
++++= dtttdttt
m9.1595
1511
=