function dy=hh_solve(t,y)%,i_electrode)
%v,n,m,h

mem_capacitance=1;
g_l= 0.3;
e_l= -54.387;
g_k= 36;
e_k= -77;
g_na=120;
e_na= 50;
 i_electrode=113;
% step_duration=5;
% step_time=100;
% if t>step_time &t<(step_time+step_duration+1)
%     i_electrode=i_electrode+5;    
% end
cell_area=1;

%cm(dv/dt)=-i_m+Ie/A

% alpha_n=.01*(v+55)/(1-exp(-.1*(v+55)));
% beta_n=.125*exp(-.0125*(v+65));
% 
% alpha_m=.1*(v+40)/(1-exp(-.1*(v+40)));
% beta_m=4*exp(-.0556(v+65));
% 
% alpha_h=.07*exp(-.05*(v+65));
% beta_h=1/(1+exp(-.1*(v+35)));
%-----------------
dy = zeros(4,1); 

dy(1)=(mem_capacitance^-1)*(-(g_l*(y(1)-e_l) + g_k*y(2)^4*(y(1)-e_k) + g_na*y(3)^3*y(4)*(y(1)-e_na))    +(i_electrode/cell_area));

dy(2)=(.01*(y(1)+55)/(1-exp(-.1*(y(1)+55))))*(1-y(2)) - ((.125*exp(-.0125*(y(1)+65)))*y(2));

dy(3)=((.1*(y(1)+40))/(1-exp(-.1*(y(1)+40)))*(1-y(3))) - ((4*exp(-.0556*(y(1)+65)))*y(3));

dy(4)=(.07*exp(-.05*(y(1)+65)))*(1-y(4)) -(1/(1+exp(-.1*(y(1)+35))))*y(4);

% y(1)=voltage
% y(2)=n
% y(3)=m
% y(4)=h