this page :
Code:function yprime = myode(t, y, c) yprime = c*y;CBCode:for k = -2:2 [t,y] = ode45(@myode, [0 3], 1, , k); figure plot(t, y) title(['Solution for k = ' num2str(k)]) end
As you can guess from the title, I want to have a for cycle that calls ode45 solver in each iteration, as ode45(odefun, tspan, yinitial).
The differential equation that I define for odefun (in order to dy/dt, for instance) has some parameters that have to assume different values in each iteration. The problem is that I only find examples with odefun receiving t and y as input parameters...
How can I add more input parameters to odefun, in order to import different values for each iteration of the for cycle?
Thanks for all the help!
Passing them to global variables isn't working neither...
BTW, this is part of the code where I call ode45:
[t,Tc]=ode45(@myode, [t_i(n) t_f(n)], Tc_i);
This is the function myode that I defined: