| Contents | Index |
SimBiology software includes three stochastic solvers. The stochastic solvers more accurately calculate the change in species amounts with a small number of molecules.
Get the active configuration set for the model, Mobj.
cs = getconfigset(Mobj)
Configuration Settings - default (active)
SolverType: ode15s
StopTime: 10
SolverOptions:
AbsoluteTolerance: 1.000000e-006
RelativeTolerance: 1.000000e-003
SensitivityAnalysis: false
RuntimeOptions:
StatesToLog: all
CompileOptions:
UnitConversion: false
DimensionalAnalysis: true
SensitivityAnalysisOptions:
Inputs: 0
Outputs: 0
The configset object, cs, contains all the simulation settings, including the stop time and solver.
Set the SolverType to the ssa stochastic solver, and list the configuration set again.
set(cs, 'SolverType', 'ssa'); cs
Notice that the SolverOptions for the stochastic solver are different from the ODE options.
Configuration Settings - default (active)
SolverType: ssa
StopTime: 10.000000
SolverOptions:
LogDecimation: 1
RuntimeOptions:
StatesToLog: all
CompileOptions:
UnitConversion: false
DimensionalAnalysis: true
SensitivityAnalysisOptions:
Inputs: 0
Outputs: 0Change the value for the LogDecimation property.
cs.SolverOptions.LogDecimation = 10;
Increasing this setting lets you record fewer data points and decrease run time.
Run the simulation.
[t_ssa, x_ssa] = sbiosimulate(Mobj, cs);
Plot the results.
FH1 = figure; set(gcf, 'color', 'white'); plot(t_ssa,x_ssa(:,1:4)); title('Gene Regulation with SSA Solver'); xlabel('Time (second)'); ylabel('Amount (molecule)'); axis([0, 10, 0, 50]);
The resulting plot may resemble the following figure.

Another method to visualize stochastic simulations is through ensemble runs.
simDataObj = sbioensemblerun(Mobj, 10, cs); sbiosubplot(simDataObj);
The resulting plot may resemble the following:

Click Back or Forward to navigate through the plots.
Stochastic Solvers — Brief description of when to use stochastic solvers and the types available in the software.
![]() | Simulating the Model | More Examples of Using the Command Line | ![]() |

See how to analyze, visualize, and model biological data and systems using MathWorks products.
Get free kit| © 1984-2012- The MathWorks, Inc. - Site Help - Patents - Trademarks - Privacy Policy - Preventing Piracy - RSS |