How to modify output of an ode?

1 次查看(过去 30 天)
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

采纳的回答

Steven Lord
Steven Lord 2015-9-17
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 个)

类别

Help CenterFile Exchange 中查找有关 Ordinary Differential Equations 的更多信息

Community Treasure Hunt

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

Start Hunting!

Translated by