% Called by bump.m

  while 1
    t = t+1;

    External = get(gcf,'UserData');
    VE = gammaE + wEE*SE + wEI*SI + External + Bias;
    FE = (1 + tanh(VE))/2;
    deltaSE = (-SE+FE) * (deltaT/tauE);

    VI = gammaI + wIE*sum(SE) + wII*SI;
    FI = (1 + tanh(VI))/2;
    deltaSI = (-SI+FI)*deltaT/tauI;

    SE = SE + deltaSE;
    SI = SI + deltaSI;

    External = External * DecayRate;
    set(gcf,'UserData',External);

    if 1 % ~rem(t,10)
     cla
     h=plot(FE);
     plot(External,'r')
     axis([0 length(SE) 0 1])
     set(h,'ButtonDownFcn','clickhandler(W)')
     cospeak = sum(coscoords .* FE) / sum(FE);
     sinpeak = sum(sincoords .* FE) / sum(FE);
     peakpos = (atan2(sinpeak,cospeak)+pi)/(2*pi)*NEUNITS;
     peakval = max(FE);
     title(sprintf(...
       'Iteration %4d:  Peak %5.3f at %6.2f   (Bias %4.2f)  Width=%2d', ...
	t,peakval,peakpos,Bias,sum(FE>0.15)))
     xlabel('Mouse on the bump to make it move.')
     drawnow
    end

  end
