Representing a Model and Model Modifiers

Construct a Simple Model

The following code shows how to construct a simple model consisting of one compartment, two species, a parameter, and a reaction:

% Create a model named example
model = sbiomodel('example');
% Add a compartment named cell to model
compartment = addcompartment(model, 'cell');
% Add two species, A and B, to the cell compartment
species_1 = addspecies(compartment, 'A');
species_2 = addspecies(compartment, 'B');
% Add a parameter, K1, to model with a value of 3
parameter = addparameter(model, 'K1', 3);
% Add the reaction A -> B to the model
reaction = addreaction(model, 'A -> B', 'ReactionRate', 'K1');

SimBiology Objects

In SimBiology®, models and their components are implemented as objects. For example, in the previous code, model is a model object composed of a compartment object, compartment, which in turn is composed of species, parameter and reaction objects. These objects have properties and methods associated with them, which you use to access and configure them. Use the get method to list the property values of an object. Use the set method to change the property values of an object.

SimBiology objects are handle objects, which has implications for how they behave during copy operations. In particular, handle objects do not behave as arrays of doubles do in MATLAB®. To learn how handle objects affect copy operations, see Copying Objects in the MATLAB Programming Fundamentals documentation.

More About

Was this topic helpful?