You are on page 1of 3

Nama : Rendra Saputra NIM E4.

7 : 0904405008

The vectors in the ordered set defined below were obtained by measuring the weight and ear lengths of toy rabbits and bears in the Fuzzy Wuzzy Animal Factory. The target values indicate whether the respective input vector was taken from a rabbit (0) or a bear

(1). The first element of the input vector is the weight of the toy, and the second ear length.

element is the

i.

Use MATLAB to initialize and train a network to solve this practical problem.

ii. Use MATLAB to test the resulting weight and bias values against the input vectors. iii. Alter the input vectors to ensure that the decision boundary of any solution will not intersect one of the original input vectors (i.e., to ensure only robust solutions are found). Then retrain the network.

Sintaks:
p1=[1;4]; p2=[1;5]; p3=[2;4]; p4=[2;5]; p5=[3;1]; p6=[3;2]; p7=[4;1]; p8=[4;2]; t1=1; t2=0; t3=0; t4=0; t5=1;

t6=1; t7=1; t8=1; plot(1,4,1,5,2,4,2,5,3,1,3,2,4,1,4,2,[0 3.6],'MarkerFaceColor',[1 0 4],[5 2.5],[1.6 2.15],[2 0

0],'MarkerEdgeColor',[1

0],'Marker','square','LineWidth',2,'Color',[1 0 0]);

w=[2 3.2] p=[0;5]; b=-w*p true=0; iterasi=0; while true==0 iterasi=iterasi+1 a1 = hardlim(w*p1+b) e1=t1-a1; w=w+transpose(e1*p1) b=b+e1 a2 = hardlim(w*p2+b) e2=t2-a2; w=w+transpose(e2*p2) b=b+e2 a3 = hardlim(w*p3+b) e3=t3-a3; w=w+transpose(e3*p3) b=b+e3 a4 = hardlim(w*p4+b) e4=t4-a4; w=w+transpose(e4*p4) b=b+e4 a5 = hardlim(w*p5+b) e5=t5-a5; w=w+transpose(e5*p5) b=b+e5 a6 = hardlim(w*p6+b) e6=t6-a6;

w=w+transpose(e6*p6) b=b+e6 a7 = hardlim(w*p7+b) e7=t7-a7; w=w+transpose(e7*p7); b=b+e7 a8 = hardlim(w*p8+b) e8=t8-a8; w=w+transpose(e8*p8) b=b+e8; if e1==0 && e2==0 && e3==0 && e4==0 && e5==0 && e6==0 && e7==0 && e8==0 true=1; break; end; end; disp ('Maka'); w=w' b

You might also like