function I = sqw(t)
global i1 A T ex 
r=mod(t,T);
I = i1*A*(r<T*(ex/100)); % i1 -- spike threshold, |A|>1 iff activation spike.