Documentation

This is machine translation

Translated by Microsoft
Mouseover text to see original. Click the button below to return to the English verison of the page.

Note: This page has been translated by MathWorks. Please click here
To view all translated materals including this page, select Japan from the country navigator on the bottom of this page.

simulate

Class: SimBiology.export.Model

Simulate exported SimBiology model

Syntax

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

Description

[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

model

SimBiology.export.Model object.

initialValues

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.

doses

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

t

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

x

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.

names

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

simDataObj

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

Examples

expand all

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

modelObj = sbmlimport('lotka');
modelObj.getconfigset.RuntimeOptions.StatesToLog = ...
       sbioselect(modelObj,'Name',{'y1','y2'});

Export the model object.

em = export(modelObj);

Simulate the exported model.

[t,y] = simulate(em);

figure()
plot(t,y)

Modify the initial conditions, and simulate again.

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

figure()
plot(t,y)

Was this topic helpful?