Professional Documents
Culture Documents
Oleh :
PADANG ADIGUNA
10106343
X1 X2 Target
0 0 0
0 1 1
1 0 1
1 1 0
Source Code :
function perceptron;
clc
net = newp([0 1 ; 0 1],1);
net.IW {1,1} = [0 0];
net.b {1} = [1];
p = [ [0 ; 0] [0 ; 1] [1 ; 0] [1 ; 1] ];
t = [0 1 1 0];
e = 999;
i = 1;
while e >0
disp('iterasi : ');
i
i=i+1;
net.trainParam.epochs=1;
net = train(net,p,t);
bobot = net.IW {1,1}
bias = net.b {1}
a = sim (net,p)
e = sum (t-a)
end
KeluaranProgram :
iterasi :
i=
bobot =
-1 -1
bias =
-1
a=
0 0 0 0
e=
iterasi :
i=
bobot =
-1 -1
bias =
a=
1 0 0 0
e=
iterasi :
i=
bobot =
-1 -1
bias =
a=
1 0 0 0
e=
1
Program akanterus looping..
Tampilan:
Kesimpulan :