## Determining the Stoichiometry Matrix for a Model

### What Is a Stoichiometry Matrix?

A stoichiometry matrix provides stoichiometric information about reactants and products in model reactions. It lets you easily determine:

• The reactants and products in a specific reaction in a model, including the stoichiometric value of the reactants and products

• The reactions that a specific species is part of, and whether the species is a reactant or product in that reaction

A stoichiometry matrix is an M-by-R matrix, where M equals the total number of species in a model, and R equals the total number of reactions in a model. Each row corresponds to a species, and each column corresponds to a reaction.

The matrix indicates which species and reactions are involved as reactants and products:

• Reactants are represented in the matrix with their stoichiometric value at the appropriate location (row of species, column of reaction). Reactants appear as negative values.

• Products are represented in the matrix with their stoichiometric value at the appropriate location (row of species, column of reaction). Products appear as positive values.

• All other locations in the matrix contain a `0`.

For example, consider a `model object` containing two reactions. One reaction (named `R1`) is equal to `2 A + B -> 3 C`, and the other reaction (named `R2`) is equal to `B + 3 D -> 4 A`. The stoichiometry matrix is:

``` R1 R2 A -2 4 B -1 -1 C 3 0 D 0 -3```

### Get Stoichiometry Matrix of SimBiology Model

`m1 = sbmlimport('lotka.xml');`
`[M,objSpecies,objReactions] = getstoichmatrix(m1)`
```M = 4x3 sparse double matrix (5 nonzeros) (2,1) 1 (2,2) -1 (3,2) 1 (3,3) -1 (4,3) 1 ```
```objSpecies = 4x1 cell {'x' } {'y1'} {'y2'} {'z' } ```
```objReactions = 3x1 cell {'Reaction1'} {'Reaction2'} {'Reaction3'} ```