How can I use ode15s with a tspan of two elements?
7 ビュー (過去 30 日間)
古いコメントを表示
Hi, I'm using the function ode15s to solve ODE. I don't understand why, with a vector of time with only 2 elements, Matlab automatically chooses the integration step.
If I insert a vector of at least 3 elements, as I expect to see, Matlab returns a vector of the simulated time with the same length. On the contrary, it doesn't happen with a vector of 2 elements.
How can I correct this problem, in order to solve an ODE with only 2 elements in tspan?
Thank you!
0 件のコメント
採用された回答
Jan
2021 年 4 月 8 日
編集済み: Jan
2021 年 4 月 8 日
Why do you assume, that this is a problem?
With applying a tspan vectors with >= 3 elements, the integrators of Matlab perform an interpolation or adjust the step size until the specified time points are reached. But even then the intermediate step sizes are taken according to the step size control. Only the output is adjusted such, that t = tspan.
You can emulate this easily if you need the first and the last value only:
[t, y] = ode15s(...)
t = t([1, end]);
y = y(:, [1, end]);
その他の回答 (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!