Direct Method For Interpolation
Direct Method For Interpolation
OF INTERPOLATION
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
2 discrete.
Interpolants
Polynomials are the most
common choice of interpolants
because they are easy to:
Evaluate
Differentiate, and
Integrate
Direct Method
Given ‘n+1’ data points (x0,y0), (x1,y1),…………..
(xn,yn),
pass a polynomial of order ‘n’ through the data as
given
n
y a a x .................... a x .
below:
0 1 n
t , s vt , m/s
0 0
10 227.04
15 362.78
20 517.35
22.5 602.97
30 901.67 Figure 2 Velocity vs. time data for
the rocket example
Linear Interpolation
vt a0 a1t y
Hence
vt 100.93 30.914t , 15 t 20.
v16 100.93 30.91416 393.7 m/s
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.
t , s vt , m/s
0 0
10 227.04
15 362.78
20 517.35
22.5 602.97
30 901.67 Figure 5 Velocity vs. time data for
the rocket example
7
Quadratic Interpolation
y
f 2 x
v20 a0 a1 20 a2 20 517.35
2
x0 , y0
x
500
ys
f x desired 350
250
227.04 200
10 12 14 16 18 20
10 x s range x desired 20
t , s vt , m/s
0 0
10 227.04
15 362.78
20 517.35
22.5 602.97
30 901.67 Figure 6 Velocity vs. time data for
the rocket example
10
Cubic Interpolation
y
x3 , y3
vt a0 a1t a2t a3t
2 3
x1 , y1
v10 227.04 a0 a1 10 a2 10 a3 10
2 3
f 3 x
x2 , y2
v15 362.78 a0 a1 15 a2 15 a3 15
2 3
x0 , y0
x
v20 517.35 a0 a1 20 a2 20 a3 20
2 3
Figure 7 Cubic
interpolation.
v22.5 602.97 a0 a1 22.5 a2 22.5 a3 22.5
2 3
11
Cubic Interpolation (contd)
vt 4.2540 21.266t 0.13204t 2 0.0054347t 3 , 10 t 22.5
v16 4.2540 21.26616 0.1320416 0.005434716
2 3
392.06 m/s
700
602.97
f x desired
400
392.06 392.19
a 100
300
392.06
227.04 200
10
10
12 14 16 18
x s range x desired
20 22 24
22.5
0.033269%
12
Comparison Table
Table 4 Comparison of different orders of the
polynomial.
Order of
t(s) v (m/s) 1 2 3
Polynomial
0 0
vt 16 m/s 393.7 392.19 392.06
10 227.04
15 362.78 Absolute Relative
---------- 0.38410 % 0.033269 %
20 517.35
Approximate Error
22.5 602.97
30 901.67
13
Distance from Velocity Profile
Find the distance covered by the rocket from t=11s to t=16s ?
vt 4.3810 21.289t 0.13064t 2 0.0054606t 3 , 10 t 22.5
16
s16 s11 vt dt
11
16
4.2540 21.266t 0.13204t 2 0.0054347t 3 dt
11
16
t2 t3 t4
4.2540t 21.266 0.13204 0.0054347
2 3 4 11
1605 m
14
Acceleration from Velocity Profile
Find the acceleration of the rocket at t=16s given that
t 4.2540 21.266t 0.13204 2 0.0054347t 3 ,10 t 22.5
d
a t vt
dt
d
4.2540 21.266t 0.13204t 2 0.0054347t 3
dt
21.289 0.26130t 0.016382t 2 , 10 t 22.5
29.665 m/s 2
15