# Documentation

### This is machine translation

Translated by
Mouseover text to see original. Click the button below to return to the English verison of the page.

## Sensitivity Calculation

Calculating sensitivities lets you determine which species or parameter in a model is most sensitive to a specific condition (for example, a drug), defined by a species or parameter. Calculating sensitivities calculates the time-dependent sensitivities of all the species states with respect to species initial conditions and parameter values in the model.

Thus, if a model has a species `x`, and two parameters `y` and `z`, the time-dependent sensitivities of `x` with respect to each parameter value are the time-dependent derivatives

`$\frac{\partial x}{\partial y},\frac{\partial x}{\partial z}$`

where, the numerator is the sensitivity output and the denominators are the sensitivity inputs to sensitivity analysis.

### Model Requirements for Calculating Sensitivities

Sensitivity analysis is supported only by the ordinary differential equation (ODE) solvers. The software calculates local sensitivities by combining the original ODE system for a model with the auxiliary differential equations for the sensitivities. The additional equations are derivatives of the original equations with respect to parameters. This method is sometimes called “forward sensitivity analysis” or “direct sensitivity analysis”. This larger system of ODEs is solved simultaneously by the solver.

SimBiology® sensitivity analysis uses “complex-step approximation” to calculate derivatives of reaction rates. This technique yields accurate results for the vast majority of typical reaction kinetics, which involve only simple mathematical operations and functions. When a reaction rate involves a nonanalytic function, this technique can lead to inaccurate results. In this case, either sensitivity analysis is disabled, or sensitivity analysis warns you that the computed sensitivities may be inaccurate. An example of such a nonanalytic function is the MATLAB® function `abs`. If sensitivity analysis gives questionable results on a model whose reaction rates contain unusual functions, you may be running into limitations of the complex-step method. Contact MathWorks Technical Support for additional information.

### Note

Models containing the following active components do not support sensitivity analysis:

• Nonconstant compartments

• Algebraic rules

• Events

### Note

You can perform sensitivity analysis on a model containing repeated assignment rules, but only if the repeated assignment rules do not determine species or parameters used as inputs or outputs in sensitivity analysis.

### Calculate Sensitivities using sbiosimulate or SimFunctionSensitivity Object

You can calculate sensitivities using `sbiosimulate` or the `SimFunctionSensitivity object`.

#### Calculate using sbiosimulate

Set the following properties of the `SolverOptions` property of your `configset` object, before running the `sbiosimulate` function:

• `SensitivityAnalysis` — Set to `true` to calculate the time-dependent sensitivities of all the species states defined by the `Outputs` property with respect to the initial conditions of the species and the values of the parameters specified in `Inputs`.

• `SensitivityAnalysisOptions` — An object that holds the sensitivity analysis options in the configuration set object. Properties of `SensitivityAnalysisOptions` are:

After setting `SolverOptions` properties, calculate the sensitivities of a model by providing the `model object` as an input argument to the `sbiosimulate` function.

The `sbiosimulate` function returns a `SimData object` containing the following simulation data:

• Time points, state data, state names, and sensitivity data

• Metadata such as the types and names for the logged states, the configuration set used during simulation, and the date of the simulation

A `SimData object` is a convenient way of keeping time data, state data, sensitivity data, and associated metadata together. A `SimData object` has properties and methods associated with it, which you can use to access and manipulate the data.

For illustrated examples, see:

#### Calculate using SimFunctionSensitivity object

Create a ```SimFunctionSensitivity object``` using the `createSimFunction` specifying the `'SensitivityOutputs'` and `'SensitivityInputs'` name-value pair arguments. Then execute the object. For an illustrated example, see Calculate Sensitivities Using SimFunctionSensitivity Object.

### References

Ingalls, B.P, and Sauro, H.M. (2003). Sensitivity analysis of stoichiometric networks: an extension of metabolic control analysis to non-steady state trajectories. J Theor Biol. 222(1), 23–36.

Martins, J.R.R.A., Sturdza, P., and Alanso, J.J. (Jan. 2001). The connection between the complex-step derivative approximation and algorithmic differentiation. AIAA Paper 2001–0921.

Martins, J.R.R.A., Kroo, I.M., and Alanso, J.J. (Jan. 2000). An automated method for sensitivity analysis using complex variables. AIAA Paper 2000–0689.