pengolahan data - scilab
TRANSCRIPT
![Page 1: Pengolahan Data - Scilab](https://reader035.vdocuments.pub/reader035/viewer/2022081715/544a1b8baf795959088b45e7/html5/thumbnails/1.jpg)
9/12/2011
1
Pengolahan Data - Scilab
Setia Budi Sasongko
Pengolahan Data
� Interpolasi� Pencocokan Kurva (Curve Fitting)
![Page 2: Pengolahan Data - Scilab](https://reader035.vdocuments.pub/reader035/viewer/2022081715/544a1b8baf795959088b45e7/html5/thumbnails/2.jpg)
9/12/2011
2
Interpolasi Linear
D
E
C
BA
f (x2)
f (x1)
f (x)
x2x1 x
AD
DE
AB
BC =
12
12
1
1 )()()()(
xx
xfxf
xx
xfxf
−−
=−−
( ) ( )112
121
)()()( xx
xx
xfxfxfxf −
−−
+=
Regresi Linear, y=a0 + a1x
)(1
101
∑ −−∑ ===
n
iii
n
ii xaaye
∑ −−=∑==
n
iii
n
ii xaaye
110
1)(
∑ −−=∑===
n
iii
n
iir xaayeS
1
210
1
2 )(
![Page 3: Pengolahan Data - Scilab](https://reader035.vdocuments.pub/reader035/viewer/2022081715/544a1b8baf795959088b45e7/html5/thumbnails/3.jpg)
9/12/2011
3
Persamaan Linear: y=a0 + a1x
0)(21
100
=∑ −−−=∂∂
=
n
iii
r xaaya
S
( )[ ] 021
101
=∑ −−−=∂∂
=
n
iiii
r xxaaya
S
∑ ∑ ∑ =−− 010 ii xaay
∑ ∑ ∑ =−− 0210 iiii xaxaxy
∑
∑=
∑∑
∑
ii
i
ii
i
yx
y
a
a
xx
xn
1
02
( )∑ ∑−∑ ∑ ∑−=
221ii
iiii
xxn
yxyxna
xaya 10 −=
∑ −−=∑===
n
iii
n
iir xaayeS
1
210
1
2 )(
Least square:
Contoh:
x 1 3 5 7 10 12 13 16 18 20
y 4 2 6 5 8 7 10 9 12 11
n ( i ) x y x2 xy
1 1 4 1 4
2 3 2 9 6
3 5 6 25 30
4 7 5 49 35
5 10 8 100 80
6 12 7 144 84
7 13 10 169 130
8 16 9 256 144
9 18 12 324 216
10 20 11 400 220
Jumlah
105 74 1477 949
a1= {(10 x 949) – (105 x 74)}/{(10 x 1477) – (105)2}= 0,4593.
a0 = 7,4 - (0,4593) x 10,5=2.577
![Page 4: Pengolahan Data - Scilab](https://reader035.vdocuments.pub/reader035/viewer/2022081715/544a1b8baf795959088b45e7/html5/thumbnails/4.jpg)
9/12/2011
4
Perintah Scilab: reglin
[a,b,sigma]= reglin( x,y )
Fungsi: penyelesaian problem regresi linear dengan least square untuk model persamaan: y = a*x + b .
Keterangan: Data x dan y berupa vektor baris.
1 x=[1,3,5,7,10,12,13,16,18,20];
2 y=[4,2,6,5,8,7,10,9,12,11];
3 [a,b]= reglin(x,y)
Regresi polinomial
mmxaxaxaay ++++= ⋯
2210
∑
∑
∑
=
∑∑∑
∑∑∑
∑∑
ii
ii
i
iii
iii
ii
yx
yx
y
a
a
a
xxx
xxx
xxn
22
1
0
432
32
2
A = inv(SGX) . SGXY
![Page 5: Pengolahan Data - Scilab](https://reader035.vdocuments.pub/reader035/viewer/2022081715/544a1b8baf795959088b45e7/html5/thumbnails/5.jpg)
9/12/2011
5
1 function [A]=repolisbs(x,y,pk)
2 [m,n]=size(x);
3 for i=1:(pk+1)
4 for j=1:i
5 k=i+j-2;
6 jml=0;
7 for l=1:n
8 jml=jml+x(1,l)^k;
9 end
10 sgx(i,j)=jml;
11 sgx(j,i)=jml;
12 end
13 jmlxy=0;
14 for l=1:n
15 jmlxy=jmlxy+y(1,l)*x(1,l)^(i-1);
16 end
17 sgxy(i,1)=jmlxy;
18 end
19 A=inv(sgx)*sgxy
20 endfunction
Perintah Scilab: polyPerintah Scilab: poly
poly (a ,’x’, [‘ket’])
Fungsi: Pendefinisian persamaan polinomialDimana:
a = matrik atau bilangan riilx = simbol variabel
‘ket’= berupa opsional dari string dari ‘roots’ atau ‘coeff’defaultnya adalah roots
![Page 6: Pengolahan Data - Scilab](https://reader035.vdocuments.pub/reader035/viewer/2022081715/544a1b8baf795959088b45e7/html5/thumbnails/6.jpg)
9/12/2011
6
Contoh: aplikasi polyContoh: aplikasi poly
-->A=[3 -1 6]A =
3. - 1. 6.-->akr=poly(A,'x','roots')akr =
2 318 + 9x - 8x + x
-->prs=poly(A,'x','coeff')prs =
23 - x + 6x
-->
Perintah Scilab: hornerPerintah Scilab: hornerhorner (P ,x )
Fungsi: Mengevaluasi polinomial/rasionalDimana: P matrik polinomial atau rasional,
x= bilangan riil .
-->A=[3 1 -2]A =
3. 1. - 2.-->p=poly(A,'x','coeff')p =
23 + x - 2x
-->b=horner(p,0)b =
3.-->b=horner(p,1)b =
2.
-->