%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%%%%% 5-layer Neural Network Test
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%%%%%%%%%%%%% Draw Network
clf;
Y0=0;
Y1=1;
Y2=2;
H0=N;
H1=H;
H2=M;
hold on;
prp=zeros(1,H0+H1+H2);
py(1)=Y1;
py(2)=Y0;
for i=1:1:H1
px(1)=(M/H1)*(i-0.5);
for j=1:1:H2
px(2)=(M/H2)*(j-0.5);
bold=floor(sqrt(abs(w(i,j)))+0.9);
if(bold>0)
if(w(i,j)>0)
plot(px,py,'r-','Linewidth',bold);
else
plot(px,py,'b-','Linewidth',bold);
end
end
end
prp(i)=plot(px(1),Y1,'ko');
end
py(1)=Y2;
py(2)=Y1;
for i=1:1:H0
px(1)=(M/H0)*(i-0.5);
for j=1:1:H1
px(2)=(M/H1)*(j-0.5);
bold=floor(sqrt(abs(u(i,j)))+0.9);
if(bold>0)
if(u(i,j)>0)
plot(px,py,'r-','Linewidth',bold);
else
plot(px,py,'b-','Linewidth',bold);
end
end
end
prp(H1+i)=plot(px(1),Y2,'ko');
end
for i=1:1:M
px(1)=(i-0.5);
prp(H0+H1+i)=plot(px(1),Y0,'ko');
end
axis off;
set(prp,'Color', [0,0,0], 'MarkerFaceColor', [1,1,1],'MarkerSize',8, 'LineWidth', 2);
hold off;
drawnow;