solve 3rd order differential equation

3 ビュー (過去 30 日間)
Yashika
Yashika 2020 年 9 月 13 日
コメント済み: Ameer Hamza 2020 年 9 月 13 日
Dear Matlab Users,
I am struggling for solving a complicated 3rd order differential equation. Kindly suggest some guidelines for solving following differential equation with inintial conditions, h=0.1, h' = 0.3, h'' = 1. I refer ode45, solvng differential equation pages, here I am not able to convert this equation in the form of h'''+h''+h'+h = f(r).
Thank you.
Yashika

採用された回答

Ameer Hamza
Ameer Hamza 2020 年 9 月 13 日
If you have the symbolic toolbox, then you can use odeToVectorField to convert your ODE into the standard form of H' = f(r, H) needed for ode45. For example
syms h(r)
term1 = (diff(h, r, 2) + 1/r*diff(h, r, 1) + 1/r*diff(h, r, 1)^3)/(1 + diff(h, r, 1)^2)^(3/2);
rhs = 2*r - r^2*h^3*diff(term1, r, 1);
lhs = h/r + diff(h, r, 1);
eq = lhs == rhs;
V = odeToVectorField(eq);
odefun = matlabFunction(V, 'Vars', {'r', 'Y'}); % Y denotes h here.
IC = [0.1; 0.3; 1];
rspan = [0 10];
[r_sol, h_sol] = ode45(odefun, rspan, IC);
However, there seems to be a singularity in the ODE, or there is a typing mistake, the ode45 gives NaN output.
  2 件のコメント
Yashika
Yashika 2020 年 9 月 13 日
Dear Ameer,
I am extremely grateful for your humble reply and for the code with explaination. I checked it, equation has no typing mistake. There could be sigularity at some point. I will check for the r domain where non-singular solution occur.
Regards,
Yashika
Ameer Hamza
Ameer Hamza 2020 年 9 月 13 日
I am glad to be of help!

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

その他の回答 (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