Effacer les filtres
Effacer les filtres

How to modify output of an ode?

1 vue (au cours des 30 derniers jours)
Simon
Simon le 17 Sep 2015
Hello,
my ODE looks like:
function [sol] = ode(t,z)
A = z(1);
B = z(2);
C = z(3);
if t = 0.01
B=2;
end
dAdz = B;
....
I like to modify my solution z(1) on the time stept t = 0.01. However, in the next step is A = 0 ( A = z(1) in next step) like the hole time before.
Do you know how I can manipulate the solution of the step t+dt?
Thank you

Réponse acceptée

Steven Lord
Steven Lord le 17 Sep 2015
Solve your ODE up to time t = 0.01. Use the solution at time t = 0.01 to generate a new initial vector for the system of ODEs. Call the ODE solver again with the new initial vector to calculate the solution on the interval from t = 0.01 to your new endpoint.

Plus de réponses (0)

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by