Every time I run my hodgkin huxley simulation, I get an action
potential at t=0. For t>0 the simulator behaves normally to inputs.
Why am I getting this artifact, this action potential at t=0?
I could list my code but I think the question could be answered without
code. In any case, here is my matlab code:
________________________________________________________________________
%initialization and constants
clear all;
g_K=120;
g_Na=36;
g_Cl=.3;
C_m=1;
V_Na=115;
V_K=-12;
V_Cl=10.613;
t_step=.1;
N=560;
V=zeros(1,N);
n=zeros(1,N);
m=zeros(1,N);
h=zeros(1,N);
V_rest=0;
V(1,1)=V_rest;
n(1,1)=alpha_n(V_rest)/(alpha_n(V_rest)+beta_n(V_rest));
m(1,1)=alpha_m(V_rest)/(alpha_m(V_rest)+beta_m(V_rest));
h(1,1)=alpha_h(V_rest)/(alpha_h(V_rest)+beta_h(V_rest));
time=zeros(1,N);
time(1,1)=0;
for i=2:N
time(1,i)=time(1,i-1)+t_step;
end
Iext=zeros(1,N);
for i=1:N
if time(1,i)>=15 & time(1,i)<=40
Iext(1,i)=15;
end
end
% the simulation
for i=2:N
deriv=(1/C_m)*(Iext(1,i)-g_K*n(1,i-1)^4*(V(1,i-1)-V_K)-g_Na*m(1,i-1)^3*h(1,i-1)*(V(1,i-1)-V_Na)-g_Cl*(V(1,i-1)-V_Cl));
V(1,i)=V(1,i-1)+deriv*t_step;
m_deriv=alpha_m(V(1,i))*(1-m(1,i-1))-beta_m(V(1,i))*m(1,i-1);
m(1,i)=m(1,i-1)+m_deriv*t_step;
n_deriv=alpha_n(V(1,i))*(1-n(1,i-1))-beta_n(V(1,i))*n(1,i-1);
n(1,i)=n(1,i-1)+n_deriv*t_step;
h_deriv=alpha_h(V(1,i))*(1-h(1,i-1))-beta_h(V(1,i))*h(1,i-1);
h(1,i)=h(1,i-1)+h_deriv*t_step;
end
______________________________________________________________________
I directly used the Hodgkin Huxley alpha and beta parameters as listed
in their original paper, replacing all occurances of voltage with its
negative. Any insights are appreciated.