Originally Posted by
rber Hi guys,
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!
From this page :
Example:
Code:
function yprime = myode(t, y, c)
yprime = c*y;
Code:
for k = -2:2
[t,y] = ode45(@myode, [0 3], 1, [], k);
figure
plot(t, y)
title(['Solution for k = ' num2str(k)])
end
CB