How to modify output of an ode?
2 views (last 30 days)
Show older comments
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
0 Comments
Accepted Answer
Steven Lord
on 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.
0 Comments
More Answers (0)
See Also
Categories
Find more on Ordinary Differential Equations in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!