Can ode45 solve a ODE with space dependent parameters?
2 vues (au cours des 30 derniers jours)
Afficher commentaires plus anciens
Marlon Saveri Silva
le 28 Jan 2019
Commenté : James Tursa
le 5 Août 2021
Hello,
I read ode45() can solve functions with time dependent parameters like this below by interpolating f and g during each time step.
y'(t)+f(t)y(t)=g(t)
However, can ode45 (or other solver) solve a system of odes like this below in which [A], [B] and [C] are matrices with some terms dependent of y and y=y(t)?
{dy/dt} = [A]{y^4}+[B]{y}+{C}
Ai=Ai(y)
Bi=Bi(y)
Ci=Ci(y)
Well, since this equation appears in a problem I solve using Simscape (Backward Euler method as default), I suppose I could find a solver to solve it inside Matlab codes without using Simscape.
2 commentaires
Réponse acceptée
James Tursa
le 29 Jan 2019
Yes. In general, if the derivative is a function of current state and time (even if there are vectors or matrices involved), then you can use ode45 to get a numerical solution. The caveat is that the function needs to be "nice" enough for ode45 to handle. Otherwise you may need stiff solvers, etc.
5 commentaires
James Tursa
le 5 Août 2021
@Ying Wu It would be best if you posted a new Question with the details of your particular problem & derivative functions.
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!