function [nextState,debug] = hh_step_gen(state,input,noise,param)

alpha_m = (2.5 - 0.1*state(1))./(exp(2.5 - 0.1*state(1)) - 1);
alpha_n = (0.1 - 0.01*state(1))./(exp(1 - 0.1*state(1)) - 1);
alpha_h = 0.07*exp(-state(1)./20);
beta_m = 4*exp(-state(1)./18);
beta_n = 0.125*exp(-state(1)./80);
beta_h = 1./(exp(3-0.1*state(1))+1);

ionicCurrent = 120*state(2)^3*state(4)*(state(1)-115) ...
     + 36*state(3)^4*(state(1)--12) ...
     + 0.3*(state(1)-10.6); 

nextState = [state(1) + 0.01./1*(input(1) - ionicCurrent) ...
                    + 0.1*0.01*noise(1); ...
             state(2) + 0.01*(alpha_m*(1-state(2)) - beta_m*state(2)); ...
             state(3) + 0.01*(alpha_n*(1-state(3)) - beta_n*state(3)); ...
             state(4) + 0.01*(alpha_h*(1-state(4)) - beta_h*state(4))];
debug = [ ...
ionicCurrent; ...
alpha_m; ...
alpha_n; ...
alpha_h; ...
beta_m; ...
beta_n; ...
beta_h; ...
];
