ode45 with events returns event that did not happen

1 次查看(过去 30 天)
Hello,
i am using ode 45 with events and am having a problem i do not understand.
the problem is that i have defined the event in an event function and when i track the events values i clearly see that one goes to zero and the others do not so i am expacting one event as an output but i am recieving two event.
the other event clearly is not zero.
the codes i am using
ode45 options:
op_slip=odeset('reltol',tol,'abstol',tol,'Events',@events_slip);
ode 45 call:
[Tsl,Xsl,Tesl,Xesl,Iesl]=ode45(@sys_slip,Tsim,X0,op_slip);
tracking the events graphically:
the blue plot (data1) is the event that heppend and the red one (data2) is the event that the functions says that happened even thpough its value isnt 0
the output Iesl is [2;1]
can anyone shed some light on this problem? i am at a loss
thank you
  1 个评论
sivan levi
sivan levi 2019-8-7
Found out what went wrong.
if an event occurs at t=0 the event function does not terminate
from documantation under limitations:
"If a terminal event occurs during the first step of the integration, then the solver registers the event as nonterminal and continues integrating."

请先登录,再进行评论。

回答(0 个)

类别

Help CenterFile Exchange 中查找有关 Ordinary Differential Equations 的更多信息

产品


版本

R2018b

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by