Main Content


Class: SimBiology.export.Model

Simulate exported SimBiology model


[t,x,names] = simulate(model)
[t,x,names] = simulate(model,initialValues)
[t,x,names] = simulate(model,initialValues,doses)
simDataObj = simulate(___)


[t,x,names] = simulate(model) simulates a model, using the default initial values specified by model.InitialValues (which are always equal to the InitialValue property on the corresponding ValueInfo object). simulate returns:

  • t, time samples.

  • x, simulation data that contain variation in the quantity of states over time.

  • names, column labels of simulation data x.

You can set additional simulation options using the property SimBiology.export.Model.SimulationOptions.

[t,x,names] = simulate(model,initialValues) simulates a model, using the values specified in initialValues as the initial values of the simulation.

[t,x,names] = simulate(model,initialValues,doses) simulates the model, using the specified initial values and doses.

simDataObj = simulate(___) returns simulation data in a SimData object simDataObj using any of the input arguments in the previous syntaxes. The simDataObj contains time and state data, as well as metadata, such as the types and names for the reported states. You can access the time, data, and names stores in simDataObj using the properties simDataObj.Time, simDataObj.Data, and simDataObj.DataNames, respectively.

Input Arguments


SimBiology.export.Model object.


Vector of values for simulate to use as the initial values of the simulation. initialValues must have the same number of elements as model.InitialValues.

Default: Values specified in model.InitialValues.


Vector of dose objects specifying the doses used for simulation. The input dose objects must be a subset of the doses in the exported model, as returned by getdose.

Default: All dose objects in the exported model.

Output Arguments


n-by-1 vector of time samples from the simulation, where n is the number of time samples.


n-by-m matrix of simulation data, where n is the number of time samples and m is the number of states logged during the simulation. Each column of x describes the variation in the quantity of a state over time.


m-by-1 cell array of character vectors with names labeling the rows and columns of x, respectively.


SimData object containing simulation time and state data, as well as metadata, such as the types and names for the reported states.


expand all

Load a sample SimBiology model object, and select the species y1 and y2 for simulation.

modelObj = sbmlimport('lotka');
modelObj.getconfigset.RuntimeOptions.StatesToLog = ...

Export the model object.

em = export(modelObj);

Simulate the exported model.

[t,y] = simulate(em);


Modify the initial conditions, and simulate again.

xIndex = em.getIndex('x');
em.InitialValues(xIndex) = em.InitialValues(xIndex)*1.1;
[t,y] = simulate(em);