How do you set up an ode solver with a more than one function in the ode?
Mostra commenti meno recenti
For example, if you have an ode such as a*df(t)/dt + b*dg(t)/dt + f(t) + g(t) + c = 0 that you'd like to solve and if you want to set one of the derivatives to be zero, how do you do that?
(By "ode solver" in the title I mean solve numerically.)
4 Commenti
Sam Chak
il 8 Ott 2023
Hi @L'O.G.
Please correct me if I'm wrong. In your update, you mentioned that you want to numerically solve the ODE of this form:

I'm not so sure, but this form looks like the first-order "Exact differential equation," and I don't remember how to solve it on pen and paper. Suppose that
, and
. If
and
, then the equation is balanced:
and
, then the equation is balanced:
.
L'O.G.
il 8 Ott 2023
Walter Roberson
il 8 Ott 2023
Use ode15i
Risposte (2)
If you have two unknown functions (f and g), you need two equations.
syms f(t) g(t) a b c
df = diff(f);
dg = diff(g);
eqn = a*df + b*dg + f(t) + g(t) + c == 0
sol = dsolve(eqn, g)
eqn2 = subs(diff(sol.f), t, 0) == 0
constant_of_integration = setdiff( symvar(eqn2), [a b c])
solution_for_constant = solve(eqn2, constant_of_integration)
subs(subs(eqn, sol), constant_of_integration, solution_for_constant)
subs(sol, constant_of_integration, solution_for_constant)
Categorie
Scopri di più su Ordinary Differential Equations in Centro assistenza e File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!
