Solving a third order ODE in MATLAB

28 ビュー (過去 30 日間)
Sergio Manzetti
Sergio Manzetti 2018 年 2 月 9 日
編集済み: Sergio Manzetti 2018 年 2 月 15 日
Hi, MATLAB is quite about this command:
syms a h Y(x) g x B E T
D3Y = diff(Y, 3)
eqn = a.*D3Y -0.5*x^2*Y == (abs(Y))
D2Y = diff(Y, 2)
DY = diff(Y)
cond1 = Y(0) == 1;
cond2 = DY(0) == 0;
cond3 = D2Y(0) == 0
Y(x) = dsolve(eqn, cond1, cond2, cond3)
latex(Y(x))
Is there a limit here for solving it? Thanks

採用された回答

Karan Gill
Karan Gill 2018 年 2 月 12 日
Do you not get this warning? If you got it, was the warning clear?
Warning: Unable to find explicit solution.
> In dsolve (line 201)
Y(x) =
[ empty sym ]
Try solving numerically using ode45 or similar.
  2 件のコメント
Sergio Manzetti
Sergio Manzetti 2018 年 2 月 13 日
Yes I did, but I was surprised, because it is readily solved using other methods. I will check out ode45, however I am not sure it will give an analytical solution.
Karan Gill
Karan Gill 2018 年 2 月 13 日
What do you mean by "other methods"?

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

その他の回答 (3 件)

Sergio Manzetti
Sergio Manzetti 2018 年 2 月 14 日
Wolfram alpha, it solves it without any problems.
  2 件のコメント
Sergio Manzetti
Sergio Manzetti 2018 年 2 月 14 日
Thanks
Karan Gill
Karan Gill 2018 年 2 月 14 日
編集済み: Karan Gill 2018 年 2 月 14 日
Is this what you tried? Didn't work for me.
Could you post your input to Wolfram?

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


Sergio Manzetti
Sergio Manzetti 2018 年 2 月 15 日
編集済み: Sergio Manzetti 2018 年 2 月 15 日
I tried this on wolfram, which is the equivalent of this:
syms a h Y(x) g x B E T
D3Y = diff(Y, 3)
eqn = a.*D3Y -0.5*x^2*Y == Y
D2Y = diff(Y, 2)
DY = diff(Y)
cond1 = Y(0) == 1;
cond2 = DY(0) == 0;
cond3 = D2Y(0) == 1;
Y(x) = dsolve(eqn, cond1, cond2, cond3)
latex(Y(x))
and I got a result,Z = 1/3*(exp(x) + 2*exp(-x/2)*cos((sqrt(3)*x)/2)) , however, the result is now non-visible because of std computation time exceeded.
  3 件のコメント
Karan Gill
Karan Gill 2018 年 2 月 15 日
Thanks for catching that. I also noticed the third condition is different.
Torsten
Torsten 2018 年 2 月 15 日
... and I'm surprised that the solution does not depend on "a".

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


Sergio Manzetti
Sergio Manzetti 2018 年 2 月 15 日
It doesn't matter, abs(Y) did not yield results with either methods, while the former, Y, yielded result only in wolfram.
  2 件のコメント
Karan Gill
Karan Gill 2018 年 2 月 15 日
Thanks for the clarifications. I'll investigate. Note that cond3 is different in your two codes.
Sergio Manzetti
Sergio Manzetti 2018 年 2 月 15 日
編集済み: Sergio Manzetti 2018 年 2 月 15 日
Yes, I am aware of that.
Torsten, are there alternative ways to solve:
D3y - x^2y = ay, where a is some constant?

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

Community Treasure Hunt

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

Start Hunting!

Translated by