% pattern trainning data generation
[X,Y] = meshgrid(0:.05:1, 0:.05:1);
figure;
hold on;
for i=1:21
for j=1:21
if (X(i,j)
Z(i,j)=1;
plot(X(i,j),Y(i,j),'ro');
else
Z(i,j)=0;
plot(X(i,j),Y(i,j),'bo');
end
end
end
% network trainning, please use the X,Y axis data as inputs and the color Z
% as targets, train a network with name "net"
%test data
points=rand(2,100);
colors=net(points);
%check whether colors are correct.
figure
hold on
for i=1:100
if (colors(i)>0.5)
plot(points(1,i),points(2,i),'ro');
else
plot(points(1,i),points(2,i),'bo');
end
end