ODE 45 integration control
이전 댓글 표시
I've been having some issues with running ODE45 on a model that is very flat unless forced with a very short duration square wave, in which case it forms a spike and returns to the baseline. The adaptive time step of ODE45 is causing the time step to be larger than the interval the model is forced for, and skipping the spikes (unless by chance, one of the t values lies in the forcing interval).
Is there any way to control the internal time steps used by the solver? I would like to be able to supply a list of time values and ensure that ode45 evaluates my function at those points. Elsewhere it can do what it likes I just need to make sure the function is evaluated within the forcing interval to trigger the shorter step size.
Many thanks,
Harry
채택된 답변
추가 답변 (1개)
Mischa Kim
2014년 5월 2일
Harry, in
...
tspan = linspace(0,1,11);
options = odeset('AbsTol',1e-8);
[t,X] = ode45(@ODE,tspan,IC,options);
for which the solver returns the solution at specific data points defined by tspan. You can further use the options vector with odeset to control other solver options such as tolerances, step size, etc.
카테고리
도움말 센터 및 File Exchange에서 Classical Control Design에 대해 자세히 알아보기
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!