%modular (subdivided) ANN

nn_mod=1000;
n_mod=2;
nn=nn_mod*n_mod;

pat=2*floor(2*rand(nn,10))-1;             % Random binary pattern
w=pat*pat';                                % Hebbian learning
s=rand(nn,1)-0.5;                         % Initialize network
for t=2:10; s(:,t)=sign(w*s(:,t-1)); end   % Update network
plot(s'*pat/nn)
