フィルターのクリア

Solving a nonlinear ODE with derivative squared

2 ビュー (過去 30 日間)
Travis
Travis 2019 年 2 月 1 日
コメント済み: Bill Greene 2019 年 2 月 4 日
I'm trying to solve a nonlinear ODE which looks something like this:. I know I can use the implicit solver ode15i but the problem is also stiff so I'd prefer to use ode15s. Is it possible to solve this type of nonlinear ode using ode15s? Any suggestions would be appreciated, thank you!
  2 件のコメント
Torsten
Torsten 2019 年 2 月 4 日
As for all quadratic equations, there are two solutions for y'. Do you know which one you'll have to take ?
Bill Greene
Bill Greene 2019 年 2 月 4 日
ode15i is based on backward differentiation formulas so I would expect it to be as effective as ode15s for stiff problems. That has also been my experience with the two solvers. Do you have an example stiff ODE where this is not the case?

サインインしてコメントする。

採用された回答

Star Strider
Star Strider 2019 年 2 月 1 日
編集済み: Star Strider 2019 年 2 月 3 日
One approach:
syms a b c d y(t) T Y
Dy = diff(y);
DE = a*Dy^2 + b*Dy + c*y == d;
isoDE = isolate(DE,Dy)
[VF,Sbs] = odeToVectorField(isoDE)
odefcn = matlabFunction(VF, 'Vars',{T,Y,a b c d});
odefcn = @(T,Y,a,b,c,d)[((b+sqrt(a.*d.*4.0+b.^2-a.*c.*Y(1).*4.0)).*(-1.0./2.0))./a; ((b-sqrt(a.*d.*4.0+b.^2-a.*c.*Y(1).*4.0)).*(-1.0./2.0))./a]
a = 3;
b = 5;
c = 7;
d = 11;
[T,Y] = ode15s(@(T,Y)odefcn(T,Y,a,b,c,d), [0 5], [0;0]);
figure
plot(T, Y)
grid
It works!
  2 件のコメント
Travis
Travis 2019 年 2 月 3 日
Thanks for your help! Do you know if it's possible to solve this nonsymbollically? The actual equation I'm trying to solve is part of a system of PDEs which I'm discretizing in one domain to turn into a system of ODEs so I can use ode15s. So I'm unsure if I'd be able to do that symbolically.
Star Strider
Star Strider 2019 年 2 月 3 日
As always, my pleasure!
I‘m not sure if it’s possible express systems of PDEs in the Symbolic Math Toolbox.
You most likelly need the Partial Differential Equation Toolbox (link). I haven’t used it recently, so I have no recent experience with it.

サインインしてコメントする。

その他の回答 (0 件)

カテゴリ

Help Center および File ExchangeOrdinary Differential Equations についてさらに検索

タグ

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by