Interpol As I
Interpol As I
Interpolation
http://numericalmethods.eng.usf.edu
Transforming Numerical Methods Education for STEM
Undergraduates
http://numericalmethods.eng.usf.edu 1
What is Interpolation ?
Given (x0,y0), (x1,y1), …… (xn,yn), find the value of ‘y’ at a
value of ‘x’ that is not given.
3 http://numericalmethods.eng.usf.edu
Direct Method
Given ‘n+1’ data points (x0,y0), (x1,y1),………….. (xn,yn),
pass a polynomial of order ‘n’ through the data as given
below:
y = a0 + a1 x + ....................+ an x . n
4 http://numericalmethods.eng.usf.edu
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.
Table 1 Velocity as a function
of time.
Hence
v(t ) = −100.93 + 30.914t , 15 t 20.
v(16) = −100.93 + 30.914(16) = 393.7 m/s
6 http://numericalmethods.eng.usf.edu
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.
Table 2 Velocity as a function
of time.
f 2 (x )
v(20 ) = a0 + a1 (20 ) + a2 (20 ) = 517.35
2
( x0 , y 0 )
x
Figure 6 Quadratic interpolation.
ys
(
f x des ired ) 350
250
227.04 200
10 12 14 16 18 20
10 x s range x des ired 20
(x3 , y3 )
v(t ) = a0 + a1t + a2t + a3t
2 3
(x1 , y1 )
v(10 ) = 227.04 = a0 + a1 (10 ) + a2 (10 ) + a3 (10 )
2 3
f 3 (x )
v(15) = 362 .78 = a0 + a1 (15) + a2 (15) + a3 (15)
2 3 (x2 , y2 )
(x0 , y0 )
11 http://numericalmethods.eng.usf.edu
Cubic Interpolation (contd)
v(t ) = −4.2540 + 21.266t + 0.13204 t 2 + 0.0054347 t 3 , 10 t 22.5
v(16 ) = −4.2540 + 21.266 (16 ) + 0.13204 (16 ) + 0.0054347 (16 )
2 3
(
f x des ired )
a = 100
300
392 .06
227.04 200
10
10
12 14 16 18
x s range x des ired
20 22 24
22.5
= 0.033269 %
12 http://numericalmethods.eng.usf.edu
Comparison Table
Table 4 Comparison of different orders of the polynomial.
Order of
t(s) v (m/s) 1 2 3
Polynomial
0 0
v(t = 16) m/s 393.7 392.19 392.06
10 227.04
15 362.78 Absolute Relative
---------- 0.38410 % 0.033269 %
Approximate Error
20 517.35
22.5 602.97
30 901.67
13 http://numericalmethods.eng.usf.edu
Distance from Velocity Profile
Find the distance covered by the rocket from t=11s to t=16s ?
v(t ) = −4.3810 + 21.289t + 0.13064 t 2 + 0.0054606 t 3 , 10 t 22.5
16
s(16 ) − s(11) = v(t )dt
11
16
(
= − 4.2540 + 21.266t + 0.13204 t 2 + 0.0054347 t 3 dt)
11
16
t2 t3 t4
= − 4.2540 t + 21.266 + 0.13204 + 0.0054347
2 3 4 11
= 1605 m
14 http://numericalmethods.eng.usf.edu
Acceleration from Velocity Profile
Find the acceleration of the rocket at t=16s given that
(t ) = −4.2540 + 21.266t + 0.13204 2 + 0.0054347 t 3 ,10 t 22.5
d
a(t ) = v(t )
dt
=
d
dt
(
− 4.2540 + 21.266t + 0.13204 t 2 + 0.0054347 t 3 )
= 21.289 + 0.26130 t + 0.016382 t 2 , 10 t 22.5
= 29.665 m/s 2
15 http://numericalmethods.eng.usf.edu
Newton’s Divided Difference
Polynomial Method of
Interpolation
http://numericalmethods.eng.usf.edu
Transforming Numerical Methods Education for STEM
Undergraduates
16 http://numericalmethods.eng.usf.edu
Newton’s Divided Difference
Method
Linear interpolation: Given ( x0 , y0 ), ( x1 , y1 ), pass a
linear interpolant through the data
f1 ( x) = b0 + b1 ( x − x0 )
where
b0 = f ( x0 )
f ( x1 ) − f ( x0 )
b1 =
x1 − x0
17 http://numericalmethods.eng.usf.edu
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
v(t ) = b0 + b1 (t − t 0 ) 500
ys
v(t1 ) − v(t 0 )
b1 = = 30.914 362.78 350
t1 − t 0 10
x s −10
12 14 16 18
x s range x des ired
20 22 24
x s + 10
0 1
19 http://numericalmethods.eng.usf.edu
Linear Interpolation (contd)
550
517.35
500
ys
f ( range)
450
(
f x des ired )
400
362.78 350
10 12 14 16 18 20 22 24
x s −10 x s range x des ired x s + 10
v(t ) = b0 + b1 (t − t 0 )
0 1
b0 = f ( x0 )
f ( x1 ) − f ( x0 )
b1 =
x1 − x0
f ( x 2 ) − f ( x1 ) f ( x1 ) − f ( x0 )
−
x 2 − x1 x1 − x0
b2 =
x 2 − x0
21 http://numericalmethods.eng.usf.edu
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
500
450
ys
400
f ( range)
(
f x des ired ) 350
300
250
227.04 200
10 12 14 16 18 20
10 x s range x des ired 20
The absolute relative approximate error a obtained between the results from the first
order and second order polynomial is
= 0.38502 %
25 http://numericalmethods.eng.usf.edu
General Form
f 2 ( x) = b0 + b1 ( x − x0 ) + b2 ( x − x0 )( x − x1 )
where
b0 = f [ x0 ] = f ( x0 )
f ( x1 ) − f ( x 0 )
b1 = f [ x1 , x0 ] =
x1 − x0
f ( x 2 ) − f ( x1 ) f ( x1 ) − f ( x0 )
−
f [ x 2 , x1 ] − f [ x1 , x0 ] x 2 − x1 x1 − x0
b2 = f [ x 2 , x1 , x0 ] = =
x 2 − x0 x 2 − x0
Rewriting
f 2 ( x) = f [ x0 ] + f [ x1 , x0 ]( x − x0 ) + f [ x2 , x1 , x0 ]( x − x0 )( x − x1 )
26 http://numericalmethods.eng.usf.edu
General Form
Given (n + 1) data points, (x0 , y 0 ), (x1 , y1 ),......,(xn −1 , y n −1 ), (xn , y n ) as
f n ( x) = b0 + b1 ( x − x0 ) + .... + bn ( x − x0 )( x − x1 )...(x − xn−1 )
where
b0 = f [ x0 ]
b1 = f [ x1 , x0 ]
b2 = f [ x 2 , x1 , x0 ]
bn −1 = f [ xn −1 , xn −2 ,...., x0 ]
bn = f [ xn , xn−1 ,...., x0 ]
27 http://numericalmethods.eng.usf.edu
General form
The third order polynomial, given ( x0 , y 0 ), ( x1 , y1 ), ( x2 , y2 ), and ( x3 , y3 ), is
f 3 ( x) = f [ x0 ] + f [ x1 , x0 ]( x − x0 ) + f [ x 2 , x1 , x0 ]( x − x0 )( x − x1 )
+ f [ x3 , x 2 , x1 , x0 ]( x − x0 )( x − x1 )( x − x 2 )
b0
x0 f ( x0 ) b1
f [ x1 , x0 ] b2
x1 f ( x1 ) f [ x2 , x1 , x0 ] b3
f [ x2 , x1 ] f [ x3 , x2 , x1 , x0 ]
x2 f ( x2 ) f [ x3 , x2 , x1 ]
f [ x3 , x 2 ]
x3 f ( x3 )
28 http://numericalmethods.eng.usf.edu
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
31 http://numericalmethods.eng.usf.edu
Example
Hence
v (t ) = b0 + b1 (t − t 0 ) + b2 (t − t 0 )( t − t1 ) + b3 (t − t 0 )( t − t1 )(t − t 2 )
= 227.04 + 27.148( t − 10) + 0.37660(t − 10)(t − 15)
+ 5.4347 * 10 −3 (t − 10)( t − 15)( t − 20)
At t = 16,
v (16) = 227.04 + 27.148(16 − 10) + 0.37660(16 − 10)(16 − 15)
+ 5.4347 * 10 −3 (16 − 10)(16 − 15)(16 − 20)
= 392.06 m/s
The absolute relative approximate errora obtained is
392 .06 − 392 .19
a = x100
392 .06
= 0.033427 %
32 http://numericalmethods.eng.usf.edu
Comparison Table
Order of 1 2 3
Polynomial
v(t=16) 393.69 392.19 392.06
m/s
Absolute Relative ---------- 0.38502 % 0.033427 %
Approximate Error
33 http://numericalmethods.eng.usf.edu
Distance from Velocity Profile
Find the distance covered by the rocket from t=11s to
t=16s ?
v (t ) = 227.04 + 27.148(t − 10) + 0.37660( t − 10)( t − 15)
10 t 22.5
+ 5.4347 * 10 (t − 10)( t − 15)( t − 20)
−3
16
= ( − 4.2541 + 21.265t + 0.13204t 2 + 0.0054347t 3 ) dt
11
16
t2 t3 t4
= − 4.2541t + 21.265 + 0.13204 + 0.0054347
2 3 4 11
34 = 1605 m http://numericalmethods.eng.usf.edu
Acceleration from Velocity Profile
Find the acceleration of the rocket at t=16s given that
a(t ) =
d
dt
v(t ) =
d
(
dt
− 4.2541 + 21.265t + 0.13204t 2 + 0.0054347t 3 )
= 21.265 + 0.26408t + 0.016304t 2
a(16) = 21.265 + 0.26408(16) + 0.016304(16) 2
= 29.664 m / s 2
35 http://numericalmethods.eng.usf.edu
Lagrangian Interpolation
http://numericalmethods.eng.usf.edu
Transforming Numerical Methods Education for STEM
Undergraduates
36 http://numericalmethods.eng.usf.edu
Lagrangian Interpolation
Lagrangian interpolating polynomial is given by
n
f n ( x) = Li ( x) f ( xi )
i =0
where ‘ n ’ in f n (x) stands for the n th order polynomial that approximates the function y = f (x)
37 http://numericalmethods.eng.usf.edu
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
t (s) v(t ) (m/s)
0 0
10 227.04
15 362.78
20 517.35
22.5 602.97
30 901.67
1
v(t ) = Li (t )v(ti ) 500
i =0
ys
= L0 (t )v (t 0 ) + L1 (t )v (t1 ) f ( range)
450
(
f x des ired )
39 http://numericalmethods.eng.usf.edu
Linear Interpolation (contd)
1 t −tj t − t1
L0 (t ) = =
j =0 t0 − t j t 0 − t1
j 0
1 t −tj t − t0
L1 (t ) = =
j =0 t1 − t j t1 − t 0
j 1
t − t1 t − t0 t − 20 t − 15
v(t ) = v(t 0 ) + v(t1 ) = (362.78) + (517.35)
t 0 − t1 t1 − t 0 15 − 20 20 − 15
16 − 20 16 − 15
v(16) = (362.78) + (517.35)
15 − 20 20 − 15
= 0.8(362.78) + 0.2(517.35)
= 393.7 m/s.
40 http://numericalmethods.eng.usf.edu
Quadratic Interpolation
For the second order polynomial interpolation (also called quadratic interpolation), we
choose the velocity given by
2
v (t ) = Li ( t ) v(t i )
i =0
= L0 (t )v (t 0 ) + L1 (t ) v( t1 ) + L2 (t ) v( t 2 )
41 http://numericalmethods.eng.usf.edu
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
t (s) v(t ) (m/s)
0 0
10 227.04
15 362.78
20 517.35
22.5 602.97
30 901.67
ys
400
f ( range)
2 t −tj t − t1 t − t 2
L0 (t ) = = (
f x des ired ) 350
j =0 t0 − t j t − t
0 1 0 2 t − t
j 0
300
2 t −t j t − t0 t − t 2
L1 (t ) = =
j =0 t1 − t j t1 − t 0 t1 − t 2 250
j 1
227.04
2 t −tj t − t 0 t − t1 200
L2 (t ) = = 10 12 14 16 18 20
j =0 t2 − t j t − t
2 0 2 1 t − t 10 x s range x des ired 20
j 2
43 http://numericalmethods.eng.usf.edu
Quadratic Interpolation (contd)
t − t1 t − t2 t − t0 t − t2 t − t0 t − t1
v(t ) = v(t0 ) + v(t1 ) + v(t2 )
t0 − t1 t0 − t2 t1 − t0 t1 − t2 t2 − t0 t2 − t1
16 − 15 16 − 20 16 − 10 16 − 20 16 − 10 16 − 15
v(16 ) = (227 .04 ) + (362 .78 ) + (517 .35)
10 − 15 10 − 20 15 − 10 15 − 20 20 − 10 20 − 15
= (− 0.08)(227 .04 ) + (0.96 )(362 .78) + (0.12 )(527.35)
= 392 .19 m/s
The absolute relative approximate error a obtained between the
results from the first and second order polynomial is
600
ys 500
f ( range)
(
f x des ired )
400
300
227.04 200
10 12 14 16 18 20 22 24
10 x s range x des ired 22.5
45 http://numericalmethods.eng.usf.edu
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
t (s) v(t ) (m/s)
0 0
10 227.04
15 362.78
20 517.35
22.5 602.97
30 901.67
700
3 t −tj t − t 1 t − t 2 t − t 3 602.97
L0 (t ) = = ;
j =0 t0 − t j t − t t − t
0 1 0 2 0 3 t − t 600
j 0
3 t −t j t − t0 t − t 2 t − t 3
L1 (t ) =
ys
= 500
t1 − t j t1 − t 0 1 2 t1 − t 3
t − t
f ( range)
j =0
j 1 (
f x des ired )
400
3 t −tj t − t 0 t − t1 t − t 3
L2 (t ) = = ;
t2 − t j t 2 − t 0 t 2 − t 1 t 2 − t 3
300
j =0
j 2
t −tj t − t 0 t − t1 t − t 2
227.04 200
3
L3 ( t ) =
10 12 14 16 18 20 22 24
= 10 x s range x des ired 22.5
j =0 t3 − t j t3 − t 0 t 3 − t1 t3 − t 2
j 3
47 http://numericalmethods.eng.usf.edu
Cubic Interpolation (contd)
t − t1 t − t 2 t − t3 t − t0 t − t 2 t − t3
v(t ) = v(t1 ) + v(t 2 )
t − t t −
0 1 0 2 0 3 t t − t t − t t
1 0 1 2 1 3 − t t − t
t − t0 t − t1 t − t3 t − t1 t − t1 t − t 2
+ v(t 2 ) + v(t3 )
t − t t −
2 0 2 1 2 3 t t − t t − t t
3 1 3 1 3 2 − t t − t
16 − 15 16 − 20 16 − 22.5 16 − 10 16 − 20 16 − 22.5
v(16 ) = (227 .04 ) + (362 .78 )
10 − 15 10 − 20 10 − 22.5 15 − 10 15 − 20 15 − 22.5
16 − 10 16 − 15 16 − 22.5 16 − 10 16 − 15 16 − 20
+ (517 .35) + (602 .97 )
20 − 10 20 − 15 20 − 22 .5 22 .5 − 10 22 .5 − 15 22 .5 − 20
= (− 0.0416 )(227 .04 ) + (0.832 )(362 .78 ) + (0.312 )(517 .35 ) + (− 0.1024 )(602 .97 )
= 392 .06 m/s
The absolute relative approximate error a obtained between the
results from the first and second order polynomial is
392 .06 − 392 .19
a = 100
392 .06
= 0.033269 %
48 http://numericalmethods.eng.usf.edu
Comparison Table
Order of
1 2 3
Polynomial
v(t=16) m/s 393.69 392.19 392.06
Absolute Relative
-------- 0.38410% 0.033269%
Approximate Error
49 http://numericalmethods.eng.usf.edu
Distance from Velocity Profile
Find the distance covered by the rocket from t=11s to
t=16s ?
v(t ) = (t 3 − 57.5t 2 + 1087 .5t − 6750 )( −0.36326 ) + (t 3 − 52.5t 2 + 875t − 4500 )(1.9348 )
+ (t 3 − 47.5t 2 + 712 .5t − 3375 )( −4.1388 ) + (t 3 − 45t 2 + 650t − 3000 )( 2.5727 )
v (t ) = −4.245 + 21.265t + 0.13195t 2 + 0.00544t 3 , 10 t 22.5
16
s(16) − s (11) = v( t ) dt
11
16
( −4.245 + 21.265t + 0.13195t 2 + 0.00544t 3 ) dt
11
t2 t3 t 4 16
= [ −4.245t + 21.265 + 0.13195 + 0.00544 ]11
2 3 4
= 1605 m
50 http://numericalmethods.eng.usf.edu
Acceleration from Velocity Profile
Find the acceleration of the rocket at t=16s given that
dt dt
= 29.665 m / s 2
51 http://numericalmethods.eng.usf.edu
Spline Interpolation Method
http://numericalmethods.eng.usf.edu
Transforming Numerical Methods Education for STEM
Undergraduates
52 http://numericalmethods.eng.usf.edu
Rocket Example Results
t v Polynomial Velocity at Absolute Least
(s) (m/s) Order t=16 in Relative Number of
0 0 m/s Approxima Significant
10 227.04 te Error Digits
15 362.78 Correct
20 517.35 1 393.69 -------------
22.5 602.97 2 392.19 0.38% 2
30 901.67 3 392.05 0.036% 3
4 392.07 0.0051% 3
5 392.06 0.0026% 4
53 http://numericalmethods.eng.usf.edu
Why Splines ?
1
f ( x) =
1 + 25 x 2
Table : Six equidistantly spaced points in [-1, 1]
1
x y=
1 + 25 x 2
-1.0 0.038461
-0.6 0.1
-0.2 0.5
0.2 0.5
0.6 0.1
54 http://numericalmethods.eng.usf.edu
Why Splines ?
1.2
0.8
0.4
y
0
-1 -0.5 0 0.5 1
-0.4
-0.8
x
19th Order Polynomial f (x) 5th Order Polynomial
56 http://numericalmethods.eng.usf.edu
Linear Interpolation (contd)
f ( x1 ) − f ( x 0 )
f ( x ) = f ( x0 ) + ( x − x 0 ), x 0 x x1
x1 − x 0
f ( x 2 ) − f ( x1 )
= f ( x1 ) + ( x − x1 ), x1 x x 2
x2 − x1
.
.
.
f ( x n ) − f ( x n −1 )
= f ( x n −1 ) + ( x − x n−1 ), x n−1 x x n
x n − x n −1
f ( range)
450
517.35 − 362.78 f(x )
= 362.78 + (t − 15) des ired
20 − 15
400
v (t ) = 362.78 + 30.913( t − 15)
At t = 16, 362.78 350
10 12 14 16 18 20 22 24
v (16) = 362.78 + 30.913(16 − 15) x s −10
0
x s range x des ired x s + 10
1
= 393.7 m/s
59 http://numericalmethods.eng.usf.edu
Quadratic Interpolation
Given ( x0 , y0 ), ( x1 , y1 ),......, (x n−1 , y n −1 ), ( x n , y n ) , fit quadratic splines through the data. The splines
are given by
f ( x ) = a1 x 2 + b1 x + c1 , x 0 x x1
= a 2 x 2 + b2 x + c2 , x1 x x 2
.
.
.
= a n x 2 + bn x + cn , x n−1 x x n
Find a i , bi , ci , i = 1, 2, …, n
60 http://numericalmethods.eng.usf.edu
Quadratic Interpolation (contd)
Each quadratic spline goes through two consecutive data points
2
a1 x 0 + b1 x 0 + c1 = f ( x0 )
a1 x12 + b1 x1 + c1 = f ( x1 ) .
.
.
2
a i xi −1 + bi xi −1 + ci = f ( xi −1 )
2
a i xi + bi xi + c i = f ( xi ) .
.
.
2
a n x n−1 + bn x n−1 + c n = f ( xn −1 )
2
a n x n + bn xn + cn = f ( x n )
This condition gives 2n equations
61 http://numericalmethods.eng.usf.edu
Quadratic Splines (contd)
The first derivatives of two quadratic splines are continuous at the interior points.
For example, the derivative of the first spline
a1 x 2 + b1 x + c1 is 2 a1 x + b1
The derivative of the second spline
a 2 x 2 + b2 x + c 2 is 2 a2 x + b2
and the two are equal at x = x1 giving
2 a1 x1 + b1 = 2a 2 x1 + b2
2 a1 x1 + b1 − 2a 2 x1 − b2 = 0
62 http://numericalmethods.eng.usf.edu
Quadratic Splines (contd)
Similarly at the other interior points,
2a 2 x 2 + b2 − 2a3 x 2 − b3 = 0
.
.
.
2ai xi + bi − 2ai +1 xi − bi +1 = 0
.
.
.
2a n −1 x n −1 + bn −1 − 2a n x n−1 − bn = 0
We have (n-1) such equations. The total number of equations is (2n) + (n − 1) = (3n − 1) .
We can assume that the first spline is linear, that is a1 = 0
63 http://numericalmethods.eng.usf.edu
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,
f ( x) = a1 x 2 + b1 x + c1 , x0 x x1
= a 2 x 2 + b2 x + c 2 , x1 x x 2
.
.
.
= a n x 2 + bn x + c n , x n −1 x x n
64 http://numericalmethods.eng.usf.edu
Quadratic Spline Example
The upward velocity of a rocket is given as a function of time.
Using quadratic splines
a) Find the velocity at t=16 seconds
b) Find the acceleration at t=16 seconds
Table Velocity as a
function of time
65 http://numericalmethods.eng.usf.edu
Solution
v(t ) = a1t + b1t + c1 , 0 t 10
2
= a2 t + b2 t + c2 , 10 t 15
2
= a3t + b3t + c3 , 15 t 20
2
= a4 t + b4 t + c4 , 20 t 22.5
2
= a5t + b5t + c5 ,
2
22.5 t 30
Let us set up the equations
66 http://numericalmethods.eng.usf.edu
Each Spline Goes Through
Two Consecutive Data Points
v(t ) = a1t + b1t + c1 , 0 t 10
2
a1 (0) + b1 (0) + c1 = 0
2
67 http://numericalmethods.eng.usf.edu
Each Spline Goes Through
Two Consecutive Data Points
a 2 (10) 2 + b2 (10) + c2 = 227.04
t v(t)
a 2 (15) 2 + b2 (15) + c2 = 362.78
s m/s
0 0 a3 (15) + b3 (15) + c3 = 362.78
2
15 362.78
a4 (20) 2 + b4 (20) + c4 = 517.35
20 517.35
a4 (22.5) 2 + b4 (22.5) + c4 = 602.97
22.5 602.97
30 901.67 a5 (22.5) + b5 (22.5) + c5 = 602.97
2
= a2 t + b2 t + c2 ,10 t 15
2
d
dt
(a1t + b1t + c1
2
) =
d
(
dt
a2t + b2t + c2
2
)
t =10 t =10
a1 = 0
71 http://numericalmethods.eng.usf.edu
Final Set of Equations
0 0 1 0 0 0 0 0 0 0 0 0 0 0 0 a1 0
100 10 1 0 0 0 0 0 0 0 0 0 0 0 0 b1 227.04
0 0 0 100 10 1 0 0 0 0 0 0 0 0
227.04
0 c1
0 0 0 225 15 1 0 0 0 0 0 0 0 0 0 a2 362.78
0 0 0 0 0 0 225 15 1 0 0 0 0 0 0 b2 362.78
0 0 0 0 0 0 400 20 1 0 0 0 0 0
517.35
0 c2
0 0 0 0 0 0 0 0 0 400 20 1 0 0 0 a3 517.35
0 0 0 0 0 0 0 0 0 506.25 22.5 1 0 0 0 b3 = 602.97
0 0 0 0 0 0 0 0 0 0 0 0 506.25 22.5 1 c3 602.97
0 0 0 0 0 0 0 0 0 0 0 0 900 30 1 a4 901.67
20 1 0 − 20 − 1 0 0 0 0 0 0 0 0 0 0 b4 0
0 0 0 30 1 0 − 30 − 1 0 0 0 0 0 0 0 c4 0
1 0 − 40 −1 0 a5
0 0 0 0 0 0 40 0 0 0
0
0 0 0 0 0 0 0 0 0 45 1 0 − 45 −1 0 b5 0
1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 c5 0
72 http://numericalmethods.eng.usf.edu
Coefficients of Spline
i ai bi ci
1 0 22.704 0
2 0.8888 4.928 88.88
3 −0.1356 35.66 −141.61
4 1.6048 −33.956 554.55
5 0.20889 28.86 −152.13
73 http://numericalmethods.eng.usf.edu
Quadratic Spline Interpolation
Part 2 of 2
http://numericalmethods.eng.usf.edu
74 http://numericalmethods.eng.usf.edu
Final Solution
v(t ) = 22.704t , 0 t 10
= 0.8888t 2 + 4.928t + 88.88, 10 t 15
= −0.1356t 2 + 35.66t − 141.61, 15 t 20
= 1.6048t 2 − 33.956t + 554.55, 20 t 22.5
= 0.20889 t 2 + 28.86t − 152.13, 22.5 t 30
75 http://numericalmethods.eng.usf.edu
Velocity at a Particular Point
a) Velocity at t=16
v(t ) = 22.704t , 0 t 10
= 0.8888t 2 + 4.928t + 88.88, 10 t 15
= −0.1356t 2 + 35.66t − 141.61, 15 t 20
= 1.6048t 2 − 33.956t + 554.55, 20 t 22.5
= 0.20889 t 2 + 28.86t − 152.13, 22.5 t 30
76 http://numericalmethods.eng.usf.edu
Acceleration from Velocity Profile
b) The quadratic spline valid at t=16 is
given by
d
a(16) = v(t ) t =16
dt
v(t ) = −0.1356 t 2 + 35.66t − 141 .61, 15 t 20
d
a(t ) = ( −0.1356t + 35.66t − 141.61)
2
dt
= −0.2712t + 35.66, 15 t 20
a(16) = −0.2712 (16) + 35.66 = 31.321 m/s
2
77 http://numericalmethods.eng.usf.edu
Distance from Velocity Profile
c) Find the distance covered by the rocket from t=11s to
t=16s.
16
S (16 ) − S (11) = v (t )dt
11
= 1595 .9 m
78 http://numericalmethods.eng.usf.edu
THE END