Event Detecting in Event-based ODE

6 Ansichten (letzte 30 Tage)
Mostafa Nazmi
Mostafa Nazmi am 11 Jun. 2021
Kommentiert: Bjorn Gustavsson am 14 Jun. 2021
Greetings. I'm trying to detect an event of a variable value crossing tha value of zero. The problem I'm facing is that the ode solver is detecting the value at 0.1*(1.0e-14) instead of zero. I'm using ode45 and the odeset options below:
ODEopts = odeset('Events', @event, 'Refine', 8, 'RelTol',...
10^-6, 'AbsTol', 10^-6);
Can I solve this issue by changing the options or the solver?
Thanks in advance

Akzeptierte Antwort

Bjorn Gustavsson
Bjorn Gustavsson am 11 Jun. 2021
In order to advice the contents of the event-function is necessary. The only thing to point out is that the ode-solvers use numerical precision of 32-bit(?) doubles - and 1e-14 look like a "reasonable default" setting of zero-detection. If your use-case is something on atomic scales and you use metres as units for your spatial coordinates (convert to what is sensible to your case) then 1e-14 m is clearly not a good enough precision for an event, but ode45 wouldn't know. Your easiest way forward is then to rescale the ODEs to use Å for your spatial coordinates.
HTH
  2 Kommentare
Mostafa Nazmi
Mostafa Nazmi am 13 Jun. 2021
Thanks for your advice sir
Bjorn Gustavsson
Bjorn Gustavsson am 14 Jun. 2021
Happy to have helped.

Melden Sie sich an, um zu kommentieren.

Weitere Antworten (0)

Produkte


Version

R2020b

Community Treasure Hunt

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

Start Hunting!

Translated by