the basic hodgkin-huxley model project -...

29
The Basic Hodgkin-Huxley Model Project Dr. Peterson This is your project for this modeling class. This is due Friday December 4, 2009. Let’s recall the standard setup of our cable model. The salient variables needed to describe what is happening inside and outside the cellular membrane and to some extent, inside the membrane are V 0 m is the rest value of the membrane potential. K 0 m is the rest value of the membrane current per length density. K 0 e is the rest value of the externally applied current per length density. I 0 i is the rest value of the inner current. I 0 o is the rest value of the inner current. V 0 i is the rest value of the inner voltage. V 0 o is the rest value of the inner voltage. r i is the resistance of the inner fluid of the cable. r o is the resistance of the outer fluid surrounding the cable. g m is the membrane conductance per unit length. c m is the membrane capacitance per unit length. The membrane voltage can be shown to satisfy the partial differential equation 1 2 V m ∂z 2 = (r i + r o )K m - r o K e (1) In the standard core conductor model, the membrane is not modeled at all. We will think more carefully about the membrane boxes shown in Figure 1. Figure 2: The RC Membrane Model We will replace our empty membrane box by a paral- lel circuit model. Now this box is really a chunk of mem- brane that is Δz wide. In the first cable model, we assume our membrane has a constant resistance and capacitance. We know that conductance is reciprocal resistance, so our model will consist to a two branch circuit: one branch is contains a capacitor and the other, the conductance ele- ment. We will let c m denote the membrane capacitance density per unit length (measured in fahrad cm ). Hence, in our membrane box, the since the box is Δz wide, we see the value of capacitance should be c m Δz . Similarly, we let g m be the conductance per unit length (measured in 1 ohm-cm ) for the membrane. The amount of conductance 1

Upload: ngodang

Post on 16-Feb-2018

218 views

Category:

Documents


1 download

TRANSCRIPT

Page 1: The Basic Hodgkin-Huxley Model Project - Clemsoncecas.clemson.edu/~petersj/Courses/M390/Project/Project.pdf · The Basic Hodgkin-Huxley Model Project Dr. Peterson This is your project

The Basic Hodgkin-Huxley Model Project

Dr. Peterson

This is your project for this modeling class. This is due Friday December 4, 2009.Let’s recall the standard setup of our cable model. The salient variables needed to describe what is

happening inside and outside the cellular membrane and to some extent, inside the membrane are

• V 0m is the rest value of the membrane potential.

• K0m is the rest value of the membrane current per length density.

• K0e is the rest value of the externally applied current per length density.

• I0i is the rest value of the inner current.

• I0o is the rest value of the inner current.

• V 0i is the rest value of the inner voltage.

• V 0o is the rest value of the inner voltage.

• ri is the resistance of the inner fluid of the cable.

• ro is the resistance of the outer fluid surrounding the cable.

• gm is the membrane conductance per unit length.

• cm is the membrane capacitance per unit length.

The membrane voltage can be shown to satisfy the partial differential equation 1

∂2Vm∂z2

= (ri + ro)Km − roKe (1)

In the standard core conductor model, the membrane is not modeled at all. We will think more carefullyabout the membrane boxes shown in Figure 1.

Figure 2: The RC Membrane Model

We will replace our empty membrane box by a paral-lel circuit model. Now this box is really a chunk of mem-brane that is ∆z wide. In the first cable model, we assumeour membrane has a constant resistance and capacitance.We know that conductance is reciprocal resistance, so ourmodel will consist to a two branch circuit: one branch iscontains a capacitor and the other, the conductance ele-ment. We will let cm denote the membrane capacitancedensity per unit length (measured in fahrad

cm ). Hence, inour membrane box, the since the box is ∆z wide, we seethe value of capacitance should be cm∆z. Similarly, welet gm be the conductance per unit length (measured in

1ohm−cm) for the membrane. The amount of conductance

1

Page 2: The Basic Hodgkin-Huxley Model Project - Clemsoncecas.clemson.edu/~petersj/Courses/M390/Project/Project.pdf · The Basic Hodgkin-Huxley Model Project Dr. Peterson This is your project

a b

d c

Membrane Membrane

ri∆z Ω ri∆z Ω ri∆z Ω

ro∆z Ω ro∆z Ω ro∆z Ω

Vi(z, t) Vi(z + ∆z, t)Ii(z, t) Ii(z + ∆z, t)

Vm(z, t) Vm(z + ∆z, t)

Vo(z, t) Vo(z + ∆z, t)

Io(z, t) Io(z + ∆z, t)

Km(z, t) ∆z Km(z + ∆z, t) ∆z

Ke(z, t) ∆z Ke(z + ∆z, t) ∆z

Figure 1: The Equivalent Electrical Network Model

for the box element is thus gm∆z. In Figure 2, we illus-trate our new membrane model. Since this is a resistance

- capacitance parallel circuit, it is traditional to call this an RC membrane model.In Figure 2, the current going into the element is Km(z, t)∆z and we draw the rest voltage for the membraneas a battery of value V 0

m. We know that the membrane current, Km, satisfies Equation 2:

Km(z, t) = gm Vm(z, t) + cm∂Vm∂t

(2)

In terms of membrane current densities, all of the above details come from modeling the simple equation

Km = Kc + Kion

where Km is the membrane current density, Kc is the current through the capacitative side of the circuitand Kion is the current that flows through the side of the circuit that is modeled by the conductance term,gm. We see that in this model

Kc = cm∂Vm∂t

Kion = gm Vm

However, we can come up with a more realistic model of how the membrane activity contributes to themembrane voltage by adding models of ion flow controlled by gates in the membrane. We have not donethis before. In this chapter, and subsequent ones, we will study intensely increasingly more sophisticatedversions that model the membrane gates as well as diffusion processes inside the cell that contribute to ionflow across the membrane. Our models will initially be based on work that Hodgkin and Huxley performedin the 1950’s.

2

Page 3: The Basic Hodgkin-Huxley Model Project - Clemsoncecas.clemson.edu/~petersj/Courses/M390/Project/Project.pdf · The Basic Hodgkin-Huxley Model Project Dr. Peterson This is your project

Figure 3: The Membrane and Gate Circuit Model

1 Adding Ion Membrane Currents

We start by expanding our membrane model to handle potassium, sodium and a all purpose current, calledleakage current, using a modification of our original simple electrical circuit model of the membrane. Wewill think of a gate in the membrane as having an intrinsic resistance and the cell membrane itself ashaving an intrinsic capacitance as shown in Figure 3:Thus, we expand the single branch of our old circuit model to multiple branches – one for each ion flowwe wish to model. The ionic current consists of the portions due to potassium, Kk, sodium, KNa andleakage KL. The leakage current is due to all other sources of ion flow across the membrane which are notbeing’ explicitly modeled. This would include ion pumps; gates for other ions such as Calcium, Chlorine;neurotransmitter activated gates and so forth. We will assume that the leakage current is chosen so thatthere is no excitable neural activity at equilibrium.

The standard Hodgkin - Huxley model of an excitatory neuron then consists of the equation for thetotal membrane current, KM , obtained from Ohm’s law:

Km = cm∂Vm∂t

+ KK + KNa + KL (3)

The new equation for the membrane voltage is thus

∂2Vm∂z2

= (ri + ro)Km − ro Ke

= (ri + ro) cm∂Vm∂t

+ (ri + ro)KK + (ri + ro)KNa + (ri + ro)KL − roke

which can be simplified to what is seen in Equation 5:

1

ri + ro

∂2Vm∂z2

= Km − rori + ro

Ke (4)

= cm∂Vm∂t

+ KK + KNa + KL − rori + ro

Ke (5)

2 The Hodgkin - Huxley Gates

In Figure 4, we show an idealized cell with a small portion of the membrane blown up into an idealizedcircuit. We see a small piece of the lipid membrane with an inserted gate. We think of the gate as havingsome intrinsic resistance and capacitance. Now for our simple Hodgkin - Huxley model here, we want tomodel a sodium and potassium gate as well as the cell capacitance. So we will have a resistance for boththe sodium and potassium. In addition, we know that other ions move across the membrane due to pumps,

3

Page 4: The Basic Hodgkin-Huxley Model Project - Clemsoncecas.clemson.edu/~petersj/Courses/M390/Project/Project.pdf · The Basic Hodgkin-Huxley Model Project Dr. Peterson This is your project

other gates and so forth. We will temporarily model this additional ion current as a leakage current withits own resistance. We also know that each ion has its own equilibrium potential which is determined byapplying the Nernst equation. The driving electomotive force or driving emf is the difference betweenthe ion equilibrium potential and the voltage across the membrane itself. Hence, if Ec is the equilibriumpotential due to ion c and Vm is the membrane potential, the driving force is Vc − Vm. In Figure 4, wesee an electric schematic that summarizes what we have just said. We model the membrane as a parallelcircuit with a branch for the sodium and potassium ion, a branch for the leakage current and a branch forthe membrane capacitance.

Figure 4: The Simple Hodgkin - Huxley Membrane Circuit Model

From circuit theory, we know that the charge q across a capacitator is q = CE, where C is the capacitanceand E is the voltage across the capicitor. Hence, if the capacitance C is a constant, we see that the currentthrough the capacitor is given by the time rate of change of the charge

dq

dt= C

dE

dt

If the voltage E was also space dependent, then we would write E(z, t) to indicate its dependence on botha space variable z and the time t. Then the capacitive current would be

dq

dt= C

∂E

∂t

From Ohm’s law, we know that voltage is current times resistance; hence for each ion c, we can say

Vc = Ic Rc

where we label the voltage, current and resistance due to this ion with the subscript c. This implies

Ic =1

RcVc

= Gc Ic

where Gc is the reciprocal resistance or conductance of ion c. Hence, we can model all of our ionic currentsusing a conductance equation of the form above. Of course, the potassium and sodium conductances arenonlinear functions of the membrane voltage V and time t. This reflects the fact that the amount of

4

Page 5: The Basic Hodgkin-Huxley Model Project - Clemsoncecas.clemson.edu/~petersj/Courses/M390/Project/Project.pdf · The Basic Hodgkin-Huxley Model Project Dr. Peterson This is your project

current that flows through the membrane for these ions is dependent on the voltage differential across themembrane which in turn is also time dependent. The general functional form for an ion c is thus

Ic = Gc(V, t)(V (t) − Ec(t))

where as we mentioned previously, the driving force, V − Ec, is the difference between the voltageacross the membrane and the equilibrium value for the ion in question, Ec. Note, the ion battery voltageEc itself might also change in time (for example, extracellular potassium concentration changes over time). Hence, the driving force is time dependent. The conductance is modeled as the product of a activation,m, and an inactivation, h, term that are essentially sigmoid nonlinearities. The activation and inactivationare functions of V and t also. The conductance is assumed to have the form

Gc(V, t) = G0mp(V, t) hq(V, t)

where appropriate powers of p and q are found to match known data for a given ion conductance.We model the leakage current, IL, as

IL = gL (V (t) − EL)

where the leakage battery voltage, EL, and the conductance gL are constants that are data driven.Hence, in terms of current densities, letting gK , gNa and gL respectively denote the ion conductances perlength, our full model would be

KK = gK(V − EK)

KNA = gNa(V − ENa)

KL = gL(V − EL)

We know the membrane voltage satisfies:

1

ri + ro

∂2Vm∂z2

= cm∂Vm∂t

+ KK + KNa + KL − rori + ro

Ke

We can rewrite this as

1

ri + ro

∂2Vm∂z2

= cm∂Vm∂t

+ gK(Vm − EK) + gNa(Vm − ENa) + gL(Vm − EL) − rori + ro

Ke

2.1 Activation and Inactivation Variables:

We assume that the voltage dependence of our activation and inactivation has been fitted from data.Hodgkin and Huxley modeled the time dependence of these variables using first order kinetics. Theyassumed a typical variable of this type, say Φ, satisfies for each value of voltage, V :

dΦ(V )

dt= αΦ(V ) (1 − Φ(V )) − βΦ(V ) Φ(V )

Φ(V, 0) = Φ0(V )

For convenience of exposition, we usually drop the functional dependence of Φ on V and just write:

5

Page 6: The Basic Hodgkin-Huxley Model Project - Clemsoncecas.clemson.edu/~petersj/Courses/M390/Project/Project.pdf · The Basic Hodgkin-Huxley Model Project Dr. Peterson This is your project

dt= αΦ (1 − Φ) − βΦ Φ

Φ(0) = Φ0

Rewriting, we see

1

αΦ + βΦ

dt=

αΦ

αΦ + βΦ− Φ

Φ(0) = Φ0

We let

τΦ =1

αΦ + βΦ

Φ∞ =αΦ

αΦ + βΦ

allowing us to rewrite our rate equation as

τΦdΦ

dt= Φ∞ − Φ

Φ(0) = Φ0

3 The Voltage Clamped Protocol

Under certain experimental conditions, we can force the membrane voltage to be independent of the spacialvariable z. In this case, we find

∂2Vm∂z2

= 0

which allows us to rewrite Equation 6 as follows

cmdVmdt

+ KK + KNa + KL − rori + ro

Ke = 0 (6)

The replacement of the partial derivatives with a normal derivative reflects the fact that in the voltageclamped protocol, the membrane voltage depends only on the one variable, time t. Since, cm is capacitanceper unit length, the above equation can also be interpreted in terms of capacitance, Cm, and currents, IK ,INa, IL and an external type current Ie. This leads to Equation 7

CmdVmdt

+ IK + INa + IL − rori + ro

Ie = 0 (7)

Finally, if we label as external current, Ie, the term

IE =ro

ri + roIe,

the equation we need to solve under the voltage clamped protocol becomes Equation 8.

dVmdt

=1

CM(IK + INa + IL − IE) (8)

6

Page 7: The Basic Hodgkin-Huxley Model Project - Clemsoncecas.clemson.edu/~petersj/Courses/M390/Project/Project.pdf · The Basic Hodgkin-Huxley Model Project Dr. Peterson This is your project

4 The Hodgkin-Huxley Sodium and Potassium Model

Hodgkin and Huxley modeled the sodium and potassium gates as

gNa(V ) = gMaxNa MNA

3(V ) HNA(V )

gK(V ) = gMaxK MK

4(V )

where the two activation variables, MNA and MK , and the one inactivation variable, HNA, all satisfy thefirst order Φ kinetics as we have discussed. Hence, we know

M ′NA(t) = (MNA)∞ − MNA

H ′NA(t) = (HNA)∞ − HNA

M ′K(t) = (MK)∞ − MK

with

τMNA=

1

αMNA+ βMNA

(MNA)∞ =αMNA

αMNA+ βMNA

τHNA=

1

αHNA+ βHNA

(HNA)∞ =αHNA

αHNA+ βHNA

τMK=

1

αMK+ βMK

(MK)∞ =αMK

αMK+ βMK

Further, the coefficient functions, α and β for each variable required data fits as functions of voltage. Thesewere determined to be

αMNA= −0.10

V + 35.0

e−.1 (V+35.0) − 1.0

βMNA= 4.0 e

−(V +60.018.0

αHNA= 0.07 e−.05 (V+60.0) (9)

βHNA=

1.0

(1.0 + e−.1 (V+30.0))

αMK= − 0.01 ∗ (V + 50.0)

(e−.1(V+50.0) − 1.0)

βMK= 0.125 e−0.0125 (V+60.0)

Of course these data fits were obtained at a certain temperature and assumed values for all the otherconstants needed. These other parameters are given in the units below

voltage mV milli volts 10−3 Voltscurrent na nano amps 10−9 Ampstime ms milli seconds 10−3 Secondsconcentration mM milli moles 10−3 Molesconductance µ S micro Siemens 10−6 ohms−1

capacitance nF nano Fahrads 10−9 Fahrads

7

Page 8: The Basic Hodgkin-Huxley Model Project - Clemsoncecas.clemson.edu/~petersj/Courses/M390/Project/Project.pdf · The Basic Hodgkin-Huxley Model Project Dr. Peterson This is your project

Our model of the membrane dynamics here thus consists of the following differential equations:

τMNA

dMNA

dt= (MNA)∞ − MNA

τHNA

dHNA

dt= (HNA)∞ − HNA

τMK

dMK

dt= (MK)∞ − MK

dV

dt=

IM − IK − INa − ILCM

with initial conditions

MNA(0) = (MNA)∞(V0, 0)

HNA(0) = (HNA)∞(V0, 0)

MK(0) = (MK)∞(V0, 0)

V (0) = V0

We note that at equilibrium there is no current across the membrane. Hence, the sodium and potassiumcurrents are zero and the activation and inactivation variables should achieve their steady state valueswhich would be m∞, h∞ and n∞ computed at the equilibrium membrane potential which is here denotedby V0.

4.1 Encoding The Dynamics

Now these dynamics are more difficult to solve than you might think. The sequence of steps is this:

• Given the time t and voltage V compute

αMNA= −0.10

V + 35.0

e−.1 (V+35.0) − 1.0

βMNA= 4.0 e

−(V +60.0)18.0

αHNA= 0.07 e−.05 (V+60.0)

βHNA=

1.0

(1.0 + e−.1 (V+30.0)

αMK= − 0.01 ∗ (V + 50.0)

(e−.1(V+50.0) − 1.0)

βMK= 0.125 e−0.0125 (V+60.0)

8

Page 9: The Basic Hodgkin-Huxley Model Project - Clemsoncecas.clemson.edu/~petersj/Courses/M390/Project/Project.pdf · The Basic Hodgkin-Huxley Model Project Dr. Peterson This is your project

• Then compute the τ and steady state activation and inactivation variables

τMNA=

1

αMNA+ βMNA

(MNA)∞ =αMNA

αMNA+ βMNA

τHNA=

1

αHNA+ βHNA

(HNA)∞ =αHNA

αHNA+ βHNA

τMK=

1

αMK+ βMK

(MK)∞ =αMK

αMK+ βMK

• Then compute the sodium and potassium potentials. In this model this is easy as each is set onlyonce since the internal and external ion concentrations always stay the same and so Nernst’s equationonly has to used one time. Here we use the concentrations

[NA]o = 491.0

[NA]i = 50.0

[K]o = 20.11

[K]i = 400.0

These computations are also dependent on the temperature.

• Next compute the conductances since we now know (MNA(V ), HNA(V ) and MK(V ).

gNa(V ) = gMaxNa MNA

3(V ) HNA(V )

gK(V ) = gMaxK MK

4(V )

Now here we will need the maximum sodium and potassium conductances gMaxNa and gMax

K to finishthe computation. These values must be provided as data and in this model are not time dependent.Here we use

gMaxNa = 120.0

gMaxK = 36.0

• Then compute the ionic currents:

INa = gNA(V )(V (t) − ENA)

IK = gK(V )(V (t) − EK)

IL = gL(V )(V (t) − EL)

where we use suitable values for the leakage conductance and battery voltage such as

9

Page 10: The Basic Hodgkin-Huxley Model Project - Clemsoncecas.clemson.edu/~petersj/Courses/M390/Project/Project.pdf · The Basic Hodgkin-Huxley Model Project Dr. Peterson This is your project

gL = −0.0013

EL = −50.0

We generally obtain these values with the rest.m computation which we will discuss later.

• Finally compute the total current

IT = INA + IK + IL

• We can now compute the dynamics of our system at time t and voltage V : we let IE denote theexternal current to our system which we must supply.

dV

dt=

IE − ITCM

dMNA

dt=

(MNA)∞ − MNA

τMNA

dHNA

dt=

(HNA)∞ − HNA

τHNA

dMK

dt=

(MK)∞ − MK

τMK

where we use CM = 1.0.

The basic Hodgkin - Huxley model thus needs four independent variables which we place in a four dimen-sional vector y which components assigned as follows:

y =

y[0] = Vy[1] = MNA

y[2] = HNA

y[3] = MK

We encode the dynamics calculated above into a four dimensional vector f whose components are inter-preted as follows:

f = =

f [0] = IE − IT

CM

f [1] = (MNA)∞ −MNA

τMNA

f [2] = (HNA)∞ −HNA

τHNA

f [3] = (MK)∞ −MK

τMK

which in terms of our vector y becomes

f [0] = IE − IT

CM

f [1] = (MNA)∞ − y[1]τMNA

f [2] = (HNA)∞ − y[2]τHNA

f [3] = (MK)∞ − y[3]τMK

So to summarize, at each time t and V , we need to calculate the four dimensional dynamics vector f foruse in our choice of ODE solver.

10

Page 11: The Basic Hodgkin-Huxley Model Project - Clemsoncecas.clemson.edu/~petersj/Courses/M390/Project/Project.pdf · The Basic Hodgkin-Huxley Model Project Dr. Peterson This is your project

5 Computing the Solution Numerically:

As an example of what we might do to solve this kind of a problem, we note that this system can now bewritten in vector form as

dy

dt= f(t, y)

y(0) = y0

where we have found that

y =

VMNA

HNA

MK

,

f =

IM − ITCM

(MNA)∞ −MNA

τMNA(HNA)∞ −HNA

τHNA(MK)∞ −MK

τMK

with initial data

y0 =

V0

(MNA)∞(HNA)∞(MK)∞

The hardest part is to encode all of this in the vector form. The dynamic component f [0] is actuallya complicated function of (MNA), (HNA) and (MK) as determined by the encoding sequence we havepreviously discussed. Hence, the calculation of the dynamics vector f is not as simple as defining eachcomponent of f as a functional expression. Now recall that the Runga - Kutte order 4 requires multiplevector function f evaluations per time step so that there is no way around the fact that solving this systemnumerically is expensive!

6 The Simple MatLab Implementation

This MatLab is more complicated and it is worth your while to have studied the previous chapter on howto solve Ordinary Differential Equations in MatLab. Simple code to manage our solution of the Hodgkin-Huxley equations is given below. We simply integrate the equations using a fixed time step repeatedlywith a Runga-Kutte method of order 4. This is not terribly accurate but it illustrates the results nicelynevertheless. The MatLab code is organized as follows:

1. SolveSimpleHH.m manages the action potential simulation. It calls the code in HHFixedRK.m tomanage the solution of the model using the Runga-Kutte approximation.

2. The code in HHFixedRK.m in turn calls the implementation of Runga-Kutte order 2−4 in HHRKstep.m.

3. The Runga-Kutta code must evaluate the dynamics function simpleHH.m many times.

11

Page 12: The Basic Hodgkin-Huxley Model Project - Clemsoncecas.clemson.edu/~petersj/Courses/M390/Project/Project.pdf · The Basic Hodgkin-Huxley Model Project Dr. Peterson This is your project

4. We also need to initialize the simulation to set the leakage currents to be 0; this is done with thecode in rest.m.

5. We also need to calculate Nersnt voltages. This is done in the function contained in the file Nernst.m.

So here are the code snippets we need.

6.1 Managing the Simulation: SolveSimpleHH.m

The code to manage the solution of the ODE is given below:

Listing 1: Managing The MatLab Hodgkin - Huxley Simulation

1 function [ t va l s , g NA , g K ,V,m NA, h NA , n K ] = . . .SolveSimpleHH ( fname , iename , t i n i t , t f i n a l , y0 , h , k , g Kmax , g NAmax)

%% We use a s imple Runge−Kutta scheme

6 % using the Matlab f u n c t i o n below :%% f i n d number o f i n t e r a t i o n s to don = ce i l ( ( t f i n a l −t i n i t )/h)+1;%

11 m NA = zeros (1 , n ) ;h NA = zeros (1 , n ) ;n K = zeros (1 , n ) ;g Na = zeros (1 , n ) ;g K = zeros (1 , n ) ;

16 V = zeros (1 , n ) ;

[ tva l s , yva l s ] = HHFixedRK( fname , iename , t i n i t , y0 , h , k , n ) ;

%21 % s t o r e v a l u e s in p h y s i c a l v a r i a b l e s

%V = yva l s ( 1 , 1 : n ) ;m NA = yva l s ( 2 , 1 : n ) ;h NA = yva l s ( 3 , 1 : n ) ;

26 n K = yva l s ( 4 , 1 : n ) ;

%% Compute g Na and G K%

31 for i = 1 : nu = m NA( i )∗m NA( i )∗m NA( i )∗h NA( i ) ;g NA( i ) = g NAmax∗u ;

end

36 for i = 1 : nu = n K( i )∗n K( i )∗n K( i )∗n K( i ) ;g K ( i ) = g Kmax ∗ u ;

end

12

Page 13: The Basic Hodgkin-Huxley Model Project - Clemsoncecas.clemson.edu/~petersj/Courses/M390/Project/Project.pdf · The Basic Hodgkin-Huxley Model Project Dr. Peterson This is your project

6.2 Setting Ion Currents to Zero: rest.m

The initial conditions for the activation and inactivation variables for this model should be calculated

carefully. When the excitable nerve cell is at equilibrium, with no external current applied, there is no net

current flow across the membrane. At this point, the voltage across the membrane should be the applied

voltage EM . Therefore,

0 = IT

= INA + IK1 + IL

= gMaxNA (EM − ENA)(MNA)3

∞ (HNA)∞ + gMaxK (EM − EK) (HNA)4

∞ + gL (EM − EL)

The two parameters, gL and EL, are used to take into account whatever ionic currents flow across the

membrane that are not explicitly modeled. We know this model does not deal with various pumps, a

variety of potassium gates, calcium gates and so forth. We also know there should be no activity at

equilibrium in the absence of an external current. However, it is difficult to choose these parameters.

So first, solve to the leakage parameters in terms of the rest of the variables. Also, we can see that the

activation and inactivation variables for each gate at equilibrium will take on the values that are calculated

using the voltage EM . We can use the formulae given in the Hodgkin - Huxley dynamics to compute the

values of activation/ inactivation that occur when the membrane voltage is at rest, EM . We label these

values with a superscript r for notational convenience.

M rNA ≡ (MNA)∞(EM )

H rNA ≡ (HNA)∞(EM )

M rK ≡ (MK)∞(EM )

Then, we can calculate the equilibrium currents

IrNA = gmaxNA (EM − ENA) (M rNA)3 (HNA)r

IrK = gMaxK (EM − EK) (MK)r)4

Thus, we see we must choose gL and EL so that

gL (EL − EM ) = IrNA + IrK

or

gL (EL − EM ) = IrNA + IrK

13

Page 14: The Basic Hodgkin-Huxley Model Project - Clemsoncecas.clemson.edu/~petersj/Courses/M390/Project/Project.pdf · The Basic Hodgkin-Huxley Model Project Dr. Peterson This is your project

If we choose to fix EL, we can solve for the leakage conductance

gL =IrNA + IrKEL − EM

We do this in a startup function rest.m. This code is almost identical to the code we see in simpleHH.m.

Listing 2: Initializing The Simulation: rest.m

1 function [ g L , m NA inf inity , h NA in f in i ty , m K in f in i ty ] = r e s t (E L , V R , g NA bar , g K bar )%% i n p u t s :% E L = l e a k a g e v o l t a g e% g NA bar = maximum sodium conductance

6 % g K bar = maximum potassium conductance% V R = r e s t v o l t a g e% o u t p u t s :% g L = l e a k a g e conductance% m NA inf ini ty = c a l c u l a t e d i n i t i a l v a l u e

11 % h N A i n f i n i t y = c a l c u l a t e d i n i t i a l v a l u e% m K i n f i n i t y = c a l c u l a t e d i n i t i a l v a l u e%% ==================================================% Constants f o r Ion Equ i l i b r ium Vol tage C a l c u l a t i o n s

16 % ==================================================%% Rydberg ’ s Constant

R = 8 . 3 1 ;% Kelvin Temperature ; use 9.3 de gre es C e l s i u s

21 T = 2 2 . 2 ;% Faraday ’ s cons tant

F = 9.649 e +4;%% Compute Nernst v o l t a g e s o f E K and E Na

26 % v o l t a g e = Nernst ( va lence , Temperature , InConc , OutConc )%% Sodium

NA O = 4 9 1 . 0 ;NA I = 5 0 . 0 ;

31 E NA = Nernst (1 ,T, NA I ,NA O)% Potassium

K O = 2 0 . 1 1 ;K I = 4 0 0 . 0 ;E K = Nernst (1 ,T, K I ,K O)

36

%% a c t i v a t i o n / i n a c t i v a t i o n parameters f o r NA% alpha mNA , beta mNA

sum = V R+35.0;41 i f sum > 0

alpha mNA = −0.10∗sum/(exp(−sum/10 .0 ) − 1 . 0 ) ;else

alpha mNA = −0.10∗exp( sum/ 10 .0 )∗sum/ ( 1 . 0 − exp( sum/ 1 0 . 0 ) ) ;end

46 %

14

Page 15: The Basic Hodgkin-Huxley Model Project - Clemsoncecas.clemson.edu/~petersj/Courses/M390/Project/Project.pdf · The Basic Hodgkin-Huxley Model Project Dr. Peterson This is your project

sum = V R+60.0;i f sum > 0

beta mNA = 4.0∗exp( −sum/ 1 8 . 0 ) ;else

51 beta mNA = 4.0∗exp( −sum/ 1 8 . 0 ) ;end

%m NA inf in ity = alpha mNA/(alpha mNA+beta mNA)

56 % a c t i v a t i o n , i n a c t i v a t i o n parameter f o r I NA% alpha hNA , beta mNA%

sum = (V R+60 .0 )/20 .0 ;i f sum < 0

61 alpha hNA = 0.07∗exp( −sum) ;else

alpha hNA = 0.07∗exp( −sum) ;end

%66 sum = V R+30.0;

i f sum>0beta hNA = 1 . 0 / ( 1 . 0 + exp(−sum/ 1 0 . 0 ) ) ;

elsebeta hNA = exp( sum/1 0 . 0 ) / (exp( sum/10 .0 ) + 1 . 0 ) ;

71 endh NA in f in i ty = alpha hNA /( alpha hNA+beta hNA )

%% I NA current

I NA = g NA bar ∗(V R−E NA)∗ m NA inf in ity ∗m NA inf in ity ∗m NA inf in ity ∗ h NA in f in i ty76 %

% a c t i v a t i o n / i n a c t i v a t i o n parameters f o r K% alpha mK

sum = V R+50.0;i f sum > 0

81 alpha mK = −0.01∗sum/(exp(−sum/10 .0 ) − 1 . 0 ) ;else

alpha mK = −0.01∗exp(sum/10 .0 )∗sum/ ( 1 . 0 − exp(sum/ 1 0 . 0 ) ) ;endsum = (V R+60 .0)∗0 .0125 ;

86 i f sum > 0beta mK = 0.125∗exp( −sum) ;

elsebeta mK = 0.125∗exp( −sum) ;

end91

m K in f in i ty = alpha mK /( alpha mK+beta mK )%% I K current

I K = g K bar ∗(V R−E K)∗ m K in f in i ty ∗m K in f in i ty ∗m K in f in i ty ∗m K in f in i ty96

numerator = −I NA − I K ;denominator = V R − E L ;

%% compute g L

101

% Note we want% I NA + I K + g L ∗ (V R − E L) = 0

15

Page 16: The Basic Hodgkin-Huxley Model Project - Clemsoncecas.clemson.edu/~petersj/Courses/M390/Project/Project.pdf · The Basic Hodgkin-Huxley Model Project Dr. Peterson This is your project

% which g i v e s the equat ion be low assuming we are g iven E L .%

106 g L = −(I NA + I K )/(V R − E L ) ;

6.3 The Hodgkin-Huxley Dynamics: simpleHH.m

The Hodgkin-Huxley dynamics are encoded in the function below:hh2simplehh

Listing 3: The MatLab Hodgkin - Huxley Dymanics: simpleHH.m

function f = simpleHH ( t , y , IE )

% Standard Hodgkin − Huxley Model4 % v o l t a g e mV

% current na% time ms% c o n c e n t r a t i o n mM% conductance micro Siemens

9 % capac i tance nF% ===============================================% y v e c t o r ass ignments% ===============================================% y (1) = V

14 % y (2) = m NA% y (3) = h NA% y (4) = m K%% s e t s i z e o f f

19 %

f = zeros ( 1 , 4 ) ;

% ===============================================24 % f v e c t o r ass ignments

% ===============================================% y (1) = V dynamics% y (2) = m NA dynamics% y (3) = h NA dynamics

29 % y (4) = m K dynamics%% ================================================% Fast Sodium Current% ===============================================

34 % ================================================% Constants f o r Equ i l i b r ium Vol tage C a l c u l a t i o n s% ===============================================%

39 % Rydberg ’ s ConstantR = 8 . 3 1 ;

% Kelvin Temperature ; use 9.3 de gre es C e l s i u sT = 2 2 . 2 ;

% Faraday ’ s cons tant44 F = 9.649 e +4;

16

Page 17: The Basic Hodgkin-Huxley Model Project - Clemsoncecas.clemson.edu/~petersj/Courses/M390/Project/Project.pdf · The Basic Hodgkin-Huxley Model Project Dr. Peterson This is your project

%% Compute Nernst v o l t a g e s o f E K and E Na% v o l t a g e = Nernst ( va lence , Temperature , InConc , OutConc )%

49

%% Sodium%

NA O = 4 9 1 . 0 ;54 NA I = 5 0 . 0 ;

E NA = Nernst (1 ,T, NA I ,NA O) ;

%% Potassium

59 %K O = 2 0 . 1 1 ;K I = 4 0 0 . 0 ;E K = Nernst (1 ,T, K I ,K O ) ;

64

% max conductance f o r NAg NA bar = 1 2 0 . 0 ;

% max conductance f o r K69 g K bar = 3 6 . 0 ;

%% a c t i v a t i o n / i n a c t i v a t i o n parameters f o r NA%

74 % alpha mNA , beta mNA%

sum = y (1)+35 .0 ;i f sum > 0

alpha mNA = −0.10∗sum/(exp(−sum/10 .0 ) − 1 . 0 ) ;79 else

alpha mNA = −0.10∗exp( sum/ 10 .0 )∗sum/ ( 1 . 0 − exp( sum/ 1 0 . 0 ) ) ;end

%sum = y (1)+60 .0 ;

84 i f sum > 0beta mNA = 4.0∗exp( −sum/ 1 8 . 0 ) ;

elsebeta mNA = 4.0∗exp( −sum/ 1 8 . 0 ) ;

end89 %

m NA inf in ity = alpha mNA/(alpha mNA+beta mNA ) ;t m NA = 1 . 0 / ( alpha mNA+beta mNA ) ;

%f ( 2 ) = ( m NA inf in ity − y ( 2 ) ) / t m NA ;

94

%% a c t i v a t i o n , i n a c t i v a t i o n parameter f o r I NA%% alpha hNA , beta mNA

99 %sum = ( y ( 1 ) + 6 0 . 0 ) / 2 0 . 0 ;i f sum < 0

17

Page 18: The Basic Hodgkin-Huxley Model Project - Clemsoncecas.clemson.edu/~petersj/Courses/M390/Project/Project.pdf · The Basic Hodgkin-Huxley Model Project Dr. Peterson This is your project

alpha hNA = 0.07∗exp( −sum) ;else

104 alpha hNA = 0.07∗exp( −sum) ;end

%sum = y (1)+30 .0 ;i f sum>0

109 beta hNA = 1 . 0 / ( 1 . 0 + exp(−sum/ 1 0 . 0 ) ) ;else

beta hNA = exp( sum/1 0 . 0 ) / (exp( sum/10 .0 ) + 1 . 0 ) ;end

%114 h NA in f in i ty = alpha hNA /( alpha hNA+beta hNA ) ;

t h NA = 1 .0 / ( alpha hNA+beta hNA ) ;f (3 ) = ( h NA in f in i ty − y ( 3 ) ) / t h NA ;

%119 % I NA current

%I NA = g NA bar ∗( y(1)−E NA)∗y (2)∗ y (2)∗ y (2)∗ y ( 3 ) ;

%124 % a c t i v a t i o n / i n a c t i v a t i o n parameters f o r K

%% alpha mK%

sum = y (1)+50 .0 ;129 i f sum > 0

alpha mK = −0.01∗sum/(exp(−sum/10 .0 ) − 1 . 0 ) ;else

alpha mK = −0.01∗exp(sum/10 .0 )∗sum/ ( 1 . 0 − exp(sum/ 1 0 . 0 ) ) ;end

134 sum = ( y (1 )+60 .0 )∗0 . 0125 ;i f sum > 0

beta mK = 0.125∗exp( −sum) ;else

beta mK = 0.125∗exp( −sum) ;139 end

t m K = 1 . 0/ ( alpha mK+beta mK ) ;m K in f in i ty = alpha mK /( alpha mK+beta mK ) ;f (4 ) = ( m K in f in i ty − y ( 4 ) ) / t m K ;

144 %% I K current%

I K = g K bar ∗( y(1)−E K)∗y (4)∗ y (4)∗ y (4)∗ y ( 4 ) ;

149 %% l e a k a g e current : run r e s t .m to f i n d a p p r o p r i a t e g L v a l u e%

g l e a k = 0 . 0 0 9 2 ;E leak = −50.0;

154

%% I L current%

I l e a k = g l e a k ∗( y(1)−E leak ) ;

18

Page 19: The Basic Hodgkin-Huxley Model Project - Clemsoncecas.clemson.edu/~petersj/Courses/M390/Project/Project.pdf · The Basic Hodgkin-Huxley Model Project Dr. Peterson This is your project

159

%% C e l l Capacitance%

C M = 1 . 0 ;164 s = feval ( IE , t ) ;

% s = 0;f ( 1 ) = ( s − I NA − I K − I l e a k )/C M;

6.4 The Runga-Kutte Manager: HHFixedRK.m

The code that manages the call to a fixed Runga-Kutte order method from an earlier chapter has been

modified to accept an argument which is the name of the function which models the current injection.

Listing 4: The MatLab Fixed Runga - Kutte Method

function [ t va l s , yva l s ] = HHFixedRK( fname , iename , t0 , y0 , h , k , n )%% Gives approximate s o l u t i o n to

4 % y ’ ( t ) = f ( t , y ( t ) )% y ( t0 ) = y0% using a k th order RK method%% t0 i n i t i a l t ime

9 % y0 i n i t i a l s t a t e% h s t e p s i z e% k RK order 1<= k <= 4% n Number o f s t e p s to tak e%

14 % t v a l s time v a l u e s o f form% t v a l s ( j ) = t0 + ( j −1)∗h , 1 <= j <= n% y v a l s approximate s o l u t i o n% y v a l s ( : j ) = approximate s o l u t i o n at% t v a l s ( j ) , 1 <= j <= n

19 % fname name of dynamics f u n c t i o n% iename name o f current i n j e c t i o n f u n c t i o n%tc = t0 ;yc = y0 ;

24 t v a l s = tc ;yva l s = zeros (4 , n ) ;yva l s ( 1 : 4 , 1 ) = transpose ( yc ) ;f c = feval ( fname , tc , yc , iename ) ;for j =1:n−1

29 [ tc , yc , f c ] = HHRKstep( fname , iename , tc , yc , fc , h , k ) ;yva l s ( 1 : 4 , j +1) = transpose ( yc ) ;t v a l s = [ t v a l s tc ] ;

end

6.4.1 The Runga-Kutte Implementation: HHRKstep.m

The actual Runga-Kutte code was also modified to allow the name of the current injection function to be

entered as an argument.

19

Page 20: The Basic Hodgkin-Huxley Model Project - Clemsoncecas.clemson.edu/~petersj/Courses/M390/Project/Project.pdf · The Basic Hodgkin-Huxley Model Project Dr. Peterson This is your project

Listing 5: Adding Injection Current To The Runga - Kutte Code

function [ tnew , ynew , fnew ] = HHRKstep( fname , iename , tc , yc , fc , h , k )%

3 % fname the name o f the r i g h t hand s i d e f u n c t i o n f ( t , y )% t i s a s c a l a r u s u a l l y c a l l e d time and% y i s a v e c t o r o f s i z e d% yc approximate s o l u t i o n to y ’ ( t ) = f ( t , y ( t ) ) a t t=t c% f c f ( tc , yc )

8 % h The time s t e p% k The order o f the Runge−Kutta Method 1<= k <= 4%% tnew t c+h% ynew approximate s o l u t i o n at tnew

13 % fnew f ( tnew , ynew )%i f k==1

k1 = h∗ f c ;ynew = yc+k1 ;

18 e l s e i f k==2k1 = h∗ f c ;k2 = h∗ feval ( fname , tc+(h /2) , yc+(k1 /2) , iename ) ;ynew = yc + ( k1+k2 ) / 2 ;

e l s e i f k==323 k1 = h∗ f c ;

k2 = h∗ feval ( fname , tc+(h /2) , yc+(k1 /2) , iename ) ;k3 = h∗ feval ( fname , tc+h , yc−k1+2∗k2 , iename ) ;ynew = yc+(k1+4∗k2+k3 ) / 6 ;

e l s e i f k==428 k1 = h∗ f c ;

k2 = h∗ feval ( fname , tc+(h /2) , yc+(k1 /2) , iename ) ;k3 = h∗ feval ( fname , tc+(h /2) , yc+(k2 /2) , iename ) ;k4 = h∗ feval ( fname , tc+h , yc+k3 , iename ) ;ynew = yc+(k1+2∗k2+2∗k3+k4 ) / 6 ;

33 elsedisp ( sprintf (’The RK method %2d order is not allowed!’ , k ) ) ;

endtnew = tc+h ;fnew = feval ( fname , tnew , ynew , iename ) ;

6.5 Nernst Calculations: Nernst.m

We perform the necessary Nernst voltage calculations with the function given in Nernst.m.

Listing 6: Computing the Nernst Voltage

function vo l tage = Nernst ( valence , Temperature , InConc , OutConc )%

3 % compute Nernst v o l t a g e f o r a g iven ionR = 8 . 3 1 ;T = Temperature +273.0;F = 96 480 . 0 ;P r e f i x = (R∗T)/( va l ence ∗F ) ;

8 %% output v o l t a g e in m i l l i v o l t svo l tage = 1000 .0∗ ( P r e f i x ∗ log (OutConc/InConc ) ) ;

20

Page 21: The Basic Hodgkin-Huxley Model Project - Clemsoncecas.clemson.edu/~petersj/Courses/M390/Project/Project.pdf · The Basic Hodgkin-Huxley Model Project Dr. Peterson This is your project

6.6 A Simple External Current: IE.m

injectedpulse

Listing 7: The Injected Current Pulse

function s = IE ( t )%n = length ( t ) ;s = zeros (1 , n ) ;

5 for i =1:ns ( i ) = 0 ;i f t ( i ) >= 10 & t ( i ) <= 10.62

s ( i ) = 100 ;end

10 end

6.7 Runtime Results

For this simulation, we will use a Celsius temperature of 22.2. We also use a maximum sodium conductance

of 120.0 and a maximum potassium conductance of 36.0. There are a few things we have to watch for

when we run a simulation:

• The Celsius temperature is actually typed into the code files simpleHH.m and rest.m. So changing

this temperature means you have to edit and change a line in both files.

• The maximum sodium and potassium conductances are also hard coded into the files simpleHH.m

and rest.m. So changing these values requires editing these two files also.

• Once values of temperature and maximum conductances are chosen, run rest.m to determine the

value of gL that ensures no current flows across the cell membrane when there is no external current.

This function call also returns the initial values for the Hodgkin - Huxley dynamical system. A line

like

[ g L ,m NA0, h NA0 , m K0 ] = r e s t (E L , V R , g NA bar , g K bar )

plus the initialization V R = -70 gives the initial condition for the Hodgkin -Huxley dynamical system

to be

y[1]

y[2]

y[3]

y[4]

=

E R

m NA0

h NA0

m K0

.

Then the value of gL returned must be typed into the appropriate place in the file simpleHH.m.

• Once the above steps have been done, we are ready to run the simulation.

21

Page 22: The Basic Hodgkin-Huxley Model Project - Clemsoncecas.clemson.edu/~petersj/Courses/M390/Project/Project.pdf · The Basic Hodgkin-Huxley Model Project Dr. Peterson This is your project

Figure 5: Membrane Voltage vs Time: gL = 0.0092, EL = −50, gmaxNA = 120 and gmaxK = 36.0.

We ran our simple simulation using this session (we edit a bit to shorten lines and so forth):

>> E L = −50;>> V R = −70;>> g NA bar = 1 2 0 . 0 ;

4 >> g K bar = 3 6 . 0 ;>> [ g L ,m NA0, h NA0 , m K0 ] = r e s t (E L , V R , g NA bar , g K bar ) ;E NA = 58.0840E K = −76.0304m NA inf in ity = 0.0154

9 h NA in f in i ty = 0.8652I NA = −0.0485m K in f in i ty = 0.1810I K = 0.2330>> g L

14 g L = 0.0092>> [ t v a l s , g NA , g K ,V,m NA, h NA ,m K] = . . .

SolveSimpleHH (’simpleHH’ ,’IE’ , 0 . 0 , 1 0 0 . 0 , . . .[ V R , m NA inf inity , h NA in f in i ty , m K in f in i ty ] , . . .0 . 01 , 4 , g NA bar , g K bar ) ;

19 >>

For all of these results, we use the applied current given by the code IE.m. This pulse applies a constant

current of 100 namps between on the time interval [10.0, 10.62]. Otherwise, it is zero. In Figure ( 5), we

see the membrane voltage versus time curve that results from the application of this injected current.

Note we see a nice action potential here. We show the corresponding sodium and potassium conducances

during this pulse in Figure 6.

In Figure 8(a) we show the activation and inactivation variables for sodium and in Figure 8(b), we

show the activation variable for potassium.

It is instructive to look at the ion currents and conductances during the pulses. Simply compute and plot

the currents with the following MatLab commands

22

Page 23: The Basic Hodgkin-Huxley Model Project - Clemsoncecas.clemson.edu/~petersj/Courses/M390/Project/Project.pdf · The Basic Hodgkin-Huxley Model Project Dr. Peterson This is your project

Figure 6:

Figure 7: Sodium and Potassium Conductances vs. Time for gmaxNA = 120 and gmaxK = 36 for impulsecurrent.

(a) Sodium Activation and Inactivation vs. Time (b) Potassium Activation vs Time

Figure 8: Sodium and Potassium Dynamics

23

Page 24: The Basic Hodgkin-Huxley Model Project - Clemsoncecas.clemson.edu/~petersj/Courses/M390/Project/Project.pdf · The Basic Hodgkin-Huxley Model Project Dr. Peterson This is your project

Figure 9: Sodium and Potassium Currents vs Time:

1 >> E NA = 5 8 .08 40 ;>> E K = −76.0304;>> I NA = g NA bar∗g NA . ∗ (V−E NA ) ;>> I K = g K bar∗g K . ∗ (V− E K ) ;>> plot ( t v a l s , I NA , t v a l s , I K ) ;

6 >> xlabel (’Time ms’ ) ;>> ylabel (’Current na’ ) ;>> t i t l e (’Sodium and Potassium Currents vs Time’ ) ;>> legend (’Sodium’ ,’Potassium’ ) ;

In Figure ( 9), we see the sodium and potassium currents plotted simultaneously.

Note that the sodium current is positive while the potassium current is negative. If you look closely,

you can see the potassium current lags behind the sodium one. Finally, we can look at how the sodium

and potassium gates action depends on voltage. They are voltage dependent gates after all! The sodium

conductance versus membrane voltage is shown in Figure 10 and the potassium conductance voltage curve

is shown in Figure 11.

7 Printing Additional Variables

In order to plot the τmNA and m∞NA values and so forth for our simulation, we have to rewrite some code.

We need to return all of the time constants and asymptotic values so that we can generate plots.

7.1 The New Manager: SolveSimpleHHnew.m

We alter the SolveSimpleHH.m function to SolveSimpleHHnew.m as follows:

1 function [ t va l s , g NA , g K ,V,m NA, h NA , n K , . . .t m NA , m NA inf inity , . . .t h NA , h NA in f in i ty , . . .t m K , m K in f in i ty ] = . . .SolveSimpleHHnew ( fname , iename , t i n i t , t f i n a l , y0 , h , k , g Kmax , g NAmax)

24

Page 25: The Basic Hodgkin-Huxley Model Project - Clemsoncecas.clemson.edu/~petersj/Courses/M390/Project/Project.pdf · The Basic Hodgkin-Huxley Model Project Dr. Peterson This is your project

Figure 10: Sodium Conductance vs Voltage

Figure 11: Potassium Conductance vs Voltage

25

Page 26: The Basic Hodgkin-Huxley Model Project - Clemsoncecas.clemson.edu/~petersj/Courses/M390/Project/Project.pdf · The Basic Hodgkin-Huxley Model Project Dr. Peterson This is your project

6 % f i n d number o f i n t e r a t i o n s to don = ce i l ( ( t f i n a l −t i n i t )/h)+1;%m NA = zeros (1 , n ) ;h NA = zeros (1 , n ) ;

11 n K = zeros (1 , n ) ;g Na = zeros (1 , n ) ;g K = zeros (1 , n ) ;V = zeros (1 , n ) ;t m NA = zeros (1 , n ) ;

16 m NA inf in ity = zeros (1 , n ) ;t h NA = zeros (1 , n ) ;h NA in f in i ty = zeros (1 , n ) ;t m K = zeros (1 , n ) ;m K in f in i ty = zeros (1 , n ) ;

21

[ t va l s , yvals , z v a l s ] = HHFixedRKnew( fname , iename , t i n i t , y0 , h , k , n ) ;

%% s t o r e v a l u e s in p h y s i c a l v a r i a b l e s

26 %V = yva l s ( 1 , 1 : n ) ;m NA = yva l s ( 2 , 1 : n ) ;h NA = yva l s ( 3 , 1 : n ) ;n K = yva l s ( 4 , 1 : n ) ;

31 t m NA = z v a l s ( 1 , 1 : n ) ;m NA inf in i ty = z v a l s ( 2 , 1 : n ) ;t h NA = z v a l s ( 3 , 1 : n ) ;h NA in f in i ty = z v a l s ( 4 , 1 : n ) ;t m K = z v a l s ( 5 , 1 : n ) ;

36 m K in f in i ty = z v a l s ( 6 , 1 : n ) ;

%% Compute g Na and g K%

41 for i = 1 : nu = m NA( i )∗m NA( i )∗m NA( i )∗h NA( i ) ;g NA( i ) = g NAmax∗u ;

end

46 for i = 1 : nu = n K( i )∗n K( i )∗n K( i )∗n K( i ) ;g K ( i ) = g Kmax ∗ u ;

end

Note we are now returning all of the time constants and asympotic values for each time step. To do this,

we have to alter HHFixedRK.m to the new code HHFixedRKnew.m.

7.2 The New Runga-Kutte Manager: HHFixedRKnew.m

This code is quite similar to the original as you can see.

1 function [ t va l s , yvals , z v a l s ] = HHFixedRKnew( fname , iename , t0 , y0 , h , k , n )%% Gives approximate s o l u t i o n to

26

Page 27: The Basic Hodgkin-Huxley Model Project - Clemsoncecas.clemson.edu/~petersj/Courses/M390/Project/Project.pdf · The Basic Hodgkin-Huxley Model Project Dr. Peterson This is your project

% y ’ ( t ) = f ( t , y ( t ) )% y ( t0 ) = y0

6 % using a k th order RK method%% t0 i n i t i a l t ime% y0 i n i t i a l s t a t e% h s t e p s i z e

11 % k RK order 1<= k <= 4% n Number o f s t e p s to tak e%% t v a l s time v a l u e s o f form% t v a l s ( j ) = t0 + ( j −1)∗h , 1 <= j <= n

16 % y v a l s approximate s o l u t i o n% y v a l s ( : j ) = approximate s o l u t i o n at% t v a l s ( j ) , 1 <= j <= n% z v a l s a u x i l i a r y dynamics v a r i a b l e s% z v a l s ( : j ) = a u x i l i a r y v a r i a b l e s a t

21 % t v a l s ( j ) , 1 <= j <= n% fname name of dynamics f u n c t i o n% iename name o f current i n j e c t i o n f u n c t i o n%tc = t0 ;

26 yc = y0 ;t v a l s = tc ;yva l s = zeros (4 , n ) ;z v a l s = zeros (6 , n ) ;yva l s ( 1 : 4 , 1 ) = transpose ( yc ) ;

31 [ f c , zc ] = feval ( fname , tc , yc , iename ) ;z v a l s ( 1 : 6 , 1 ) = transpose ( zc ) ;for j =1:n−1

[ tc , yc , f c ] = HHRKstep( fname , iename , tc , yc , fc , h , k ) ;yva l s ( 1 : 4 , j +1) = transpose ( yc ) ;

36 [ f c , zc ] = feval ( fname , tc , yc , iename ) ;z v a l s ( 1 : 6 , j +1) = transpose ( zc ) ;t v a l s = [ t v a l s tc ] ;

end

We leave the file HHRKstep.m alone as we don’t need to change that.

7.3 Runtime Results

To generate the plots, we set up a MatLab session like this:

1 >> E L = −50;>> V R = −70;>> g NA bar = 1 2 0 . 0 ;>> g K bar = 3 6 . 0 ;>> [ g L ,m NA0, h NA0 , m K0 ] = . . .

6 r e s t (E L , V R , g NA bar , g K bar ) ;E NA = 58.0840E K = −76.0304m NA inf in ity = 0.0154h NA in f in i ty = 0.8652

11 I NA = −0.0485m K in f in i ty = 0.1810I K = 0.2330

27

Page 28: The Basic Hodgkin-Huxley Model Project - Clemsoncecas.clemson.edu/~petersj/Courses/M390/Project/Project.pdf · The Basic Hodgkin-Huxley Model Project Dr. Peterson This is your project

>> g Lg L = 0.0092

16 >> [ t va l s , g NA , g K ,V,m NA, h NA , n K , . . .t m NA , m NA inf inity , . . .t h NA , h NA in f in i ty , . . .t m K , m K in f in i ty ] = . . .

SolveSimpleHHnew (’simpleHHnew’ ,’IE’ , 0 , 3 0 , . . .21 [ V R ,m NA0, h NA0 , m K0 ] , . . .

. 0 1 , 4 , g K bar , g NA bar ) ;>> plot ( tva l s , t m NA ) ;. . .

The values of τNAm and m∞NA versus time are plotted simulateneously in Figure 13.

Figure 12: m Time Constant and Asymptotic Value vs Time

We can also plot τNAm and m∞NA versus membrane voltage to see how they vary with depolarization.

Figure 13: m Time Constant and Asymptotic Value vs Membrane Voltage

28

Page 29: The Basic Hodgkin-Huxley Model Project - Clemsoncecas.clemson.edu/~petersj/Courses/M390/Project/Project.pdf · The Basic Hodgkin-Huxley Model Project Dr. Peterson This is your project

8 Exercises

Exercise 8.1. Run the Hodgkin - Huxley simulation as has been done in the work above and write a

complete report in your favorite editor which documents how an action potential is generated using the

plots and evidence obtained in the following studies.

For all of these studies, we will use the current impulse defined by the code in IE.m.

Study One Here maximum sodium conductance is 120 and maximum potassium conductance is 36.0.

1. The plots of voltage, m NA, h NA and m K versus time for 100 mSec.

2. The plots of the time constant and the asymptotic value for m NA, h NA and m K versus time.

3. The plots of the time constant and the asymptotic value for m NA, h NA and m K versus voltage.

4. The plots of the sodium and potassium conductance versus time.

5. The plots of the sodium and potassium conductance versus voltage.

6. The plots of sodium and potassium current versus time.

Study Two Here maximum sodium conductance is 120 and maximum potassium conductance is 16.0

1. The plots of voltage, m NA, h NA and m K versus time for 100 mSec.

2. The plots of the time constant and the asymptotic value for m NA, h NA and m K versus time.

3. The plots of the time constant and the asymptotic value for m NA, h NA and m K versus voltage.

4. The plots of the sodium and potassium conductance versus time.

5. The plots of the sodium and potassium conductance versus voltage.

6. The plots of sodium and potassium current versus time.

Study Three Here maximum sodium conductance is 20.0 and maximum potassium conductance is 3.6.

1. The plots of voltage, m NA, h NA and m K versus time for 100 mSec.

2. The plots of the time constant and the asymptotic value for m NA, h NA and m K versus time

overlayed on the plots from Study One and Study Two.

3. The plots of the time constant and the asymptotic value for m NA, h NA and m K versus voltage

overlayed on the plots from Study One and Study Two.

4. The plots of the sodium and potassium conductance versus time overlayed on the plots from

Study One and Study Two.

5. The plots of the sodium and potassium conductance versus voltage overlayed on the plots from

Study One and Study Two.

6. The plots of sodium and potassium current versus time overlayed on the plots from Study One

and Study Two.

29