Solving system of ODEs
1 vue (au cours des 30 derniers jours)
Afficher commentaires plus anciens
I have a system of DEs similar to the following:
If the variable Z is not present (i.e. eq (3) also), then I can solve it using ode45 command.
But the availability of Z is creating problem for me. To get the value of Z at time t, we have to solve the ODE (3) from time 0 to \tau, then we have to put that value of Z in equation (2), for evey instance 't'.
The main problem is, while solving DE using ode45, at any instance t, MATLAB uses the values of variables at that instance only. But here we require values of variables at time (t-\tau) to use at time t.
Please help me to solve the problem. Thanks in advance.
![MTLB-page.jpg](https://www.mathworks.com/matlabcentral/answers/uploaded_files/231690/MTLB-page.jpeg)
2 commentaires
Réponses (2)
darova
le 29 Juil 2019
Modifié(e) : darova
le 29 Juil 2019
What if just solve 2 systems?
First one (t <= tau) with initial conditions: X(0) = X0, Y(0) = Y0
![](https://www.mathworks.com/matlabcentral/answers/uploaded_files/231722/image.png)
![](https://www.mathworks.com/matlabcentral/answers/uploaded_files/231723/image.png)
[t, Var] = ode45(...); % ODE solve
X= Var(:,1);
Y= Var(:,2);
x0 = X(end); % initial conditions for 2d system
y0 = Y(end);
Second (t >= tau) with Z(tau) = Z0 (X and Y initial conditions give from the first solution)
![](https://www.mathworks.com/matlabcentral/answers/uploaded_files/231722/image.png)
![](https://www.mathworks.com/matlabcentral/answers/uploaded_files/231725/image.png)
![](https://www.mathworks.com/matlabcentral/answers/uploaded_files/231726/image.png)
What do you think about my idea?
4 commentaires
Steven Lord
le 29 Juil 2019
I only skimmed your problem but it looks like when Z is not present, you have a set of ordinary differential equations. Once Z comes into the picture, you no longer have a set of ordinary differential equations. Your equations are now delay differential equations. Use the ODE solvers to solve the system until t reaches tau, then use the DDE solvers (like dde23 or ddesd) to solve the system using the results from the ODE solvers as the history.
0 commentaires
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!