Docsity

Velocity Interpolation: Linear, Quadratic, Cubic, Spline, and Cubic Spline Methods, Schemes and Mind Maps of Differential Equations

Partial preview of the text

Download Velocity Interpolation: Linear, Quadratic, Cubic, Spline, and Cubic Spline Methods and more Schemes and Mind Maps Differential Equations in PDF only on Docsity!

Interpolation

1

What is Interpolation?

Given (x

0

,y

0

), (x

1

,y

1

), …… (xn,y

n

), find the value of ‘y’ at a

value of ‘x’ that is not given.

2

Figure 1 Interpolation of discrete data.

Interpolants

Polynomials are the most common choicePolynomials are the most common choice

of interpolants because they are easy to:

 Evaluate,

 Differentiate and

3

 Differentiate, and

 Integrate

Direct Method of Interpolation

44

Linear Interpolation

vta at 0 1 v   taat 0 1

 15   15  362. 78 0 1

v  a  a 

 20   20  517. 35 0 1

v  a  a 

Solving the above two equations gives,

a  10093 a  30914

x 0 (^) , y 0  f 1   x

x 1 , y 1 

x

y

Figure 3 Linear interpolation

7

0 a  30. 914 1

a

Hence

vt    100. 93  30. 914 t , 15  t  20.

v  16   100. 93  30. 914  16   393. 7 m/s

Figure 3 Linear interpolation.

Quadratic Interpolation

y

 

2

v t  a 0  a 1 t  a 2 t

 10   10   10  227. 04

2 0 1 2

v  a  a  a 

 15   15   15  362. 78

2 0 1 2

v  a  a  a 

 20   20   20  517. 35

2 0 1 2

v  a  a  a 

x 0 , y 0 

x 1 , y 1   x 2 , y 2 

f 2  x

x

8

Solving the above three equations gives

  1. 05

a  17. 733

a  0. 3766

a

Figure 6 Quadratic interpolation.

Quadratic Interpolation (cont.)

517.35^550

(^20010 12 14 16 18 )

250

300

350

400

450

500

y s f range( ) f x desired

10 20

  12. 05 17. 733 0. 3766 , 10 20

2

vt   t  t  t 

     

2

v 16  12. 05  17. 73316  0. 376616

 392. 19 m/s

9

10 x s range x desired 20

The absolute relative approximate error obtained between

the results from the first and second order polynomial is

a

a

Cubic Interpolation

y

   

3 3

2

v t  a 0  a 1 t  a 2 t  at

3 3

2 v 10  227. 04  a 0  a 110  a 210  a 10

3 3

2 0 1 2 v 15  362. 78  aa 15  a 15  a 15

3 3

2 v 20  517. 35  a 0  a 120  a 220  a 20

x

f 3   x

x 3 , y 3 

x 2 , y 2 

x 1 , y 1 

x 0 , y 0 

Figure 7 Cubic interpolation

10

3 3

2 v 22. 5  602. 97  a 0  a 122. 5  a 222. 5  a 22. 5

0

a  21. 266

1

a  a 2^ ^0.^13204 a 3 ^0.^0054347

Figure 7 Cubic interpolation.

Distance from Velocity Profile

Find the distance covered by the rocket from t=11s to t=16s?

  4. 3810 21. 289 0. 13064 0. 0054606 , 10 22. 5

2 3

vt    t  t  t  t 

     

 4. 2540 21. 266 0. 13204 0. 0054347 

16

11

2 3

16

11

t t t dt

s s vtdt

13

1605 m

16

11

2 3 4

t t t

t

Acceleration from Velocity Profile

Find the acceleration of the rocket at t=16s given that

  4. 2540 21. 266 0. 13204 0. 0054347 , 10 22. 5

2 3

 t    t   t  t 

   

 

2

2 3

t t t

dt

d

vt

dt

d

at

14

2

  t  t  t 

     

2

2

29. 665 m/s

a   

Lagrange Method of Interpolation

15

Lagrangian interpolating polynomial is given by

n

Lagrangian Interpolation

 

n

i

f (^) n x Lix fxi 0

where ‘ n ’ in f (^) n ( x )stands for the

th n order polynomial that approximates the function yf ( x )

given at ( n  1 )data points as  x 0 , y 0  , x 1 , y 1 ,......,  xn  1 , yn  1  , xn , yn , and

  

n

j i j

j i x x

x x L x 0

ji

j i j

Li ( x )is a weighting function that includes a product of ( n  1 )terms with terms of ji

omitted.

16

Linear Interpolation (cont.)

1

(^0 )

0 (^ )

j (^) j

j

t t

t t

L t

0 1

1

t t

t t

 0

(^0 ) j

j t^ tj t 0 t 1

1

1

(^0 )

j

j (^) j

j

t t

t t

L t

1 0

0

t t

t t

1 1 0

0 0 0 1

1

vt

t t

t t

vt

t t

t t

v t

t t

19

v 

 393. (^7) m/s.

Quadratic Interpolation

For the second order polynomial interpolatioFor the second order polynomial interpolation (also called quadratic interpolation), wen (also called quadratic interpolation) we

choose the velocity given by

 

2

0

i

vt Li tvti

0 0 1 1 2 2

 L tvt  L tvt  L tvt

20

Quadratic Interpolation (cont.)

550 517 35

t 10 ( t ) 22704

350

400

450

500

y (^) s

f range( )

f x (^) desired

0

t  ( ) 227. 04

0

vt 

1

t  ( ) 362. 78

1

vt 

t 2  20 , v ( t 2 ) 517. 35

 

 

2

0

(^0 )

0 ()

j

j (^) j

j

t t

t t L t   

   

   

   

  0 2

2

0 1

1

t t

t t

t t

t t

21

10 12 14 16 18 20

200

250

300

10 x (^) s  rangex (^) desired 20

 

 

2

1

(^0 )

1 ()

j

j (^) j

j

t t

t t L t

 

 

 

 

 

 

 

  1 2

2

1 0

0

t t

t t

t t

t t

 

 

2

2

(^0 )

2 ()

j

j (^) j

j

t t

t t L t

 

 

 

 

 

  2 1

1

2 0

0

t t

t t

t t

t t

Quadratic Interpolation (cont.)

       

1 2 0 2 0 1

 vt

t t t t

vt

t t t t

vt

t t t t

vt       

       

        

392. 19 m/s

2 2 0 2 1

1 1 0 1 2

0 0 1 0 2

v

vt

t t t t

vt

t t t t

vt

t t t t

vt

The absolute relative approximate error  a obtained between the

22

pp

results from the first and second order polynomial is

a

a

Cubic Interpolation (cont.)

1 1 2 2

0 1 3

1 1 3

3

1 2

2

1 0

0 0 0 3

3

0 2

2

0 1

1

v t

t t t t t t vt

t t t t t t

vt t t

t t

t t

t t

t t

t t vt t t

t t

t t

t t

t t

t t vt

  1. 06 m/s

3 3 1 3 1 3 2

2 2 0 2 1 2 3

v

t t t t t t t t t t t t

25

The absolute relative approximate error obtained between the

results from the third and second order polynomial is

 a

a

Newton’s Divided Difference

Method of Interpolation

26

General Form

Given ( n  1 )data points,         n n n n

x , y , x , y ,......, x , y , x , y

0 0 1 1  1  1

find P n(x) as

0 1 0 0 1  1

n n n

P x b b x x b x x x x x x

where

[ ] ( )

0 0 0

b  f x  f x

1 0

1 0 1 1 0

[ , ]

x x

f x f x

b f x x

27

2 0

1 0

1 0

2 1

2 1

2 0

2 1 1 0 2 2 1 0

[ , ] [ , ]

[ , , ]

x x

x x

f x f x

x x

f x f x

x x

f x x f x x

b f x x x

General Form (cont.)

Given ( n  1 )data points,         n n n n

x , y , x , y ,......, x , y , x , y

0 0 1 1  1  1

find P n(x) as

0 1 0 0 1  1

n n n

P x b b x x b x x x x x x

where

[ ]

0 0

b  f x zero D.D.

[ , ]

1 1 0

b  f x x 1

st

D.D.

[ , , ]

2 2 1 0

b  f x x x 2

nd

D.D.

28

[ , ,...., ]

1 1 2 0

b f x x x

nnn

[ , ,...., ]

1 0

b f x x x

n n n

 n

th

D.D.

Example 3 (cont.)

The velocity profile is chosen asThe velocity profile is chosen as

0 1 0 2 0 1 3 0 1 2

v t  b  b t  t  b t  t t  t  b t  t t  t t  t

we need to choose four data points that are closest to t ^16

t (^) 0  10 , v ( t 0 ) 227. 04

1 t  ( ) 362. 78 1 vt

t (^) 2  20 , v ( t 2 ) 517. 35

31

t (^) 3  22. 5 , v ( t 3 ) 602. 97

Example 3 (cont.)

bb 00

t 0 (^)  10 227. 04 b 1

  1. 148 b 2

t 1 (^)  15 , 362. 78 0. 37660 b 3

3

  1. 4347 10

 

t 2 (^)  20 , 517. 35 0. 44453

32

b 0 = 227.04; b 1 = 27.148; b 2 = 0.37660; b 3 = 5.4347×

−

3 t  602. 97

Example 3 (cont.)

Hence

v ( t ) b 0  b 1 ( tt 0 ) b 2 ( tt 0 )( tt 1 ) b 3 ( tt 0 )( tt 1 )( tt 2 )

3    

t t t

t t t

At t  16 ,

3    

v

33

 392. 06 m/s

Matlab Worksheet: Cubic Interpolation

34

Why Splines?

0 8

-0.

0

-1 -0.5 0 0.5 1

y

37

Figure : Higher order polynomial interpolation is a bad idea

-0.

x

19th Order Polynomial f (x) 5th Order Polynomial

Linear Splines

Given  x 0 , y 0  , x 1 , y 1 ,......,  xn  1 , yn  1  xn , yn , fit linear splines to the data. This simply involves

forming the consecutive data through straight lines. So if the above data is given in an ascending

order, the linear splines are given by, p g y  yyi i  ff (( x ii ))

Figure : Linear splines

38

Linear Splines (cont.)

1 0

1 0 0 x x x x

f x f x f x f x  

  x 0 (^)  xx 1

f x 2 f x 1 f

2 1

2 1 1 x x x x

f f f x  

  x 1 (^)  xx 2

1 1

1 1  

 

n n n

n n n x x x x

f x f x f x n n xxx  1

39

Note the terms of

1

i i

i i

x x

f x fx

in the above function are simply slopes between xi  1 and x i.

Example 4

The upward velocity of a rocket is given as a function of

time. Find the velocity at t=16 seconds using linear

splinessplines.

Table Velocity as a

function of time

(s) (m/s)

t v ( t )

40

Figure. Velocity vs. time data

for the rocket example