solving an implicit ordinary differential equation
10 次查看(过去 30 天)
显示 更早的评论
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 个评论
回答(1 个)
David Goodmanson
2019-1-12
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 个评论
David Goodmanson
2019-1-14
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.
另请参阅
类别
在 Help Center 和 File Exchange 中查找有关 Ordinary Differential Equations 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!