Why do I get an "odezero: an event disappeared (internal error)" error when using an ODE events function in MATLAB 7.4 (R2007a)?
31 views (last 30 days)
Show older comments
I am trying to use an events function to in my ODE function. However, when I run the attached file 'ode_events_error.m' I am getting the following error message:
??? Error using ==> funfun\private\odezero at 50
odezero: an event disappeared (internal error)
Error in ==> ode45 at 419
[te,ye,ie,valt,stop] = ...
Error in ==> mycode at 10
[r,state,re,statee,ie] = ode45(@(r,state)prbode(r,state,tauc),rspan,stateinit,options);
Accepted Answer
MathWorks Support Team
on 27 Jun 2009
This is a zero-crossing events error. The events locator is incapable of capturing a zero crossing for complex signals.
You can see this by adding the following code to the 'events' subfunction in 'ODE_events_error.m'function:
if ~isreal(state(2))
error('Imaginary Events signal (%g +i%g) at r=%.16f.',real(state(2)),imag(state(2)),r)
end
You will see that during the simulation the value state(2) becomes complex, and the following error message is returned:
??? Error using ==> mycode>events at 37
Imaginary Events signal (4.02767e-009 +i7.46735e-027) at r=2.7392559940601449.
0 Comments
More Answers (0)
See Also
Categories
Find more on Signal Generation and Preprocessing in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!