solving an implicit ordinary differential equation
5 ビュー (過去 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!