# Does ode45 hits events depending on the maxStep value?

2 visualizaciones (últimos 30 días)
Philipp el 5 de Dic. de 2012
Hi,
is it possible that solver is hitting events depending on the maxStep value?
In my case the right hand function has some conditions that were called by detected events.
Setting no maxStep, the solution makes no sence, setting it under a certain threhold - it works.
I would like have the advateges of using the varaible steps and hiiting events excactly.
##### 0 comentariosMostrar -2 comentarios más antiguosOcultar -2 comentarios más antiguos

Iniciar sesión para comentar.

### Respuestas (2)

Babak el 5 de Dic. de 2012
As far as for a numerical ODE solver, i.e. ODE45, you can never get anything exact. Your solution is not exact and the events solutions not exact either.
The event's solutions where the solution crosses zero, can never be exact. It can be more precise, if your maxStep is smaller. It may even diverge, if maxStep is too big.
If you want to get exact solutions you need to use MATLAB's Symbolic Math Toolbox, or MAPLE or Mathematica.
##### 0 comentariosMostrar -2 comentarios más antiguosOcultar -2 comentarios más antiguos

Iniciar sesión para comentar.

Philipp el 5 de Dic. de 2012
I know about the excactnes of numerical ode solver. I have to state my problem more precisely.
MaxStep =.01 Everything is ok.
MaxStep =.1 The solver detects two events correctly. then the solver doesn't get one and gets the next again exactly.
no MaxStep: total fail.
Maybe u will answer the same but want to be sure that this behavior can happpen through numerics and not through other infuences. Especially the secound case was a little confusing to me.
##### 2 comentariosMostrar NingunoOcultar Ninguno
Babak el 5 de Dic. de 2012
That's right. It all happens because of the numerics and no other cause. You are doing everything right. Always a tighter MaxStep gives a better solution. If you let MATLAB descide on the MaxStep, it may choose a big MaxStep but in this case of the determinant of the Jacobian matrix becomes really small, MATLAB fails solving the ODE numerically.
Philipp el 6 de Dic. de 2012
Thanky you for this comment!

Iniciar sesión para comentar.

### Categorías

Más información sobre Ordinary Differential Equations en Help Center y File Exchange.

### Community Treasure Hunt

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

Start Hunting!

Translated by