Save variables while using ode solver
Mostra commenti meno recenti
[t,y]=ode45(@fun,tspan,yo);
function dy=fun(t,y)
dy=zeros(3,1);
constant1 = k1*y(3)
dy(1)= constant1;
dy(2)=f1(y(3),y(2))
dy(3)=f2(y(1),y(2))
end
I want to save the variable, constant1, each time the ode solver calls the function fun.
Is there a way to get the iteration count?
If yes, I can use
save_constant1(iter) = constant1.
Any suggestions?
2 Commenti
Steven Lord
il 24 Ott 2019
What do you want to happen if the ODE solver evaluates your function for a particular time step but then rejects that step and evaluates your function at an earlier time (a smaller time step from the previous time?)
Deepa Maheshvare
il 25 Ott 2019
Risposta accettata
Più risposte (0)
Categorie
Scopri di più su Ordinary Differential Equations in Centro assistenza e File Exchange
Prodotti
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!