MATLAB Answers

ode45 with events returns event that did not happen

3 views (last 30 days)
sivan levi
sivan levi on 6 Aug 2019
Commented: sivan levi on 7 Aug 2019
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 Comment

sivan levi
sivan levi on 7 Aug 2019
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."

Sign in to comment.

Answers (0)

Products


Release

R2018b

Translated by