How to calculate ode45 of system of equations with particular initial conditions?
1 view (last 30 days)
Show older comments
Let's say that we have system of equations (I put some random values) such as:
for
I don't know how to type initial conditions different than these for t=0 in ode45. Is there an easy way to calculate ode45 with this or any similar system of equations?
0 Comments
Accepted Answer
Jan
on 15 May 2021
Edited: Jan
on 15 May 2021
This looks trivial actually. Your initial values are:
y0 = [5, 12]
It is not required, that the initial time is 0. You can start at t=1 also without any limitations.
But if you do need the trajectory from t=0 to t=tEnd, start at t=1 with the known initial conditions and integrate backwards:
y0 = [5, 12];
[t, y] = ode45(@YourODE, [1, 0], y0);
Now t(end) = 0 and y(end, :) is the trajectory for t=0.
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!