Making sure the maximum calculated value in my function is represented in ode15s output.
조회 수: 2 (최근 30일)
이전 댓글 표시
I've used ode15s to solve a system of ODEs and then plotted the results. However when I do that, the peak calculated value in my function (which I would like to show on my graph) is not outputted by ode15s and hence my plotted peak does not actually show the true peak value.
Due to the stiffness of my ODEs, I cannot just increase the number of values I have, so I was wondering if there is a way to output the calculated maximum point from my function while using ode15s?
Any help would be much appreciated.
댓글 수: 3
Piotr Balik
2021년 1월 8일
If you have stepwise defined derivative, how about computing ode at three intervals? Start of the following one would be the last point of the former.
채택된 답변
Jan
2021년 1월 9일
ODE15S is designed to integrate smooth functions, as the other ODE integrators of MATLAB are. Running it with this not differentiable function replies a trajectory, which is not a "reliable result". The maximum value might be dominated by random rounding errors.
Prefer to run 3 integrations for the different time intervals using the final value of the former one as initial value for the next. After joining the trajectories you have a reliable output including the wanted maximum value.
댓글 수: 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!