Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- clear;
- p = rand(1,100)*100
- t = zeros(1,100)
- for i=1:100
- if p(i) < 50
- t(i) = 1;
- else
- t(i) = 2;
- end;
- end;
- t1 = ind2vec(t)
- hold on;
- net = newlvq(minmax(p), 8, [0.5 0.5], 0.02);
- net.trainParam.Epochs = 150;
- net = train(net, p, t1);
- y = vec2ind(sim(net,p))
- figure;
- hold on;
- for i=1:length(y)
- switch y(i)
- case 2, plot(p(i),t(i),'r*')
- case 1, plot(p(i), t(i),'g*')
- end
- end;
- xlabel('Pi');
- ylabel('T');
- title('сеть lvq');
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement