Вы находитесь на странице: 1из 35

What is Interpolation ?

Given (x0,y0), (x1,y1), (xn,yn), find the


value of y at a value of x that is not given.

Interpolants
Polynomials are the most common choice
of interpolants because they are easy to:
Evaluate
Differentiate, and
Integrate.

Newtons Divided Difference Method


Linear interpolation: Given ( x0 , y 0 ), ( x1 , y1 ), pass a
linear interpolant through the data
f1 ( x) = a0 + a1 ( x x0 )

where

a0 = f ( x0 )
a1 =
3

f (x1) f (x0 )
x1 x0

Quadratic Interpolation
Given ( x0 , y 0 ), ( x1 , y1 ), and ( x 2 , y 2 ), fit a quadratic interpolant through the data.

f 2 ( x) = a0 + a1 ( x x0 ) + a2 ( x x0 )( x x1 )
a0 = f ( x0 )
f ( x1 ) f ( x0 )
a1 =
x1 x0
f ( x2 ) f ( x1 ) f ( x1 ) f ( x0 )

x2 x1
x1 x0
a2 =
x2 x0
4

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

t (s) v(t ) ( m/s)

0
10
15
20
22.5
30

0
227.04
362.78
517.35
602.97
901.67
Figure. Velocity vs. time data
for the rocket example

Quadratic Interpolation (contd)


517.35

550

500

450
y s
400
f ( range )

f x desired

350

300

250

227.04

200

10
10

12

14

16

x s , range , x desired

t 0 = 10, v(t 0 ) = 227.04

t1 = 15, v(t1 ) = 362.78


6

t 2 = 20, v(t 2 ) = 517.35

18

20
20

Quadratic Interpolation (contd)


a0 = f ( x0 )

a0 = v(t0 )
a1 =

= 227 . 04

a1 =

v (t1 ) v(t0 )

362.78 227.04

t1 t0

f ( x1 ) f ( x0 )
x1 x0

f ( x2 ) f ( x1 ) f ( x1 ) f ( x0 )

x2 x1
x1 x0
a2 =
x2 x0

15 10

= 27 . 148

v(t2 ) v (t1 )
a2 =
=

t2 t1

t1 t0
t2 t0

30. 914 27.148


10

= 0 . 37660
7

v(t1 ) v(t0 )

517.35 362.78
=

362.78 227.04

20 15

15 10
20 10

Quadratic Interpolation (contd)


v(t ) = a0 + a1 (t t0 ) + a2 (t t0 )(t t1 )
= 227.04 + 27.148(t 10) + 0.37660(t 10)(t 15), 10 t 20

At t = 16,
v(16) = 227.04 + 27.148(16 10) + 0.37660(16 10)(16 15) = 392.19 m/s

The absolute relative approximate error a obtained between the results from the first
order and second order polynomial is
a

392.19 393.69
=
x100
392.19

= 0.38502 %
8

General Form for Quadratic Interpolation

f 2 ( x) = a0 + a1 ( x x0 ) + a2 ( x x0 )( x x1 )
where
a0 = f [ x0 ] = f ( x0 )
a1 = f [ x1 , x0 ] =

f ( x1 ) f ( x0 )
x1 x0
f ( x2 ) f ( x1 )

a2 = f [ x2 , x1 , x0 ] =

f [ x2 , x1 ] f [ x1 , x0 ]
x2 x0

f ( x1 ) f ( x0 )

x2 x1

x1 x0
x2 x0

Rewriting

f2 (x) = f [x0 ] + f [x1, x0 ](x x0 ) + f [x2 , x1, x0 ](x x0 )(x x1)


9

General Form
Given (n + 1) data points, ( x0 , y 0 ), ( x1 , y1 ),......, ( x n 1 , y n 1 ), ( x n , y n ) as

Pn ( x) = a0 + a1 ( x x0 ) + .... + an ( x x0 )( x x1 )...( x xn 1 )
where

a0 = f [ x0 ]
a1 = f [ x1 , x0 ]
a2 = f [ x2 , x1 , x0 ]

an 1 = f [ xn 1 , xn 2 ,...., x0 ]
an = f [ xn , xn 1 ,...., x0 ]
10

General form
The third order polynomial, given ( x0 , y0 ), ( x1 , y1 ), ( x2 , y 2 ), and ( x3 , y3 ), is
P3 ( x) = f [ x0 ] + f [ x1 , x0 ]( x x0 ) + f [ x2 , x1 , x0 ]( x x0 )( x x1 )
+ f [ x3 , x2 , x1 , x0 ]( x x0 )( x x1 )( x x2 )
a0
x0

f (x0 )

a1
f [x1 , x0 ]

x1

a2
f [x2 , x1 , x0 ]

f (x1 )

f [x3 , x2 , x1 , x0 ]

f [x2 , x1 ]
x2

f (x2 )

f [x3 , x2 , x1 ]
f [x3 , x2 ]

x3
11

f (x3 )

a3

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
t (s )

v(t ) ( m/s)

10

227.04

15

362.78

20

517.35

22.5

602.97

30

901.67

12

Figure. Velocity vs. time data


for the rocket example

Example
The velocity profile is chosen as

v(t ) = a0 + a1 (t t0 ) + a2 (t t0 )(t t1 ) + a3 (t t0 )(t t1 )(t t 2 )


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

t0 = 10,

v(t 0 ) = 227.04

t1 = 15,

v(t1 ) = 362.78

t 2 = 20,

v(t 2 ) = 517.35

t 3 = 22.5, v(t3 ) = 602.97

The values of the constants are found as:


a0 = 227.04; a1 = 27.148; a 2 = 0.37660; a 3 = 5.4347103
13

Example
a0
t0 = 10

a1

227.04
27.148

t1 = 15,

362.78

a2
0.37660

5.4347103

30.914
t2 = 20,

517.35

a3

0.44453

34.248
t3 = 22.5,

602.97

a0 = 227.04; a 1 = 27.148; a 2 = 0.37660; a 3 = 5.4347103


14

Hence

Example
v(t) =a0 +a1 (t t0 ) +a2 (t t0 )(t t1 ) +a3 (t t0 )(t t1 )(t t2 )
=227.04 + 27.148(t 10) +0.37660(t 10)(t 15)
3

+5.4347*10 (t 10)(t 15)(t 20)


At t =16,
v(16) =227.04 +27.148(16 10) +0.37660(16 10)(16 15)
3

+5.4347*10 (16 10)(16 15)(16 20)


=392.06 m/s
The absolute relative approximate error a obtained is
a

15

392.06 392.19
x100
392.06

= 0.033427 %

Comparison Table
Order of
Polynomial
v(t=16)
m/s
Absolute Relative
Approximate Error

16

393.69

392.19

392.06

----------

0.38502 %

0.033427 %

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)
3

+ 5.4347 * 10 (t 10)( t 15)( t 20)


= 4.2541 + 21.265t + 0.13204t 2 + 0.0054347t 3

10 t 22.5
10 t 22.5

So
16

s (1 6 ) s (1 1 ) =

v (t )d t

11
16

4 .2 5 4 1 + 2 1 .2 6 5t + 0 .1 3 2 0 4 t 2 + 0 .0 0 5 4 3 4 7 t 3 ) d t

11
16

t2
t3
t4
= 4 .2 5 4 1t + 2 1 .2 6 5
+ 0 .1 3 2 0 4
+ 0 .0 0 5 4 3 4 7

2
3
4 11

17

= 1605 m

Acceleration from Velocity Profile


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

v(t) = 4.2541+ 21.265t + 0.13204t 2 + 0.0054347t 3


d
d
2
3
a(t) = v(t) = 4.2541+ 21.265t + 0.13204t + 0.0054347t
dt
dt

= 21.265 + 0.26408t + 0.016304t

a(16) = 21.265 + 0.26408(16) + 0.016304(16)2


= 29.664 m/ s2
18

Polinomial Interpolasi Newton dengan titik


berjarak sama
Pendekatan beda maju Gregory - Newton

19

Pendekatan beda maju Gregory - Newton

20

Pendekatan beda maju Gregory - Newton

21

Pendekatan beda maju Gregory - Newton

Maka persamaan pada halaman 10 pada slide ini menjadi:

22

Pendekatan beda maju Gregory - Newton


Untuk menulis persamaan di atas dalam bentuk yang lebih sederhana, maka kita set:

dimana:
23

Pendekatan beda maju Gregory - Newton

24

Pendekatan beda maju Gregory - Newton

25

Pendekatan beda maju Gregory - Newton

26

Pendekatan beda maju Gregory - Newton

27

Latihan:

28

Pendekatan beda mundur Gregory - Newton

29

Pendekatan beda mundur Gregory - Newton

30

Pendekatan beda mundur Gregory - Newton

31

Pendekatan beda mundur Gregory - Newton

32

Pendekatan beda mundur Gregory - Newton

33

Pendekatan beda mundur Gregory - Newton

34

Pendekatan beda mundur Gregory - Newton

35

Вам также может понравиться