How can I set the step size to a constant value for the ode solver in simbiology?

I know that I can set the MaxStep in the simulation settings for a sbiomodel:
as in:
set(cs1.SolverOptions, 'MaxStep', 0.1);
% Initialize configset for analysis run.
cs = getconfigset(m1, 'default');
% RUNSIMULATION simulate SimBiology model, m1.
% Run simulation.
data = sbiosimulate(m1, cs, [], []);
How can I set the step size to a constant number instead of just a maximum?

Answers (1)

Hi Scott,
SimBiology does not support a true fixed step solver, but if your real goal is to have simulation at specific times (for example, uniformly spaced times), then that is possible.
If you are using MATLAB R2012a or later, you can directly specify what times the simulation should record using the new OutputTimes property on the SolverOptions. For example,
cs = getconfigset(m1, 'default');
set(cs.SolverOptions, 'OutputTimes', 0:1:10)
data = sbiosimulate(m1, cs, [], []);
will give you simulation results at times 0:1:10.
If you are using an earlier version of SimBiology, you can resample the simulation results at the desired time. For example,
cs = getconfigset(m1, 'default');
data1 = sbiosimulate(m1, cs, [], []);
data2 = resample(data1, 0:1:10, 'pchip');
will resample the results at times 0:1:10 using the pchip interpolation method.
-Arthur

Communities

More Answers in the  SimBiology Community

Categories

Products

Asked:

on 31 Oct 2012

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!