clear all
P=[0.1 0.7 0.8 0.8 1.0 0.3 0.0 -0.3 -0.5 -1.5;
1.2 1.8 1.6 0.6 0.8 0.5 0.3 0.8 -1.5 -1.3];
T=[1 1 1 0 0 1 1 1 0 0;
0 0 0 0 0 1 1 1 1 1];
[R,Q]=size(P);
[S,Q]=size(T);
net=newp(minmax(P),S);
net.inputweights{1,1}.initFcn='rands';
net.biases{1}.initFcn='rands';
net=init(net);
W=net.iw{1,1}
B=net.b{1}
net.trainParam.epochs=20;
net.trainParam.show=1;
[net,tr]=train(net,P,T);
epoch=tr.epoch
perf=tr.perf
V=[-2 2 -2 2];
plotpv(P,T,V);
axis('equal');
title('input vector graph');
xlabel('P1');
ylabel('P2');
plotpc(net.iw{1,1},net.b{1});
评论0