www.gusucode.com > simbio 案例源码程序 matlab代码 > simbio/AddASeriesOfBolusDosesToOneCompartmentModelExample.m

    %% Add a Series of Bolus Doses to a One-Compartment Model
% This example shows how to add a series of bolus doses to one-compartment
% model.

% Copyright 2015 The MathWorks, Inc.


%% Background
% Suppose you have a one-compartment model with a species named |drug| that
% represents the total amount of drug in the body. The drug is removed
% from the body via the first-order elimination represented by the reaction
% |drug -> null|, with the elimination rate constant |ke|. In other words,
% the drug concentration versus the time profile follows the monoexponential
% decline ${C_t} = {C_0}{e^{ - {k_e}t}}$, where $C_t$ is the drug
% concentration at time t, $C_0$ is the initial concentration, and |ke| is
% the elimination rate constant. This example shows how to set up such
% a one-compartment model and administer a series of bolus doses, namely 250
% mg three times a day (tid) for two days.
%% Create a One-compartment Model
% First create a SimBiology model named |onecomp|.
m1 = sbiomodel('onecomp');
%%
% Define the elimination of the drug from the system by adding a reaction
% |drug -> null| to the model.
r1 = addreaction(m1,'drug -> null');
%%
% The species |drug| is automatically created and the reaction
% is added to the compartment. The |null| species is a reserved species
% that acts as a sink in this reaction.
%%
% Add a mass action kinetic law to the reaction. This kinetic law defines
% the drug elimination to follow the first-order kinetics.
k1 = addkineticlaw(r1,'MassAction');
%%
% Define the elimination rate parameter |ke| and add it to the kinetic law.
p1 = addparameter(k1,'ke','Value',1.0,'ValueUnits','1/hour');
%%
% Specify the rate parameter |ke| as the forward rate parameter of the
% reaction by setting the |ParameterVariableNames| property of kinetic law
% object |k1|. This allows SimBiology to determine the reaction rate for |drug ->
% null| reaction.
k1.ParameterVariableNames = 'ke';
%% Set up a Series of Bolus Doses
% Suppose you want to increase the drug concentration in the system by
% administering a series of bolus doses: 250 mg three times a day (tid) for
% two days. Create a repeat dose object. Specify the amount of the dose
% (|Amount|), the dose target, the time interval between each dose
% (|Interval|), and the total number of doses (|RepeatCount|). You also
% need to set the |Active| property of the dose object to |true| so that
% the dose is applied to the model during simulation.
d1 = sbiodose('d1','repeat');
d1.Amount = 250;
d1.AmountUnits = 'milligram';
d1.TargetName = 'drug';
d1.Interval = 8;
d1.TimeUnits = 'hour';
d1.RepeatCount = 5;
d1.Active = true;
%%
% |RepeatCount| was set to 5, instead of 6 since it represents
% the number of doses _after_ the first dose at the default dose
% start time (|d1.StartTime| = 0).
%% Simulate the Model
% Change the simulation stop time to 48 hours to match the dosing schedule
% defined by the |d1| dose object.
cs = getconfigset(m1);
cs.StopTime = 48;
cs.TimeUnits = 'hour';
[t,sd,species] = sbiosimulate(m1,d1);
%% Plot Results
% Plot the concentration versus the time profile of the drug in the
% system.
plot(t,sd);
legend(species);
xlabel('Hours');
ylabel('Drug Concentration');