43
Interpolasi

Interpolasi

  • Upload
    agatha

  • View
    85

  • Download
    1

Embed Size (px)

DESCRIPTION

Interpolasi. Interpolasi. Perbedaan Interpolasi dan Ekstrapolasi. Interpolasi Linier. f ( x ). L(x). x. x 0. x 1. Interpolasi Kudrat. L ( x ). f ( x ). x. x 0. h. x 1. h. x 2. Interpolasi Qubic. L(x). f(x). x. x 0. h. x 1. h. x 2. h. x 3. Interpolasi dg Polinomial. th. - PowerPoint PPT Presentation

Citation preview

Page 1: Interpolasi

Interpolasi

Page 2: Interpolasi
Page 3: Interpolasi

Interpolasi

Page 4: Interpolasi

Perbedaan Interpolasi dan Ekstrapolasi

Page 5: Interpolasi

x0 x1 x

f(x)

L(x)

Interpolasi Linier

Page 6: Interpolasi

Interpolasi Kudrat

x0 x1 x

f(x)

x2h h

L(x)

Page 7: Interpolasi

Interpolasi QubicInterpolasi Qubic

x0 x1 x

f(x)

x2h h

L(x)

x3h

Page 8: Interpolasi

Interpolasi dg Polinomial

22511)(x

xf

Table : Six equidistantly spaced points in [-1, 1]

Figure : 5th order polynomial vs. exact function

x 22511x

y

-1.0 0.038461

-0.6 0.1

-0.2 0.5

0.2 0.5

0.6 0.1

1.0 0.038461

Page 9: Interpolasi

Interpolasi dg Polinomial

Figure : Higher order polynomial interpolation is a bad idea

Original Function

16th Order Polynomial

8th Order Polynomial

4th Order Polynomial

Page 10: Interpolasi

Uji Coba2251

1)(x

xf

0

0.2

0.4

0.6

0.8

1

1.2

-1.5 -1 -0.5 0 0.5 1 1.5

Page 11: Interpolasi

Interpolasi Kuadratik Titik yang digunakan

-0.52 0.128866 0.52 0.128866 0 1

F(x) =-3.22165x2 + 1

-2.5

-2

-1.5

-1

-0.5

0

0.5

1

1.5

-1.5 -1 -0.5 0 0.5 1 1.5 y1y2

Page 12: Interpolasi

Interpolasi Polinom derajat 4 Titik yang digunakan

0 1 0.2 0.5 -0.2 0.5 0.8 0.058824 -0.8 0.058824

F(x) =18.3824x4-13.2353x2+ 1

Page 13: Interpolasi

Interpolasi Polinom derajat 4

-2

-1

0

1

2

3

4

5

6

7

-1.5 -1 -0.5 0 0.5 1 1.5

y1y2

Page 14: Interpolasi

Contoh 2 :Titik2 yang digunakan untuk menghitung interpolasi n = 3(-3,-63) (3,-9)(0,0) (-2,-24)

Page 15: Interpolasi

Contoh 2 : Persamaan

-27a + 9b – 3c + d = -63 7a + 9b + 3c + d = -9 -8a + 4b – 2c + d = -24 d = 0

Penyelesaian X3 – 4x2 + 1.59872e-15X

Page 16: Interpolasi

Hasily2

-140

-120

-100

-80

-60

-40

-20

0

20

-6 -4 -2 0 2 4 6

y2

Page 17: Interpolasi

Interpolasi Linier ide dasar : pada saat

data dalam bentuk tabel tidak begitu bervariasi, sehingga memungkinkan untuk dilakukan pendekatan dengan menggunakan sebuah garis lurus di antara dua titik yang berdekatan.

Page 18: Interpolasi

Interpolasi Linier

Page 19: Interpolasi

Contoh : Jarak yang dibutuhkan sebuah kendaraan untuk

berhenti adalah fungsi kecepatan. Data percobaan berikut ini menunjukkan hubungan antara kecepatan dan jarak yang dibutuhkan untuk menghentikan kendaraan.

Perkirakan jarak henti yang dibutuhkan bagi sebuah kenderaan yang melaju dengan kecepatan 45 mil/jam.

Page 20: Interpolasi

Contoh : maka untuk mencari nilai x=45 maka,

Page 21: Interpolasi

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 linear splines.

t v(t)

s m/s

0 0

10 227.04

15 362.78

20 517.35

22.5 602.97

30 901.67

Table : Velocity as a function of time

Figure : Velocity vs. time data for the rocket example

Page 22: Interpolasi

Linear Interpolation

10 12 14 16 18 20 22 24350

400

450

500

550517.35

362.78

y s

f range( )

f x desired

x s110x s0

10 x s range x desired

,150 t 78.362)( 0 tv

,201 t 35.517)( 1 tv

)()()(

)()( 001

010 tt

tttvtv

tvtv

)15(1520

78.36235.51778.362

t

)15(913.3078.362)( ttv

At ,16t

)1516(913.3078.362)16( v

7.393 m/s

Page 23: Interpolasi

Interpolasi KuadratF(x) = ax2 + bx + c

Page 24: Interpolasi

Interpolasi Kuadrat Titik-titik data (x1,y1) (x2,y2) (x3,y3)

Hitung a, b dan c dari sistem persamaan tersebut dengan Metode Eliminasi Gauss

Page 25: Interpolasi

Interpolasi Kuadrat (Versi lain)

))(())((

))(())((

))(())((

2313

213

3212

312

3121

321 xxxx

xxxxy

xxxxxxxx

yxxxxxxxx

yy

Untuk memperoleh titik baru Q (x,y)

Page 26: Interpolasi

Contoh : Diberikan titik ln(8) = 2.0794, ln(9) = 2.1972,

ln(9.5) = 2.2513. Tentukan nilai ln(9.2) dengan interpolasi kuadrat

Sistem Pers Linier yang terbentuk. 64 a + 8 b + c = 2.0794 81 a + 9 b + c = 2.1972 90.25 a + 9.5 b + c = 2.2513

Penyelesaian a= -0.0064 b = 0.2266 c = 0.6762

Sehingga p2(9.2) = 2.2192

Page 27: Interpolasi

Interpolasi QubicInterpolasi Qubic

x0 x1 x

f(x)

x2h h

L(x)

x3h

Page 28: Interpolasi

Interpolasi Qubic Terdapat 4 titik data (x0,y0) (x1,y1) (x2,y2) dan

(x3,y3) p3(x) = a0 + a1x + a2x2 + a3x3

Polinom p3(x) ditentukan dengan cara Masukan (xi,yi) ke dalam persamaan

a0 + a1x0 + a2x02 + a3x0

3 = y0 a0 + a1x1 + a2x1

2 + a3x13 = y1

a0 + a1x2 + a2x22 + a3x2

3 = y2 a0 + a1x3 + a2x3

2 + a3x33 = y3

Hitung a0 , a1 , a2 , dan a3

Page 29: Interpolasi

Metode Lain Secara umum, penentuan polinomial

dengan cara tsb kurang disukai, karena mempunyai kemungkinan yang jelek terutama untuk derajat polinomial yang semakin tinggi.

Terdapat beberapa metode polinom interpolasi : Polinom Lagrange Polinom Newton Polinom Newton Gregory

Page 30: Interpolasi

Polinom Lagrange Polinom berderajat satu

Dapat diatur kembali sedemikian rupa sehingga menjadi

Atau dapat dinyatakan dalam bentuk (*)

Dimana

Persamaan * dinamakan Polinom Lagrange derajat 1.

)()()(

)( 001

0101 xx

xxyy

yxp

)()(

)()(

)(01

01

10

101 xx

xxy

xxxx

yxp

)()()( 11001 xLaxLaxp

00 ya

)()(

)(10

10 xx

xxxL

11 ya

)()(

)(01

01 xx

xxxL

Page 31: Interpolasi

Polinom Lagrange Bentuk umum Polinom Lagrange

derajat ≤ n untuk (n+1) titik berbeda adalah :

Yang dalam hal ini

)(...)()()()( 110

00 xLaxLaxLaxLaxp nn

n

iiin

ii ya

n

ijj ji

ji xx

xxxL

0 )()(

)(

Page 32: Interpolasi

Contoh : Hampiri fungsi f(x) = cos(x) dengan

polinom interpolasi derajat tiga pada range [0.0, 1.2]. Gunakan empat titik

x0 = 0.0, x1 = 0.4, x2 = 0.8, x3 = 1.2 Perkirakan nilai p3(0.5) dan

bandingkan dengan nilai sebenarnya.Xi 0.0 0.4 0.8 1.2yi 1 0.92106

10.696707

0.362358

Page 33: Interpolasi

Contoh : Polinom Lagrange derajat 3 yang

menginterpolasi keempat titik tsb.

))()(())()((

))()(())()((

))()(())()((

))()(())()((

)(

)()()()()(

231303

2103

321202

3102

312101

3201

302010

32103

332211003

xxxxxxxxxxxx

yxxxxxxxxxxxx

y

xxxxxxxxxxxx

yxxxxxxxxxxxx

yxp

xLaxLaxLaxLaxp

)8.02.1)(4.02.1)(0.02.1()8.0)(4.0)(0.0(362358.0

)2.18.0)(4.08.0)(0.08.0()2.1)(4.0)(0.0(696707.0

)2.14.0)(8.04.0)(0.04.0()2.1)(8.0)(0.0(921061.0

)2.10.0)(8.00.0)(4.00.0()2.1)(8.0)(4.0(1)(3

xxxxxx

xxxxxxXp

877221.0)5.0(3 p 877583.0)5.0cos( y

Page 34: Interpolasi

Polinom Newton Polinom Lagrange kurang disukai dalam praktek

karena : Jumlah komputasi yang dibutuhkan untuk satu kali

interpolasi adalah besar. Interpolasi untuk nilai x yang lain memerlukan jumlah komputasi yang sama karena tidak ada bagian komputasi sebelumnya yang dapat digunakan.

Bila jumlah titik data meningkat atau menurun, hasil komputasi sebelumnya tidak dapat digunakan. Karena tidak ada hubungannya antara pn-1(x) dan pn(x) pada polinom Lagrange

Polinom yang dibentuk sebelumnya dapat digunakan untuk membentuk polinom derajat yang lebih tinggi.

Page 35: Interpolasi

Polinom Newton Persamaan Polinom Linier

Bentuk pers ini dapat ditulis :

Yang dalam hal ini (1) Dan (2)

Pers ini mrpk bentuk selish terbagi (divided-difference)

)()()(

)( 001

0101 xx

xxyy

yxp

)()( 0101 xxaaxp )( 000 xfya

)()()(

)()(

01

01

01

011 xx

xfxfxxyy

a

],[ 011 xxfa

Page 36: Interpolasi

Polinom Newton Polinom kuadratik

Atau

Dari pers ini menunjukkan bahwa p2(x) dapat dibentuk dari pers sebelumnya p1(x). Nilai a2 dapat ditemukan dengan mengganti x=x2 untuk mendapatkan

(3)

Nilai a0 dan a1 pada pers 1 dan 2 dimasukkan pada pers 3

))(()()( 1020102 xxxxaxxaaxp

))(()()( 10212 xxxxaxpxp

))(()()(

1202

021022 xxxx

xxaaxfa

12

01

01

02

02

2

)()()()(

xxxxxfxf

xxxfxf

a

Page 37: Interpolasi

Polinom Newton Dengan melakukan utak-atik aljabar,

pers ini lebih disukai

02

0112

02

01

01

12

02

2],[],[

)()()()(

xxxxfxxf

xxxxxfxf

xxxfxf

a

Page 38: Interpolasi

Polinom Newton Jadi tahapan pembentukan polinom Newton

:)()()( 0101 xxaxpxp

)()( 0101 xxaaxp

))(()()( 1020102 xxxxaxxaaxp

))(()()( 10212 xxxxaxpxp

))()(()()( 210323 xxxxxxaxpxp

))()(())(()()( 21031020103 xxxxxxaxxxxaxxaaxp

Page 39: Interpolasi

Polinom Newton Nilai konstanta a0, a1, a2,…, an, merupakan nilai selisih

terbagi , dg nilai

Yang dalam hal ini ],,...,,[],,[

],[)(

011

0122

011

00

xxxxfaxxxfa

xxfaxfa

nnn

0

012111011

),,...,,[],...,,[],,...,,[

],[],[],,[

)()(],[

xxxxxxfxxxf

xxxxf

xxxxfxxf

xxxf

xxxfxf

xxf

n

nnnnnn

ki

kjjikji

ji

jiji

Page 40: Interpolasi

Polinom Newton Dengan demikian polinom Newton dapat

ditulis dalam hub rekursif sebagai : Rekurens

basis Atau dalam bentuk polinom yang lengkap

sbb :

],,...,,[))...()(()()( 0111101 xxxxfxxxxxxxpxp nnnnn

)()( 00 xfxp

],,...,,[))...()((],,[))((],[)()()(

011110

012100100

xxxxfxxxxxxxxxfxxxxxxfxxxfxp

nnn

n

Page 41: Interpolasi

Contoh Soal : Bentuklah polinom Newton derajat satu, dua, tiga dan

empat yang menghampiri f(x)=cos(x) dalam range[0.0, 4] dan jarak antar titik adalah 1.0. Lalu taksirlah f(x) dengan x=2.5 dengan Polinom Newton derajat 3.

xi yi ST-1 ST-2 ST-3 ST-40.0 1 -0.4597 -0.2484 0.1466 -0.01471.0 0.5403 -0.9564 0.1913 0.08802.0 -

0.4161-0.5739 0.4551

3.0 -0.99 0.33634.0 -

0.6536

Page 42: Interpolasi

Contoh Soal : Contoh cara menghitung nilai selisih

terbagi pada tabel :

2484.002

4597.09564.0)(

],[],[],,[

9564.012

5403.04161.0)(

)()(],[

4597.001

15403.0)(

)()(],[

02

0112012

12

1212

01

0101

xxxxfxxf

xxxf

xxxfxf

xxf

xxxfxf

xxf

Page 43: Interpolasi

Contoh Soal : Maka polinom Newton derajat 1,2 dan 3

dengan x0 = 0 sebagai titik pertama :

Nilai sejati f(2.5) adalah F(2.5) = cos(2.5)=-0.8011

)0.3)(0.2)(0.1)(0.0(0147.0)0.2)(0.1)(0.0(1466.0)0.1)(0.0(2484.0)0.0(4597.00.1)()cos(

)0.2)(0.1)(0.0(1466.0)0.1)(0.0(2484.0)0.0(4597.00.1)()cos()0.1)(0.0(2484.0)0.0(4597.00.1)()cos(

)0.0(4597.00.1)()cos(

4

3

2

1

xxxxxxxxxxxpx

xxxxxxxpxxxxxpx

xxpx