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.
67 lines
1.9 KiB
Matlab
67 lines
1.9 KiB
Matlab
clear
|
|
m=2;
|
|
n=2;
|
|
W=zeros(n,m+n);
|
|
W(1,1)=1;
|
|
W(2,2)=1;
|
|
W(2,3)=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_recurrent(W,x,[],25,V);
|
|
y'
|
|
subplot(1,size(patterns,1),k); plot_network([x;y(1)],W(1:2,1:3),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)
|
|
drawnow;
|
|
end
|
|
set(gcf,'PaperPosition',[0 0 4*k 3.5].*3);
|
|
print -depsc2 rec_drive.eps
|
|
|
|
|
|
|
|
clear
|
|
m=2;
|
|
n=20;
|
|
W=zeros(n,m+n);
|
|
W(1,1)=1;
|
|
W(2,2)=1;
|
|
W(2,3)=1;
|
|
for j=3:n
|
|
W(j,3)=1;
|
|
W(j,j+2)=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];
|
|
figure(2),clf
|
|
for k=1:size(patterns,1)
|
|
x=patterns(k,:)';
|
|
[y,e]=dim_activation_recurrent(W,x,[],25,V);
|
|
[y(1),y(2),y(3),max(y(3:n))]
|
|
subplot(1,size(patterns,1),k); plot_network([x;y(1)],W(1:3,1:3),y(1:3),0,1,[],[],1,0.5);
|
|
plot([0,1],[-3,-4.25],'b--','LineWidth',3.5)
|
|
plot([0,1],[-3,-5.25],'b--','LineWidth',3.5)
|
|
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,-4,-0.5])
|
|
drawnow;
|
|
end
|
|
set(gcf,'PaperPosition',[0 0 4*k 4].*3);
|
|
print -depsc2 rec_mod.eps
|