P=2*rand(2,1000)-1; figure(1) plot(P(1,:),P(2,:),'.') title('Original data'); net=newsom(minmax(P),[30,1]); net.trainParam.epochs=10; net=train(net,P); hold on plotsom(net.iw{1,1},net.layers{1}.distances) % Uncomment the next line if you also want to see the voronoi cells %voronoi(net.iw{1,1}(:,1),net.iw{1,1}(:,2)); hold off