Main Content

addparameter

Create parameter object and add to model or kinetic law object

Description

parameterObj = addparameter(modelKineticLawObj,parameterName) creates and returns a Parameter object parameterObj. The function also assigns

  • parameterName to the Name property of parameterObj.

  • modelKineticLawObj to the Parent property of parameterObj.

  • parameterObj to the Parameters property of the model object or kinetic law object modelKineticLawObj.

  • A value of 1 to the Value property of parameterObj.

example

parameterObj = addparameter(modelKineticLawObj,parameterName,parameterValue) also assigns the Value property of parameterObj to parameterValue.

parameterObj = addparameter(___,Name=Value) also sets the properties of the parameter object using one or more name-value arguments. Name is the property name and Value is the corresponding value.

example

Examples

collapse all

Create a model and add a reaction.

modelObj = sbiomodel('my_model');
reactionObj = addreaction(modelObj,'a + b -> c + d');

Define a kinetic law for the reaction object.

kineticlawObj = addkineticlaw(reactionObj, 'MassAction');

Add a parameter and assign it to the kinetic law object.

parameterObj1 = addparameter(kineticlawObj,'K1');

Add parameter with value 0.9 to the model object.

parameterObj2 = addparameter(modelObj,'K2',0.9);

Use get to retrieve a list of parameters that are scoped to the kinetic law object and model object.

get(kineticlawObj,'Parameters')
ans = 
   SimBiology Parameter Array

   Index:    Name:    Value:    Units:
   1         K1       1               

get(modelObj,'Parameters')
ans = 
   SimBiology Parameter Array

   Index:    Name:    Value:    Units:
   1         K2       0.9             

Input Arguments

collapse all

SimBiology model or kinetic law, specified as a Model or SimBiology.KineticLaw object.

Name of the parameter object, specified as a character vector or string scalar.

Data Types: char | string

Value of the parameter, specified as a numeric scalar.

Data Types: double

More About

collapse all

Scope of SimBiology Parameter

A parameter object defines an assignment that a model or a kinetic law can use. The scope of the parameter is defined by the parameter parent.

If a parameter object is defined with a model object as its parent, then all objects within the model (including all rules, events and kinetic laws) can use the parameter. Consider the following.

modelObj = sbiomodel('cell')
parameterObj = addparameter(modelObj, 'TF1', 0.01)
The parameter object is added to the model object, which becomes the parent of parameterObj.

If a parameter is defined with a kinetic law object, then only the kinetic law object and objects within the kinetic law object can use the parameter.

modelObj = sbiomodel('cell')
reactionObj = addreaction(modelObj, 'a -> b')
kineticlawObj = addkineticlaw (reactionObj, 'MassAction')
parameterObj = addparameter(kineticlawObj, 'K1_forward', 0.1)

When a kinetic law searches for a parameter in its expression, it first looks in the parameter list of the kinetic law. If the parameter isn’t found there, it moves to the model that the kinetic law object is in and looks in the model parameter list. If the parameter isn’t found there, it moves to the model parent.

When a rule searches for a parameter in its expression, it looks in the parameter list for the model. If the parameter isn’t found there, it moves to the model parent. A rule cannot use a parameter that is scoped to a kinetic law. So for a parameter to be used in both a reaction rate equation and a rule, the parameter should be scoped to a model.

Version History

Introduced in R2006a

expand all