HH方程式(Hodgkin-Huxley Equations)
code:HHmodel.py
# HH: Hodgkin-Huxley (1952) model
C = 1. # 膜容量(membrane capacitance) (uF/cm^2)
# maximum conductances (uS/cm^2)
gna = 120. # sodium
gk = 36. # potassium
gl = 0.3 # leak
# reversal potentials (mV)
Ena = 50. # sodium
Ek = -77. # potassium
El = -54.4 # leak
def hh(y, t, stim=0.):
# state variables: potential and activation/inactivation
v, m, h, n = y
# membrane potential
if callable(stim):
I = stim(t) # time-dependent
else:
I = stim # constant
dv = (gna*m**3*h*(Ena-v) + gk*n**4*(Ek-v) + gl*(El-v) + I)/C
# sodium current activation
am = 0.1*(v+40)/(1-np.exp(-(v+40)/10))
bm = 4*np.exp(-(v+65)/18);
dm = am*(1-m) - bm*m
# sodium current inactivation
ah = 0.07*np.exp(-(v+65)/20)
bh = 1/(1+np.exp(-(v+35)/10))
dh = ah*(1-h) - bh*h
# potassium current activation
an = 0.01*(v+55)/(1-np.exp(-(v+55)/10))
bn = 0.125*np.exp(-(v+65)/80)
dn = an*(1-n) - bn*n