%% Scan Parameters of the Lotka-Volterra Model
% This example shows how to execute different signatures of the SimFunction object to simulate and scan parameters of the Lotka-Volterra (predator-prey) model described by Gillespie [1].
% Load the sample project containing the model m1.

sbioloadproject lotka;

%
% Create a SimFunction object f with c1 and c2 as input parameters to be scanned, and y1 and y2 as the output of the function with no dosed species.

f = createSimFunction(m1,{'Reaction1.c1', 'Reaction2.c2'},{'y1', 'y2'}, [])

%
% Define an input matrix that contains values for each parameter (c1 and c2) for each simulation. The number of rows indicates the total number of simulations, and each simulation uses the parameter values specified in each row.

phi = [10 0.01; 10 0.02];

%
% Run simulations until the stop time is 5 and plot the simulation results.

sbioplot(f(phi, 5));

%
% You can also specify a vector of different stop times for each simulation.

t_stop = [3;6];
sbioplot(f(phi, t_stop));

%
% Next, specify the output times as a vector.

t_output = 0:0.1:5;
sbioplot(f(phi,[],[],t_output));

%
% Specify output times as a cell array of vectors.

t_output = {0:0.01:3, 0:0.2:6};
sbioplot(f(phi, [], [], t_output));

% Copyright 2012 The MathWorks, Inc.