Vous êtes sur la page 1sur 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.

1

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

2

Newton’s 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

fit a quadratic interpolant through the data. y 0 ). y1 ). and ( x 2 . y 2 ). ( x1 .Quadratic Interpolation Given ( x0 . 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 .

78 517.97 901.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.35 602.5 30 0 227.04 362.67 Figure. Velocity as a function of time t (s) v(t ) ( m/s) 0 10 15 20 22. Velocity vs. time data for the rocket example 5 .

v(t 0 ) = 227.35 18 20 20 .04 200 10 10 12 14 16 x s .78 6 t 2 = 20.Quadratic Interpolation (contd) 517. x desired t 0 = 10. range . v(t1 ) = 362.35 550 500 450 y s 400 f ( range ) ( f x desired ) 350 300 250 227.04 t1 = 15. v(t 2 ) = 517.

78 = − 362.78 − 227.Quadratic Interpolation (contd) a0 = f ( x0 ) a0 = v(t0 ) a1 = = 227 .35 − 362. 914 − 27.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 .04 20 −15 15 −10 20 −10 . 04 a1 = v (t1 ) − v(t0 ) = 362. 37660 7 − v(t1 ) − v(t0 ) 517. 148 v(t2 ) − v (t1 ) a2 = = t2 − t1 t1 − t0 t2 − t0 30.148 10 = 0 .78 − 227.

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.69 = x100 392.148(16 − 10) + 0.19 = 0. v(16) = 227.148(t − 10) + 0.38502 % 8 . 10 ≤ t ≤ 20 At t = 16.37660(t − 10)(t − 15).04 + 27.Quadratic Interpolation (contd) v(t ) = a0 + a1 (t − t0 ) + a2 (t − t0 )(t − t1 ) = 227.04 + 27.19 − 393.

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 ](x − x0 ) + f [x2 . x0 ] = f [ x2 . x1 ] − f [ x1 . x0 ] = f ( x1 ) − f ( x0 ) x1 − x0 f ( x2 ) − f ( x1 ) a2 = f [ x2 . x0 ](x − x0 )(x − x1) 9 . x0 ] x2 − x0 = − f ( x1 ) − f ( x0 ) x2 − x1 x1 − x0 x2 − x0 Rewriting f2 (x) = f [x0 ] + f [x1. x1. x1 .

y 0 ).. x0 ] an = f [ xn .. y1 ). + an ( x − x0 )( x − x1 ).......( x − xn −1 ) where a0 = f [ x0 ] a1 = f [ x1 .... y n −1 ). ( x1 .. y n ) as Pn ( x) = a0 + a1 ( x − x0 ) + ..... xn −1 . x0 ] ⋮ an −1 = f [ xn −1 . x0 ] a2 = f [ x2 . x1 .. ( x0 .General Form Given (n + 1) data points.. ( x n ... ( x n −1 . xn − 2 . x0 ] 10 ...

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

97 30 901.78 20 517. Find the velocity at t=16 seconds using the Newton Divided Difference method for cubic interpolation. time data for the rocket example . Velocity as a function of time t (s ) v(t ) ( m/s) 0 0 10 227.04 15 362.5 602. Velocity vs. Table.67 12 Figure.35 22.Example The upward velocity of a rocket is given as a function of time in Table 1.

04 t1 = 15.37660.35 t 3 = 22.4347×10−3 13 . v(t 0 ) = 227.04.148.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. a 2 = 0.78 t 2 = 20. v(t3 ) = 602.5. a 3 = 5. v(t1 ) = 362. a1 = 27.97 The values of the constants are found as: a0 = 227. v(t 2 ) = 517.

a 1 = 27.97 a0 = 227.37660. a 2 = 0.78 a2 0.37660 5.Example a0 t0 = 10 a1 227. a 3 = 5.148.04 27.4347×10−3 14 .44453 34. 362.5.4347×10−3 30.35 a3 0.148 t1 = 15. 517.914 t2 = 20. 602.04.248 t3 = 22.

4347*10 (16 −10)(16 −15)(16 −20) =392. v(16) =227.Hence Example v(t) =a0 +a1 (t −t0 ) +a2 (t − t0 )(t − t1 ) +a3 (t −t0 )(t − t1 )(t −t2 ) =227.4347*10 (t −10)(t −15)(t −20) At t =16.19 x100 392.06 − 392.06 m/s The absolute relative approximate error ∈a obtained is ∈a 15 = 392.148(16 −10) +0.37660(t −10)(t −15) −3 +5.148(t −10) +0.04 + 27.033427 % .06 = 0.37660(16 −10)(16 −15) −3 +5.04 +27.

033427 % .Comparison Table Order of Polynomial v(t=16) m/s Absolute Relative Approximate Error 16 1 2 3 393.38502 % 0.19 392.06 ---------- 0.69 392.

0 0 5 4 3 4 7  2 3 4  11  17 = 1605 m .2541 + 21.04 + 27.37660( t − 10)( t − 15) −3 + 5.Distance from Velocity Profile Find the distance covered by the rocket from t=11s to t=16s ? v (t ) = 227.265t + 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 6 5t + 0 .0054347t 3 10 ≤ t ≤ 22.148(t − 10) + 0.2 6 5 + 0 .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 .1 3 2 0 4 + 0 .2 5 4 1t + 2 1 .13204t 2 + 0.4347 * 10 (t − 10)( t − 15)( t − 20) = −4.

265t + 0.0054347t dt dt ( = 21.664 m/ s2 18 ) .2541+ 21.016304t 2 a(16) = 21.13204t 2 + 0.265 + 0.265 + 0.016304(16)2 = 29.26408t + 0.0054347t 3 d d 2 3 a(t) = v(t) = − 4.Acceleration from Velocity Profile Find the acceleration of the rocket at t=16s given that v(t) = −4.265t + 0.26408(16) + 0.2541+ 21.13204t + 0.

Newton 19 .Polinomial Interpolasi Newton dengan titik berjarak sama Pendekatan beda maju Gregory .

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 .

Newton Untuk menulis persamaan di atas dalam bentuk yang lebih sederhana. maka kita set: dimana: 23 .Pendekatan beda maju Gregory .

Pendekatan beda maju Gregory .Newton 24 .

Pendekatan beda maju Gregory .Newton 25 .

Newton 26 .Pendekatan beda maju Gregory .

Newton 27 .Pendekatan beda maju Gregory .

Latihan: 28 .

Newton 29 .Pendekatan beda mundur Gregory .

Newton 30 .Pendekatan beda mundur Gregory .

Pendekatan beda mundur Gregory .Newton 31 .

Pendekatan beda mundur Gregory .Newton 32 .

Newton 33 .Pendekatan beda mundur Gregory .

Pendekatan beda mundur Gregory .Newton 34 .

Newton 35 .Pendekatan beda mundur Gregory .