How to solve ODE's and find m(t) using matlab? Urgent!!

1 回表示 (過去 30 日間)
Shubham Maurya
Shubham Maurya 2014 年 7 月 25 日
コメント済み: Star Strider 2014 年 7 月 26 日
Here is the given ODE for which I need a solution:
Please help me on how to do this!!!
  2 件のコメント
Ben11
Ben11 2014 年 7 月 25 日
Do you have the Symbolic Math Toolbox?
Shubham Maurya
Shubham Maurya 2014 年 7 月 26 日
No, where it is?

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

採用された回答

Star Strider
Star Strider 2014 年 7 月 25 日
編集済み: Star Strider 2014 年 7 月 25 日
Use ode45. It’s five lines of code, including the plot:
mdot = @(t,m) sqrt(2E+5.*((1+(0.4-m)./0.5).^-1.4 - 1));
[t,m] = ode45(mdot, [0 1], 0.001);
figure(1)
semilogy(t, real(m), '-b', t, imag(m), '-g')
grid
  3 件のコメント
Shubham Maurya
Shubham Maurya 2014 年 7 月 26 日
My initial value is m(0)=0.4, and domain of t is [0,0.5]
Star Strider
Star Strider 2014 年 7 月 26 日
Since I did’t have other information, I chose m(0)=0.001 and ran it from [0 1] in time. With your m(0)=0.4 and time span [0 0.5] the call to ode45 is:
[t,m] = ode45(mdot, [0 0.5], 0.4);
and the entire code is now:
mdot = @(t,m) sqrt(2E+5.*((1+(0.4-m)./0.5).^-1.4 - 1));
[t,m] = ode45(mdot, [0 0.5], 0.4);
figure(1)
plot(t, m, '-*b')
grid
axis([xlim 0 0.5])
With the square root, I’m somewhat surprised that there aren’t two solutions, for instance ±0.4 but the routine produces only one. Yours is a nonlinear equation, and the Symbolic Math Toolbox cannot solve it. (I have it, and I tried that to see what it would do. There is no analytic solution.)
The output doesn’t change from the initial conditions, and is uniformly 0.4 from 0 to 0.5.

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

その他の回答 (0 件)

カテゴリ

Help Center および File ExchangeSymbolic Math Toolbox についてさらに検索

Community Treasure Hunt

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

Start Hunting!

Translated by