Documentation Center

  • Trial Software
  • Product Updates

Create a Rate Rule for an Exponential Rate of Change

You can change the amount of a species similar to a first-order reaction using a first-order rate rule. For example, suppose the species x decays exponentially.

The rate of change of species x is , and its analytical solution is .

Use the following commands to set up a SimBiology model accordingly and simulate it.

m = sbiomodel('m');
c = addcompartment(m,'comp');
s = addspecies(m,'x','InitialAmount',2);
p = addparameter(m,'k','Value',1);
r = addrule(m,'x = -k * x','RuleType','rate');
simdata = sbiosimulate(m);

    Note:   If the amount of a species x is determined by a rate rule and x is also in a reaction, x must have its BoundaryCondition property set to true. For example, with a reaction a -> x and a rate rule , set the BoundaryCondtion property of species x to true so that a differential rate term is not created from the reaction. The amount of x is determined solely by a differential rate term from the rate rule.

    If the BoundaryCondition property is set to false, you will get the following error message such as Invalid rule variable 'x' in rate rule or reaction.

Was this topic helpful?