results is NaN help

2 ビュー (過去 30 日間)
Rajeev Ray
Rajeev Ray 2017 年 12 月 7 日
コメント済み: Rajeev Ray 2017 年 12 月 8 日
function dydt = odefcn(t,y,A,B,C) dydt = zeros(2,1); dydt(1) = -A*y(1)-((B*y(1)^2)/(t^0.5))+C*y(2); dydt(2) = ((0.5*B*y(1)^2)/(t^0.5))-C*y(2); end
A = 0.000001; B = 0.05; C = 0.15; tspan = [0 10]; y0 = [0 0.0001]; [t,y] = ode45(@(t,y) odefcn(t,y,A,B,C), tspan, y0); plot(t,y(:,1),'-o',t,y(:,2),'-.')
It is giving results NaN NaN please help

回答 (1 件)

Torsten
Torsten 2017 年 12 月 7 日
You divide by t^0.5. So don't start with t=0, but with t=a small value.
Best wishes
Torsten.
  1 件のコメント
Rajeev Ray
Rajeev Ray 2017 年 12 月 8 日
Thank You very much..

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

カテゴリ

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

タグ

Community Treasure Hunt

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

Start Hunting!

Translated by