I am new to Matlab. I hope you can help me. I have to solve the ODE system using the ODE45 function. Here is the function that describes my rules.
function dNdt = rateEquations(t, y) %populations of corresponding state Ng = y(1); Ns = y(2); Nt = y(3); %All constants used are dropped for the sake of easy reading.
Pay attention to parameter F.
%rate equations dNs = s0 * Ng * F - Ns/ t_S1; dNt = Ns / t_ISC - Nt / t_T1; dNg = -dNt - dNs; dNdt = [dNg; dNs; dNt]; end
Then, in my script.m file, I call the ode45 function in 'for loop'. During each iteration, I need to change the F parameter and pass it to my "rateEquations" function. But I do not know how to implement this.
for T = Tmin: dt : Tmax %initial conditions initialConditions = [N0 0 0]; timeSpan = [T T+dt];
before calling ODE45 F should be changed.
[t,N] = ode45('rateEquations', timeSpan, initialConditions)
etc.
end
Thanks in advance.
source share