Help solving 2 ODEs
1 回表示 (過去 30 日間)
古いコメントを表示
W(0)=0; W(f)=2.8; d(P)/d(W)=((-0.3743)/(2*P))*(1-(0.15*X)); P(0)=1; d(X)/d(W)=0.5*((0.08*(0.75*(1-X)))/(1-(0.15*X))); X(0)=0; Trying to solve these two ODEs
0 件のコメント
採用された回答
Star Strider
2018 年 10 月 24 日
Try this:
PX_ODE = @(W,PX) [((-0.3743)./(2*PX(1))).*(1-(0.15*PX(2))); 0.5*((0.08*(0.75*(1-PX(2))))./(1-(0.15*PX(2))))];
[W,PX] = ode15s(PX_ODE, [0, 2.8], [1; 0]);
figure
plot(W, PX)
grid
Here ‘P’ is ‘PX(1)’, ‘X’ is ‘PX(2)’. The system encounters a singularity at 2.67, and the integration stops.
5 件のコメント
Star Strider
2018 年 10 月 24 日
That certainly works, although ‘P(0)’ cannot be zero. If ‘X(0)’ is greater than 1, the system will integrate out to 2.8.
Also, ‘fun’ is essentially the same as my code, and the result is the same. (The system is ‘stiff’, so ode15s or another stiff solver is more appropriate.)
その他の回答 (0 件)
参考
カテゴリ
Help Center および File Exchange で Ordinary Differential Equations についてさらに検索
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!