Absolute and Relative Tolerances

12 views (last 30 days)
Hi,
I'd like to know what are the maximum and minimum significative values of RelTol and AbsTol ? I couldn't find the solution on Google or in the previous subjects in MathWork.
Thanks.

Accepted Answer

Sebastian Castro
Sebastian Castro on 13 Mar 2015
Edited: Sebastian Castro on 13 Mar 2015
These are tolerance metrics used by variable-step solvers in Simulink. They are used to answer the question: "should the solver take a smaller time-step because the errors are too high?"
For example, let's take the variable-step solver ode45. According to the documentation, "This Runge-Kutta (4,5) solver is a fifth-order method that performs a fourth-order estimate of the error."
If this error estimate is above your specified tolerances, your solver will take a step back and reduce the time-step with hopes of reducing that error to an acceptable level.
Now, here's where AbsTol and RelTol come in. Simulink combines both of these tolerances so your solver doesn't get "stuck" in situations that have very small or very large integrator state values.
tolerance = max( AbsTol, RelTol*|state| )
If the state is very small, the relative tolerance multiplied by the state value will also be very small... so in this situation, the absolute tolerance dictates a hard lower bound on the error tolerance.
If the state is very large, on the other hand, the absolute tolerance would be too small and restrictive... so the relative tolerance dominates here.
For more information, check out this documentation page . Go to "Choosing a Variable-Step Solver" and look for the "Specifying Error Tolerances for Variable-Step Solvers" sub-heading.
- Sebastian
  1 Comment
jin wang
jin wang on 11 Jan 2018
Your explanation has been very helpful. The tolerance sometimes are used in the optimization problem.
Lets say I am using fminsearch function to search for a minimum returned value from a optimization function. I have stated my tolerance in option arguments that pass to fminsearch.
But I have no idea the tolerance I set is absolute or relative. Is it being affected by the 2017a updates like the solver is?
Thank you.

Sign in to comment.

More Answers (0)

Community Treasure Hunt

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

Start Hunting!