function xprime = Scircuit(t,x)
global C E i1 A eps 
xprime=zeros(2,1);
V_C=x(1);I_g=x(2);
I_in=i1*A;
%
% choose one of the following to simulate
%
xprime(1)=-(I_g+I_in)/C; %  i1 -- spike threshold, A>1 iff activation spike.
%xprime(1)=-(I_g+Iin(t))/C; % sinusoid input 
%xprime(1)=-(I_g+sqw(t))/C; % square wave input
xprime(2)=(V_C-E-S(I_g))/eps;