function I = sqw(t)
global A T ex I_0
r=mod(t,T);
I = -.6*A*(r<T*(ex/100))+I_0/2;