function dydt = HHmodel(t,y)
% Hodgkin-Huxley Equations
% y(1) = v, y(2) = n, y(3) = m, y(4) = h
tmpan = 0.01*(y(1)+10)/(exp((y(1)+10)/10)-1);
tmpbn = 0.125*exp(y(1)/80);
tmpam = 0.1*(y(1)+25)/(exp((y(1)+25)/10)-1);
tmpbm = 4*exp(y(1)/18);
tmpah = 0.07*exp(y(1)/20);
tmpbh = 1/(exp((y(1)+30)/10)+1);
tmpv = -(120*y(3)^3*y(4)*(y(1)+115)+36*y(2)^4*(y(1)-12)+0.3*(y(1)+10.5989));
tmpn = tmpan*(1-y(2))-tmpbn*y(2);
tmpm = tmpam*(1-y(3))-tmpbm*y(3);
tmph = tmpah*(1-y(4))-tmpbh*y(4);
dydt = [tmpv; tmpn; tmpm; tmph];

%[t,y] = ode23(@HHmodel,[0,20],[0,0,0,0]);