Obtain step sizes of (stiff) ODE solver with fixed time span vector, but variable integration step size
4 ビュー (過去 30 日間)
古いコメントを表示
I am trying to solve a stiff ODE using ode15s. The solver takes a very small step size at some points during the simulation, which I would like to inspect more in-depth.
Depending on the model parameters, the system can have >1000 states, and therefore I am using a time span with fixed step size (Otherwise the states are saved for every tiny step size, which I don't really need, and takes too much RAM). The ODE solver still uses a variable step size (as it should).
However, I would like to obtain the 'actual' time vector used by the ODE solver, to analyse why the solver takes such small steps for some states/transisiton. How can I obtain this time vector, in addition to the fixed step size time vector t and state matrix y?
An example:
tspan = [0 2000];
tstep = 10;
tspan_fix = tspan(1):tstep:tspan(2);
[t_fix,y_fix] = ode15s(@vdp1000, tspan_fix, [2 0]);
tspan_var = tspan;
[t_var,y_var] = ode15s(@vdp1000, tspan_var, [2 0]);
figure(1); clf;
subplot(211)
plot(t_fix,y_fix(:,1),'-o')
subplot(212)
plot(t_var,y_var(:,1),'-o')
So as you can see, ode15s will in both cases use variable step size, but the points at which the solution is evaluated is different. This I want to keep with fixed step size, but it'd be interesting to see where the solver is taking these small steps.
0 件のコメント
回答 (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!