% trenovaci mnozina ... vstupy:
P = [-3 -2 -2 0 0 0 0 2 2 3; 0 1 -1 2 1 -1 -2 1 -1 0];
% pozadovane vystupy
Tc = [1 1 1 2 2 2 2 1 1 1];
T = ind2vec(Tc); % ridka matice s 0 / 1
targets = full(T); % obycejna matice s 0 / 1

% vytvoreni LVQ-modelu
net = newlvq(P,4,[.6 .4]);
%net = newlvq(P,4,[.6 .4],0.01,'learnlv2'); % 4 reprezentanti

% matice vah 
net.IW{1,1}
net.LW{2,1}

% nauceni site
net.trainParam.epochs = 150;
vnet = train(net,P);

% pouziti site
Y = sim(vnet,P);
Yc = vec2ind(Y)

% vykresleni
plotvec(P,Tc);
hold on;
plotvec(vnet.IW{1}',vec2ind(vnet.LW{2}),'o');
hold off;

