How to calculate ode45 of system of equations with particular initial conditions?
1 Ansicht (letzte 30 Tage)
Ältere Kommentare anzeigen
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 Kommentare
Akzeptierte Antwort
Jan
am 15 Mai 2021
Bearbeitet: Jan
am 15 Mai 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 Kommentare
Weitere Antworten (0)
Siehe auch
Kategorien
Mehr zu Ordinary Differential Equations finden Sie in Help Center und File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!