You cannot select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
97 lines
2.7 KiB
Matlab
97 lines
2.7 KiB
Matlab
clear
|
|
m=2;
|
|
n=1;
|
|
W=zeros(n,m);
|
|
W(1,1:2)=1;
|
|
W=bsxfun(@rdivide,W,(1e-9+sum(W,2)));
|
|
V=bsxfun(@rdivide,W,(1e-9+max(W,[],2)));
|
|
|
|
patterns=[1,0
|
|
0,1
|
|
1,1];
|
|
|
|
figure(1),clf
|
|
for k=1:size(patterns,1)
|
|
x=patterns(k,:)';
|
|
[y,e]=dim_activation(W,x,[],25,V);
|
|
subplot(1,size(patterns,1),k); plot_network(x,W,y,0,1,[],[],1);
|
|
plot([-0.35,0.35,0.35,-0.35,-0.35],[-m-0.5,-m-0.5,-0.5,-0.5,-m-0.5],'k-','LineWidth',2)
|
|
text(0,-0.5,'x','FontWeight','b','HorizontalAlignment','center','VerticalAlignment','bottom','FontSize',32)
|
|
%plot(1+[-0.3,0.3,0.3,-0.3,-0.3],[-3.5,-3.5,-0,-0,-3.5],'k-','LineWidth',2)
|
|
text(1,-0.5,'y','FontWeight','b','HorizontalAlignment','center','VerticalAlignment','bottom','FontSize',32)
|
|
axis([-0.5,1.5,-3.5,-0.5])
|
|
drawnow;
|
|
end
|
|
set(gcf,'PaperPosition',[0 0 4*k 3.5].*3);
|
|
print -depsc2 ff_drive.eps
|
|
|
|
|
|
clear
|
|
m=21;
|
|
n=m-1;
|
|
W=zeros(n,m);
|
|
W(1,1:2)=1;
|
|
for j=2:n
|
|
W(j,1)=1;
|
|
W(j,j+1)=1;
|
|
end
|
|
W=bsxfun(@rdivide,W,(1e-9+sum(W,2)));
|
|
V=bsxfun(@rdivide,W,(1e-9+max(W,[],2)));
|
|
|
|
patterns=zeros(3,m);
|
|
patterns(:,1:2)=[1,0
|
|
0,1
|
|
1,1];
|
|
m=3;
|
|
figure(2),clf
|
|
for k=1:size(patterns,1)
|
|
x=patterns(k,:)';
|
|
[y,e]=dim_activation(W,x,[],25,V);
|
|
sum(y)
|
|
subplot(1,size(patterns,1),k); plot_network(x(1:3),W(1:2,:),y(1:2),0,1,[],[],1,0);
|
|
%[y(1),y(2),max(y(3:n))]
|
|
plot([0,1],[-1,-4],'b--','LineWidth',3.5)
|
|
plot([0,1],[-1,-6],'b--','LineWidth',3.5)
|
|
plot([0.35,0.35,-0.35,-0.35],[-m-0.5,-0.5,-0.5,-m-0.5],'k-','LineWidth',2)
|
|
text(0,-0.5,'x','FontWeight','b','HorizontalAlignment','center','VerticalAlignment','bottom','FontSize',32)
|
|
%plot(1+[-0.3,0.3,0.3,-0.3,-0.3],[-3.5,-3.5,-0,-0,-3.5],'k-','LineWidth',2)
|
|
text(1,-0.5,'y','FontWeight','b','HorizontalAlignment','center','VerticalAlignment','bottom','FontSize',32)
|
|
|
|
drawnow;
|
|
axis([-0.5,1.5,-3.5,-0.5])
|
|
end
|
|
set(gcf,'PaperPosition',[0 0 4*k 3.5].*3);
|
|
print -depsc2 ff_mod.eps
|
|
|
|
|
|
|
|
|
|
clear
|
|
m=3;
|
|
n=2;
|
|
W=zeros(n,m);
|
|
W(1,2)=1;
|
|
W(2,2)=1;
|
|
W(2,1)=1;
|
|
W=bsxfun(@rdivide,W,(1e-9+sum(W,2)));
|
|
V=bsxfun(@rdivide,W,(1e-9+max(W,[],2)));
|
|
patterns=zeros(3,m);
|
|
patterns(:,1:2)=[1,0,
|
|
0,1,
|
|
1,1];
|
|
figure(3),clf
|
|
for k=1:size(patterns,1)
|
|
x=patterns(k,:)';
|
|
[y,e]=dim_activation(W,x,[],25,V);
|
|
subplot(1,size(patterns,1),k); plot_network(x,W,y,0,1,[],[],1);
|
|
plot([-0.35,0.35,0.35,-0.35,-0.35],[-m-0.5,-m-0.5,-0.5,-0.5,-m-0.5],'k-','LineWidth',2)
|
|
text(0,-0.5,'x','FontWeight','b','HorizontalAlignment','center','VerticalAlignment','bottom','FontSize',32)
|
|
%plot(1+[-0.3,0.3,0.3,-0.3,-0.3],[-3.5,-3.5,-0,-0,-3.5],'k-','LineWidth',2)
|
|
text(1,-0.5,'y','FontWeight','b','HorizontalAlignment','center','VerticalAlignment','bottom','FontSize',32)
|
|
axis([-0.5,1.5,-3.5,-0.5])
|
|
drawnow;
|
|
end
|
|
set(gcf,'PaperPosition',[0 0 4*k 3.5].*3);
|
|
print -depsc2 ff_comp.eps
|
|
|