Main Content


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.

For details, see Selecting Absolute Tolerance and Relative Tolerance for Simulation.


Applies toObject: SolverOptions
Data typedouble
Data valuesPositive scalar that is <1. Default is 1e-3.


This example shows how to change AbsoluteTolerance.

  1. Retrieve the configset object from the modelObj.

    modelObj  = sbiomodel('cell');
    configsetObj = getconfigset(modelObj)
  2. Change the AbsoluteTolerance to 1e-8.

    set(configsetObj.SolverOptions, 'RelativeTolerance', 1.0e-6);
    get(configsetObj.SolverOptions, 'RelativeTolerance')
    ans =