Skip to Main Content Skip to Search
Product Documentation

RelativeTolerance - Specify allowable error relative to component

Description

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, species amounts for all the species.

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

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 ei in the ith state vector y. Simulation converges at that time step if ei satisfies the following equation:

|ei|≤max(RelativeTolerance*|yi|,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.

Characteristics

Applies toObject: SolverOptions
Data typedouble
Data values>0, <1. Default is 1e-3.
AccessRead/write

Examples

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 =
    
      1.0000e-006

See Also

AbsoluteTolerance

  


Free Computational Biology Interactive Kit

See how to analyze, visualize, and model biological data and systems using MathWorks products.

Get free kit

Trials Available

Try the latest computational biology products.

Get trial software
 © 1984-2012- The MathWorks, Inc.    -   Site Help   -   Patents   -   Trademarks   -   Privacy Policy   -   Preventing Piracy   -   RSS