solving an implicit ordinary differential equation
5 Ansichten (letzte 30 Tage)
Ältere Kommentare anzeigen
I have to differential equations and I'm trying to solve these using ode45 or ode15 in Matlab:
dP/dt= f(R,P,dR/dt)
dR/dt=f(R,P)
any idea how I can solve these two equations ?
0 Kommentare
Antworten (1)
David Goodmanson
am 12 Jan. 2019
Hi Nariman,
I assume that the two functions you show as f are not the same function, so I will denote the second one as g. And you don't say whether P and R are scalars, so I assume they are column vectors of size m and n respectively. The input to ode45 is a column vector [P ; R] of length m+n, and so is the output vector [dP/dt ; dR/dt]. You have
dP/dt = f(R,P,dR/dt)
dR/dt = g(P,R)
which, using substitution and composition of functions is the same as
dP/dt = f(R,P,g(P,R))
dR/dt = g(P,R)
so the output d/dt vector is determined by these equations.
2 Kommentare
David Goodmanson
am 14 Jan. 2019
Hi Nariman, you should run this and see. It's a valuable thing to do because the error message is very informative, and otherwise you are operating in a vacuum.
When you run it, you will find that f has no way of knowing what dR/dT is, since it is not supplied on input. (Since it is in dR/dT form and not denoted as a single variable such as dRdT, f does not know what either of dR or dT are. So it coughs up and error message about dR). In place of dR/dT you need to insert the equivalent expression in terms of x(1) and x(2), but you already have that.
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!