%the right hand side for ode simulation:
function s_prime=deRHS(t,s)
global topen tclose gna gk vh vna vk kh Inp BCL

V = s(1);
W = s(2);

Input = Inp/cosh(mod(t,BCL)-BCL/4);


minf = max(0,V);
finf = 0.5*(1.+tanh((V-vh)/kh));
   hinf = 1-finf;
   tauh = topen+(tclose-topen)*finf;
   Fv = gna*W.*max(0,V).^2.*(vna-V) +gk*(vk-V);
   Fw = (hinf-W)./tauh;

s_prime = [Fv+Input Fw]';
