% % stE.m, Steve Cox 10/15/08 % % staggered Euler on the HH isopotential cell % % usage: [t,v] = stE(dt,stim) % % where: dt = timestep (ms) % stim = struct('amp', amplitude (micro A) % 't1', stim start time (ms) % 't2', stim stop time (ms) % 'Tfin', solve until Tfin (ms) % % and t = vector of times at which v is computed % v = associated potentials % % example: dt = 0.01; stim = struct('amp',10e-6,'t1',1,'t2',2,'Tfin',10); % function [t,V] = stE(dt,stim) A = 4*pi*(1e-6); % surface area (cm)^2 Cm = 1; % membrane capacitance (microFarad/cm^2) E = struct('K', -77, 'Na', 56, 'Cl', -68); % reversal potentials, mV G = struct('K', 36, 'Na', 120, 'Cl', 0.3); % channel conductances, mS/cm^2 Vr = fsolve(@(V) Iss(V,E,G),-71); % find rest potential Nt = ceil(stim.Tfin/dt); % initialize t = zeros(Nt,1); V = t; t(1) = 0; V(1) = Vr; n = an(Vr)/(an(Vr)+bn(Vr)); m = am(Vr)/(am(Vr)+bm(Vr)); h = ah(Vr)/(ah(Vr)+bh(Vr)); td = 1/dt; for j = 2:Nt, % march t(j) = (j-1)*dt; Istim = stim.amp*(t(j)-dt/2>stim.t1)*(t(j)-dt/2