You are on page 1of 1

Laporan Sementara Unit 3

Yosef Brian Yudhalaksana 13/348204/TK/40821


B. Regresi Polinomial
A. Regresi Linear
-->x=[36.9 46.7 63.7 77.8 84.0 87.5]
x =
36.9 46.7 63.7 77.8 84. 87.5
-->y=[181 197 235 270 283 292]
y =
181. 197. 235. 270. 283.
-->X=[ones(x);x]
X =
1.
1.
1.
1.
1.
36.9 46.7 63.7 77.8
-->A=X*X'
A =
6.
396.6
396.6 28365.28
-->B=X*y'
B =
1458.
101176.3
-->a=A\B
a =
95.35242
2.2337002
-->xa=35:0.1:90
-->ya=a'*[ones(xa);xa];
-->plot(x,y,'o',xa,ya,'-r')

1.
84.

--> X=[ones(x);x;x.^2]
X =
1.
1.
1.
1.
1.
1.
36.9
46.7
63.7
77.8
84.
87.5
1361.61 2180.89 4057.69 6052.84 7056.
7656.25

292.

87.5

-->A=X*X'
A =
6.
396.6
28365.28
396.6
28365.28 2144102.7
28365.28 2144102.7 1.681D+08
-->B=X*y'
B =
1458.
101176.3
7496383.7
-->a=inv(A)*B
a =
121.69088
1.3042131
0.0074247
-->xa=35:0.1:90
-->ya=a'*[ones(xa);xa;xa.^2]
-->plot(x,y,'og',xa,ya,'-b')

You might also like