I'm trying to simulate the Morris-Lecar model for neurons with ode45.
I am having trouble initializing the ode45 call, and documentation hasn't been able to help me. I understand that I have to call the ode45 through a function, and call that function from my main script.
I have a limited grasp of ODEs in general, and seem to have trouble understanding the syntax required to initialize the ODE45-call.
Also, I am indicated to use a time range for a variable 'pulse', but there is no input for a time range (which seems to be a variable, not fixed) in the function that takes in input from the main script and sends that with the other function to the ode45 function. The function that feeds into the ode45 has a time input as well, but again I cannot figure out how I can input a time range. The instructions are very clear that the function used in the main script does not take in any time variables.
It would be very appreciated if you could point out any glaring errors I have made in the initialization.
the current (below) version's error code is as following:
Error using ODEequation (line 89)
Not enough input arguments.
Error in odearguments (line 88)
f0 = feval(ode,t0,y0,args{:}); % ODE15I sets args{1} to yp0.
Error in ode45 (line 114)
[neq, tspan, ntspan, next, t0, tfinal, tdir, y0, f0, odeArgs, odeFcn, ...
Error in ODEquestion (line 32)
[t Vm]=ode45(@ODEequation,[-20 20],[-30, 0.1]',[],constants, stim_on, stim_off, amp);
Error in YoonS_Lab3_EBME308_Fall2012 (line 355)
[t Vm] = ODEquestion(20,100,30)
I think this goes back to my non-existing and yet needed time input.
The problem involves
Cm * dVm / dt = -Gm(Vm-Vrest) - Gca Minf (Vm - Eca) - Gk w(Vm - Ek) + pulse(t)
dw/dt = (wInf - w) / Tau-w;
wInf = (1+tanh(Vm/30)) / 2;
mInf = (1+tanh(Vm+1)) / 2;
Tau-w = 5/ (cosh(Vm/60));
Cm = membrane leakage capacticance;
Gm = membrane leakage conductance;
Vm = membrane voltage;
Vrest = membrane voltage @ neuron resting
Gca = max Ca conductance through membrane
Gk = max K conductance through membrane;
mInf refers = P ( Ca ion channel open )
wInf refers = P ( K ion channel open )
Tau-w = rate which K channels respond to change in membrane voltage
Eca = reversal potential of Ca
Ek = reversal potential of K
pulse(t) = stimulus applied to neuron
pulse(t) = A (stim-on <= t <= stim-off) or 0 (else);
as the variables.
I have created a function that gets sent to the ode45, as below.
function dy = ODEequation(t, Vm, w, constants, stim_on, stim_off, amp)
wInf = (1 + tan(Vm / 30)) / 2
mInf = (1 + tan((Vm + 1)/ 15)) / 2
tauW = 5/ (cosh(Vm/60))
pulse = amp * ((stim_on < t ) - ( t >= stim_off));
dy(1) = y(1) * ((-constants(2) - constants(4) * constants(9) - constants(5) * y(2)) + (constants(2) * constants(3) + constants(6) * constants(4) * constants(9) + constants(5) * y(2) * constants(7) + constants(11))) / constants(1) ;
dy(2) = = ( constants(8) - y(2) )/constants(10)
dy = dy'
and the function that passes that is as below
function [t Vm] = ODEquestion(stim_on, stim_off, amp)
%i)
Cm = 1;
Gm = 0.5;
Vrest = -50;
Gca = 1.1;
Gk = 2;
Eca = 100;
Ek = -70;
%ii)
Vm(1) = -30;
w(1) = 0.1;
%iii)
wInf = (1 + tan(Vm / 30)) / 2
mInf = (1 + tan((Vm + 1)/ 15)) / 2
tauW = 5/ (cosh(Vm/60))
IC1 = Vm(1) % = -30
IC2 = w(1) % = 0.1
pulse = amp %* ((stim_on < t ) - ( t >= stim_off));
constants = [Cm , Gm, Vrest, Gca, Gk, Eca, Ek, wInf, mInf, tauW, pulse];
[t Vm]=ode45(@ODEequation,[-20 20],[-30, 0.1]',[],constants, stim_on, stim_off, amp);