Relative tolerance
Description
Specify the largest acceptable solver error, relative to the size of each state during each time step. If the relative error exceeds this tolerance, the solver reduces the time step size.
Category: Solver
Settings
Default:
1e-3
Setting the relative tolerance to
auto
is actually the default value of1e-3
.The relative tolerance is a percentage of the state's value.
The default value (
1e-3
) means that the computed state is accurate to within 0.1%.
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.
During each time step, the solver computes the state values at the end of the step and also determines the local error – the estimated error of these state values. If the error is greater than the acceptable error for any state, the solver reduces the step size and tries again.
The default relative tolerance value is sufficient for most applications. Decreasing the relative tolerance value can slow down the simulation.
To check the accuracy of a simulation after you run it, you can reduce the relative tolerance to 1e-4 and run it again. If the results of the two simulations are not significantly different, you can feel confident that the solution has converged.
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 Absolute 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:
RelTol |
Type: character vector |
Value: any valid value |
Default:
'1e-3' |
Recommended Settings
Application | Setting |
---|---|
Debugging | No impact |
Traceability | No impact |
Efficiency | No impact |
Safety precaution | No impact |