How to calculate ode45 of system of equations with particular initial conditions?
1 vue (au cours des 30 derniers jours)
Afficher commentaires plus anciens
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 commentaires
Réponse acceptée
Jan
le 15 Mai 2021
Modifié(e) : Jan
le 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 commentaires
Plus de réponses (0)
Voir également
Catégories
En savoir plus sur Ordinary Differential Equations dans Help Center et File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!