How to set Variable-step in ODE15s?
古いコメントを表示
I am trying to solve ODE using ODE15s, but when I change the Variable-step, the result changes. So how to set the step? Thanks.
[t,N]=ode15s(odefun,[0:5:2000],NN0);
The resulet is like the first image. When I changed the step to 10,the result is like the second image.
4 件のコメント
"The resulet is like the first image. When I changed the step to 10,the result is like the second image."
They both look fine to me. When you change the requested t values, of course the outputs will be different. And for a curve with such a sharp peak like that, of course the curves might look slightly different. I don't see what the problem is.
Plot them on the same axes, or set the Y limits to be the same, and you will see that they are the same curve.
ZHUEN RUAN
2018 年 10 月 5 日
KSSV
2018 年 10 月 5 日
plot both the curves on the same using hold on then you will get know.....use different steps and plot..at one time step..your values get converged..this would be the required time step.
ZHUEN RUAN
2018 年 10 月 5 日
採用された回答
その他の回答 (1 件)
Bruno Luong
2018 年 10 月 5 日
編集済み: Bruno Luong
2018 年 10 月 5 日
[t,N]=ode15s(odefun,[0:5:2000],NN0);
Don't be confuse, the vector in tspan does not specify the solver step, just the solution values to be output at intermediate points you have specified.
カテゴリ
ヘルプ センター および File Exchange で Fit Postprocessing についてさらに検索
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!

