 function w = hebb(nn,sig)
 % self organization of symmetric cann interactions
    lrate=1;     % learning rate
    w=zeros(nn);
    %%%%%%% learning session
    for loc=1:nn;
       r=in_signal_pbc(loc,1,sig,nn);
       dw=lrate.*r*r';
       w=w+dw;
    end
 return
