Absolute tolerance
Description
Specify the largest acceptable solver error, as the value of the measured state approaches zero. If the absolute error exceeds this tolerance, the solver reduces the time step size.
Category: Solver
Settings
Default:
auto
The default value (
auto
) initially sets the absolute tolerance for each state based on the relative tolerance alone. If the relative tolerance is larger than 1e-3, then the initial absolute tolerance is set to 1e-6. However, for relative tolerances smaller than 1e-3, the absolute tolerance for the state is initialized toreltol * 1e-3
. As the simulation progresses, the absolute tolerance for each state is reset to the maximum value that the state has reached until that point, times the relative tolerance for that state.For example, if a state goes from 0 to 1 and the Relative tolerance is 1e-4, then the Absolute tolerance is initialized at 1e-7 and by the end of the simulation, the Absolute tolerance reaches 1e-4.
If, on the other hand, the Relative tolerance is set to 1e-3, the Absolute tolerance is set to 1e-6 and by the end of the simulation, reaches 1e-3.
If the computed setting is not suitable, you can determine an appropriate setting yourself.
If you do set your own value for Absolute tolerance, you can also select whether it adapts based on the value of the states by toggling the
AutoScaleAbsTol
parameter. For more information, see Auto scale absolute tolerance.
Tips
The acceptable error at each time step is a function of both the Relative tolerance and the Absolute tolerance. For more information about how these settings work together, see Error Tolerances for Variable-Step Solvers.
The Integrator, Second-Order Integrator, Variable Transport Delay, Transfer Fcn, State-Space, and Zero-Pole blocks allow you to specify absolute tolerance values for solving the model states that they compute or that determine their output. The absolute tolerance values that you specify in these blocks override the global setting in the Configuration Parameters dialog box.
You might want to override the Absolute tolerance setting using blocks if the global setting does not provide sufficient error control for all your model states, for example, if they vary widely in magnitude.
If you set the Absolute tolerance too low, the solver might take too many steps around near-zero state values, and thus slow the simulation.
To check the accuracy of a simulation after you run it, you can reduce the absolute tolerance and run it again. If the results of the two simulations are not significantly different, you can feel confident that the solution has converged.
If your simulation results do not seem accurate, and your model has states whose values approach zero, the Absolute tolerance may be too large. Reduce the Absolute tolerance to force the simulation to take more steps around areas of near-zero state values.
Dependencies
This parameter is enabled only if you set:
Solver Type to
Variable-step
.Solver to a continuous variable-step solver.
This parameter works along with Relative tolerance to determine the acceptable error at each time step. For more information about how these settings work together, see Error Tolerances for Variable-Step Solvers.
Programmatic Use
Parameter:
AbsTol |
Type: character vector | numeric value |
Value:
'auto' | positive real scalar |
Default:
'auto' |
Recommended Settings
Application | Setting |
---|---|
Debugging | No impact |
Traceability | No impact |
Efficiency | No impact |
Safety precaution | No impact |