## Documentation |

Allowable error tolerance relative to state value during a simulation

`RelativeTolerance` is a property of the `SolverOptions` object,
which is a property of a `Configset` object. It is
available for the ode solvers (`ode15s`, `ode23t`, `ode45`,
and `sundials`).

The `RelativeTolerance` property specifies
the allowable error tolerance relative to the state vector at each
simulation step. The state vector contains values for all the state
variables, for example, amounts for all the species.

If you set the `RelativeTolerance` at `1e-2`,
you are specifying that an error of 1% relative to each state value
is acceptable at each simulation step.

At each simulation step, the solver estimates the local error `e _{i}` in
the

`|e _{i}|≤max(RelativeTolerance*|y_{i}|,AbsoluteTolerance)`

Thus at higher state values, convergence is determined by `RelativeTolerance`.
As the state values approach zero, convergence is controlled by `AbsoluteTolerance`.
The choice of values for` RelativeTolerance` and `AbsoluteTolerance` will
vary depending on the problem. The default values should work for
first trials of the simulation; however if you want to optimize the
solution, consider that there is a trade-off between speed and accuracy.
If the simulation takes too long, you can increase the values of `RelativeTolerance` and `AbsoluteTolerance` at
the cost of some accuracy. If the results appear to be inaccurate,
you can decrease the tolerance values but this will slow down the
solver. If the magnitude of the state values is high, you can try
to decrease the relative tolerance to get more accurate results.

Applies to | Object: SolverOptions |

Data type | double |

Data values | Positive scalar that is <1. Default is 1e-3. |

Access | Read/write |

This example shows how to change `AbsoluteTolerance`.

Retrieve the

`configset`object from the`modelObj`.`modelObj = sbiomodel('cell'); configsetObj = getconfigset(modelObj)`

Change the

`AbsoluteTolerance`to`1e-8`.set(configsetObj.SolverOptions, 'RelativeTolerance', 1.0e-6); get(configsetObj.SolverOptions, 'RelativeTolerance') ans = 1.0000e-006

Was this topic helpful?