Main Content


Species coefficients in reaction


The Stoichiometry property specifies the species coefficients in a reaction. Enter an array of doubles indicating the stoichiometry of reactants (negative value) and products (positive value). Example: [-1 -1 2].

The double specified cannot be 0. The reactants of the reaction are defined with a negative number. The products of the reaction are defined with a positive number. For example, the reaction 3 H + A-> 2 C + F has the Stoichiometry value of [-3 -1 2 1].

When this property is configured, the Reaction property updates accordingly. In the above example, if the Stoichiometry value was set to [-2 -1 2 3], the reaction is updated to 2H + A -> 2C + 3F.

The length of the Stoichiometry array is the sum of the Reactants array and the Products array. To remove a product or reactant from a reaction, use the rmproduct or rmreactant function. Add a product or reactant and set stoichiometry with methods addproduct and addreactant.

ODE solvers support double stoichiometry values such as 0.5. Stochastic solvers and dimensional analysis currently support only integers in Stoichiometry, therefore you must balance the reaction equation and specify integer values for these two cases.

A -> null has a stoichiometry value of [-1]. null -> B has a stoichiometry value of [1].


Applies toObject: reaction
Data type Double array
Data values1-by-n double, where n is length (products) + length (reactants). Default is [ ] (empty).


  1. Create a reaction object.

    modelObj = sbiomodel('cell');
    reactionObj = addreaction(modelObj, '2 a + 3 b -> d + 2 c');
  2. Verify the Reaction and Stoichiometry properties for reactionObj.


    MATLAB® returns:

    ans =
    -2    -3     1     2
  3. Set stoichiometry to [-1 -2 2 2].

    set (reactionObj, 'Stoichiometry', [-1 -2 2 2]);
    get (reactionObj, 'Stoichiometry')

    MATLAB returns:

    ans =
     -1    -2     2     2
  4. Note with get that the Reaction property updates automatically.

    get (reactionObj, 'Reaction')

    MATLAB returns:

    ans =
    a + 2 b -> 2 d + 2 c