Why does my ODE Solver keep crashing MATLAB?
4 ビュー (過去 30 日間)
古いコメントを表示
I am running the following
function dy = kin1(t, y)
y0 = 0;
yf = 1e-0006;
y = [y0:yf];
dy = 2.1*1e-009 - .4*y - 1.2e-003*y + 2.1e+006*y.^2 - 9.2e-004*y;
t0 = 0; %start time
tf = 100; %end time
[t, y] = ode15s(@kin1, [t0 tf] ,y0); %Solve ODE
And after trying this on several computers with several different versions of Matlab, the program crashes. A few times I got a ??? Maximum recursion limit of 500 reached. Error message.
I feel this should be straight forward as I am following the examples in the Matlab Help pretty closely.
0 件のコメント
回答 (1 件)
Walter Roberson
2012 年 1 月 24 日
Classic problem. Your function kin1 calls upon ode15s, requesting that ode15s call upon the function kin1 to do work. So ode calls kin1, which then calls ode15s, which calls kin1, which calls ode15s which ...
Your call to the ode functions (and any initialization you need to do) must be in a different function or different file than your routine that does the work (e.g., kin1)
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!