Interpolasi
• Interpolasi : menaksir harga-harga diantara titik-titik data yang telah tepat
(diketahui)
• Metode yang paling sering digunakan adalah interpolasi polinomial
• Formula umum polinomial orde ke-n :
f ( x) a0 a1 x a2 x 2 an x n
Untuk n+1 titik-titik data, terdapat satu dan hanya satu polinomial orde ke-n
atau kurang yang melewati semua titik
4
Contoh Interpolasi Linear
• Contoh:
Solusi :
f ( x1 ) f ( x0 )
f1 ( x) f ( x0 ) ( x x0 )
x1 x0
1.7917595 0
f1 (2) 0 (2 1) 0.35835190 Persen kesalahan εt=48.3%
6 1
Jika digunakan interval yang lebih kecil antara x0=1 sampai x1=4, maka :
1.3862944 0
f1 (2) 0 (2 1) 0.46209813 Persen kesalahan εt=33.3%
4 1
Contoh Interpolasi Linear
Interval yang semakin kecil memberikan suatu taksiran yang lebih baik
Interpolasi Kuadratik
• Jika tiga titik data tersedia, taksiran diperbaiki dengan memperkenalkan beberapa
lengkungan ke dalam garis yang menghubungkan titik-titik
Ini dapat dilakukan dengan sebuah polinomial orde kedua (polinomial kuadratik)
f 2 ( x) b0 b1 ( x x0 ) b2 ( x x0 )( x x1 )
Orde kedua
x x0 b0 f ( x0 )
f ( x1 ) f ( x0 )
x x1 b1
x1 x0
f ( x 2 ) f ( x1 ) f ( x1 ) f ( x0 )
x 2 x1 x1 x0
x x2 b2
x 2 x0
7
f ( x) b0 b1 ( x x0 ) b2 ( x x0 )( x x1 )
f ( x1 ) f ( x0 )
b0 f ( x0 ) b1
x1 x0
f ( x1 ) f ( x0 )
f ( x2 ) f ( x0 ) ( x2 x0 )
f ( x2 ) f ( x0 ) b1 ( x2 x0 ) x1 x0
x x2 b2 b2
( x2 x0 )( x2 x1 ) ( x2 x0 )( x2 x1 )
( f ( x2 ) f ( x1 ) f ( x1 ) f ( x0 ))( x2 x1 ) ( f ( x1 ) f ( x0 ))( x2 x1 x1 x0 )
( x2 x1 ) ( x1 x0 )
x x2 b2
( x2 x0 )( x2 x1 )
( f ( x2 ) f ( x1 ))( x2 x1 ) ( f ( x1 ) f ( x0 ))( x2 x1 )
( x2 x1 ) ( x1 x0 )
b2
( x2 x0 )( x2 x1 )
f ( x2 ) f ( x1 ) f ( x1 ) f ( x0 )
( x2 x1 ) ( x1 x0 )
b2
( x2 x0 )
Contoh Interpolasi Kuadratik
• Taksirlah ln 2 dengan menggunakan interpolasi kuadratik.
x0=1 f(x0)= 0
x1 = 4 f(x1)=1.3862944
x2 = 6 f(x2)= 1.7917595
Harga ln2 sebenarnya adalah 0,69314718
Solusi:
x x0 b0 f ( x0 )
b0=0
f ( x1 ) f ( x0 )
x x1 b1
x1 x0
1.3862944 0
x x1 b1 0.46209813
4 1
Contoh Interpolasi Kuadratik
f ( x 2 ) f ( x1 ) f ( x1 ) f ( x0 )
x 2 x1 x1 x0
x x2 b2
x 2 x0
1.7917595 1.3862944
0.46209813
x x2 b2 64 0.051873116
6 1
f 2 ( x) b0 b1 ( x x0 ) b2 ( x x0 )( x x1 )
f n ( x ) b0 b1 ( x x0 ) b2 ( x x0 )( x x1 ) bn ( x x0 )( x x1 ) ( x x n 1 )
b0 f ( x0 ) b1 f [ x1 , x0 ] b2 f [ x 2 , x1 , x0 ] bn f [ x n , x n 1 , , x1, x0 ]
1.7917595 1.3862944
f [ x2 , x1] 0.20273255
64
1.6094379 1.7917595
f [ x3 , x2 ] 0.18232160
56
Contoh Polinomial Interpolasi
Diferensi Terbagi Newton
Diferensi terbagi kedua:
0.20273255 0.46209813
f [ x2 , x1, x0 ] 0.051873116
6 1
f [ xn , xn 1, , x1 ] f [ xn 1, xn 2 , , x0 ]
f [ xn , xn 1, , x1, x0 ]
xn x0
Untuk n=3 :
0.020410950 (0.051873116 )
f [ x3 , x2 , x1, x0 ] 0.0078655415
5 1
Contoh Polinomial Interpolasi
Diferensi Terbagi Newton
Hasil-hasil untuk f[x1,x0] , f[x2,x1,x0] dan f[x3,x2,x1,x0] menunjukkan koefisien b1,b2,b3.
Bersama dengan b0=f(x0) = 0, persamaan adalah :
f n ( x) b0 b1( x x0 ) b2 ( x x0 )( x x1) bn ( x x0 )( x x1)( x xn 1)
n n xx
j
f n ( x) Li ( x) f ( xi ) dimana : Li ( x) xi x j
i 0 j 0
j i
Versi linear (n-1) adalah:
x x1 x x0
f1 ( x) f ( x0 ) f ( x1 )
x0 x1 x1 x0
f 2 ( x)
x x1 x x2 f ( x ) x x0 x x2 f ( x ) x x0 x x1 f ( x )
x0 x1 x0 x 2 0 x1 x0 x1 x 2 1 x2 x0 x2 x1 2
Polinomial Interpolasi Lagrange
Taksirlah ln 2 menggunakan polinomial interpolasi Lagrange orde pertama dan kedua
x0=1 f(x0)= 0
x1 = 4 f(x1)=1.3862944
x2 = 6 f(x2)= 1.7917595
f 2 ( x)
x x1 x x2 f ( x ) x x0 x x2 f ( x ) x x0 x x1 f ( x )
x0 x1 x0 x 2 0 x1 x0 x1 x 2 1 x2 x0 x2 x1 2
f 2 (2)
2 42 6 0 2 12 61.3862944 2 12 41.7917595 0.56584437
1 41 6 4 14 6 6 16 4
Interpolasi Spline
18