 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
 % recurrent network model with a mixture of symmetric and
 % antisymmetric weights of unit absolute or random components
 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
 clear; nodes=251; dt=.1 ;  tend=100; y=zeros(1,tend/dt+1);

 wa=randn(nodes); ws=randn(nodes);  %random
 %wa=ones(nodes); ws=ones(nodes);     %unit
 for i=2:nodes; for j=1:i; wa(i,j)=-wa(j,i); end; end
 for i=2:nodes; for j=1:i; ws(i,j)=ws(j,i); end; end
 for i=1:nodes; wa(i,i)=0; ws(i,i)=0; end

 for a1=1:41;
   a=(a1-21)*.5;
   for b1=1:41;
     b=(b1-21)*.5; disp([a,b]);
     w=a*ws+b*wa;

     %update
     u=2*rand(nodes,1)-1;
     irec=1; x(irec)=0; y(irec)=norm(u);
     for t=dt:dt:tend;
        s=tanh(u);
        u=(1-dt)*u+dt*w*s;
        irec=irec+1;
        x(irec)=t;
        y(irec)=norm(u);
     end %loop over time steps

     xa(a1)=a; xb(b1)=b;
     u_dif(a1,b1)=abs(y(irec)-y(irec-1));
   end %xa
 end %xb
