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!

