Generate system files for Hodgkin-Huxley equations¶
The Hodgkin-Huxley equations [HH52a] relate the difference in electric potential across the cell membrane \((V)\) and gating variables \((m, n\) and \(h\) ) for ion channels to the stimulus intensity \((I)\) and temperature \((T)\), as follows:
where \(\dot{x}\) stands for \(\mathrm{d} x / \mathrm{d} t\) and \(\Phi\) is given by \(\Phi(T)=3^{(\mathrm{T}-6.3) / 10}\). The other functions involved are:
and the equations modeling the variation of membrane permeability are:
with
The parameters \(\bar{g}_{\text {ion }}\) and \(\bar{V}_{\text {ion}}\) representing maximum conductance and equilibrium potential for the ion were obtained from experimental data by Hodgkin and Huxley, with the values given below:
The values of \(\bar{V}_{\mathrm{Na}}\) and \(\bar{V}_{\mathrm{K}}\) can be controlled experimentally [HH52b]. The temperature is set to \(T=6.3^{\circ}\).
These are used in the HodgkinHuxley.
Add MatCont path and load sym package if GNU Octave is used¶
matcontpath = '../';
addpath(matcontpath);
addpath([matcontpath, '/Utilities']);
if isOctave
pkg load symbolic % for GNU Octave
end
Set the system name¶
system_name = 'HodgkinHuxley';
Create coordinates and parameter names as strings¶
coordsnames = {'V', 'm', 'n', 'h'};
parnames={'VbarK', 'I'};
Create symbols for parameters¶
The array |par|
is the array of symbols in the same order as parnames.
Due to the following two lines we may, for example, use either mu_1
or
par(1)
Create symbols for coordinates and parameters¶
The array par
is the array of symbols in the same order as parnames.
Due to the following two lines we may, for example, use either k
or
par(1)
. There should no changes be need of this code.
syms(parnames{:}); % create symbol for alpha and delta
par=cell2sym(parnames); % now alpha1 is par(1) etc
syms(coordsnames{:}); % create symbol for alpha and delta
coords=cell2sym(coordsnames); % create 1 x n vector for coordinates
Define fixed parameters¶
gbarNa = 120;
gbarK = 36;
gbarL = 0.3;
VbarNa = -115;
VbarL = 10.599;
T = 6.3;
Define the system¶
Psi = @(x) x/(exp(x)-1);
alpha_m = @(V) Psi( (V+25)/10 );
alpha_n = @(V) 0.1*Psi( (V+10)/10);
alpha_h = @(V) 0.07*exp(V/20);
beta_m = @(V) 4*exp(V/18);
beta_n = @(V) 0.125*exp(V/80);
beta_h = @(V) 1/(1+exp((V+30)/10));
G = @(V, m, n, h) gbarNa*m^3*h*(V-VbarNa) + gbarK*n^4*(V-VbarK) + gbarL*(V-VbarL);
Phi = @(T) 3^(T-6.3)/10;
dV_dt = -G(V, m, n, h)+I;
dm_dt = Phi(T)*((1-m)*alpha_m(V)-m*beta_m(V));
dn_dt = Phi(T)*((1-n)*alpha_n(V)-n*beta_n(V));
dh_dt = Phi(T)*((1-h)*alpha_h(V)-h*beta_h(V));
system = [dV_dt; dm_dt; dn_dt; dh_dt];
In general there are no modifications needed after this line.
Differentiate and generate code (directional derivatives)¶
Exporting it to <system_name>.m
. This method uses directional derivatives.
Then using polarization identities derivatives can be calculated in arbitrary
direction.
suc = generate_directional_derivatives(...
system,... % n x 1 array of derivative symbolic expressions
coords,... % 1 x n array of symbols for states
par,... % 1 x np array of symbols used for parameters
system_name,... % argument specifying the system name
[matcontpath, 'Systems/']... % directory to save to file
);
Higher-order parameter-dependent multi-linear form.¶
Exporting it to <system_name>_multilinearforms.m
. These multi-linear forms are
currently only used in the computation of the parameter-dependent center
manifold for the codimension two Bogdanov-Takens bifurcation.
order = 3;
suc = generate_multilinear_forms(system_name, system, coords, par, order, ...
[matcontpath, 'Systems/']);