###########################################################
#            Space Clamped	 Hodgkin-Huxley model. 
###########################################################
#
#
###########################################################
#            Problem definition
###########################################################
#
#       parameter values defining model
#
p gk=36,gna=120,gl=0.3,cm=20
p vk=-12,vna=115,vl=10.6
#
#       parameters defining applied currents
#       and other numerical experiments
#
p ia1=2000,t1=5,dt1=0.2
p ia2=0,t2=7,dt2=0.2
p xm=1,xn=1,xh=1
#
#       function definitions
#
am(v)=0.1*(25-v)/(exp((25-v)/10)-1)
bm(v)=4*exp(-v/18)
ah(v)=0.07*exp(-v/20)
bh(v)=1/(exp((30-v)/10)+1)
an(v)=0.01*(10-v)/(exp((10-v)/10)-1)
bn(v)=0.125*exp(-v/80)
#
# Applied (depolarizing) current pulse function. i(amp,t0,t1)
# provides a constant current of amplitude "amp" starting at
# time t0 and of duration dt
#
i(amp,t0,dt)=amp*(heav(t-t0)-heav(t-t0-dt))
#
#
ik=gk*n^4*(v-vk)
ina=gna*m^3*h*(v-vna)
il=gl*(v-vl)
ia=i(ia1,t1,dt1)+i(ia2,t2,dt2)
#
#      differential equations
#
v'=(-ik-ina-il+ia)/cm
m'=(am(v)*(1-m)-bm(v)*m)*xm
n'=(an(v)*(1-n)-bn(v)*n)*xn
h'=(ah(v)*(1-h)-bh(v)*h)*xh
#
aux IK=ik
aux INA=ina
aux IL=il
aux IA=ia
aux IAX=ia/40
#
#
#      initial conditions (optional)
#
v(0)=0
n(0)=0.317680
m(0)=0.052934
h(0)=0.596110
#
@ total=40,xhi=40,ylo=-10,yhi=100,dt=0.1,maxstor=10000
@ bounds=10000
#
d

