%% Accelerate Simulation With Array of Doses
% Load a sample SimBiology project.

sbioloadproject radiodecay.sbproj

%
% Increase the amount of species x by 100 molecules at 2 and 4 seconds by adding a schedule dose.

dObj1 = adddose(m1,'d1','schedule');
dObj1.Amount = 100;
dObj1.AmountUnits = 'molecule';
dObj1.TimeUnits = 'second';
dObj1.Time = 2;
dObj1.TargetName = 'unnamed.x';

dObj2 = adddose(m1,'d2','schedule');
dObj2.Amount = 100;
dObj2.AmountUnits = 'molecule';
dObj2.TimeUnits = 'second';
dObj2.Time = 4;
dObj2.TargetName = 'unnamed.x';

%
% Prepare the model for accelerated simulation using the array of both doses.

sbioaccelerate(m1,[dObj1,dObj2]);

%
% Simulate the model using no dose or any subset of the dose array without having to rerun sbioaccelerate.

sim1 = sbiosimulate(m1);
sim2 = sbiosimulate(m1,dObj1);
sim3 = sbiosimulate(m1,dObj2);
sim4 = sbiosimulate(m1,[dObj1,dObj2]);

%
% Plot the results.

sbioplot(sim1);

%

sbioplot(sim2);

%

sbioplot(sim3);

%

sbioplot(sim4);

% Copyright 2012 The MathWorks, Inc.