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

    %% Increase Drug Concentration in a One-Compartment Model via First-order Dosing
% This example shows how to set up a dosing regimen that follows the first-order
% absorption kinetics.

% 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 added to the
% body via the first-order dosing represented by the reaction |dose ->
% drug|, with the absorption rate constant |ka|. It is removed from the
% body via the first-order elimination represented by the reaction |drug ->
% null|, with the elimination rate constant |ke|. This example shows how to
% set up such a one-compartment model, the first-order absorption and
% elimination.
%% Create a One-compartment Model
% Create a SimBiology model named |onecomp|.
m1 = sbiomodel('onecomp');
%%
% Define the drug elimination by adding a reaction |drug -> null| to the
% model. The |drug| species represents the total amount of drug in
% the compartment.
r1 = addreaction(m1,'drug -> null');
%%
% Note that a compartment and the species |drug| are automatically created,
% and |drug| 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 |k2|. This allows SimBiology to determine the reaction rate for
% |drug -> null| reaction.
k1.ParameterVariableNames = 'ke';
%% Set up the First-order Dosing
%%
% Add a reaction that represents the drug absorption using the second
% species |dose|. It represents an intermediate species
% that will be dosed directly and is required to set up the first-order
% absorption kinetics.
r2 = addreaction(m1,'dose -> drug');
%%
% Add a mass action kinetic law to the reaction. This kinetic law defines
% the drug absorption to follow the first-order kinetics.
k2 = addkineticlaw(r2,'MassAction');
%%
% Define the absorption rate parameter |ka| and add it to the kinetic law.
p2 = addparameter(k2,'ka','Value',0.1,'ValueUnits','1/hour');
%%
% Specify the rate parameter |ka| 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
% |dose -> drug| reaction.
k2.ParameterVariableNames = 'ka';
%%
% Suppose you want to increase the drug concentration in the system by
% administering a series of doses: 250 mg three times a day (t.i.d) for two
% days. Specify the amount of the dose (|Amount|), 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 will be applied to the model during
% simulation. |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).
d1 = sbiodose('d1','repeat');
d1.Amount = 250;
d1.AmountUnits = 'milligram';
d1.Interval = 8;
d1.TimeUnits = 'hour';
d1.RepeatCount = 5;
d1.Active = true;
%%
% Specify the target species of the dose object. The target must
% be the |dose| species, not the |drug| species, so that the drug
% absorption follows the first-order kinetics.
d1.TargetName = 'dose';
%% Simulate the Model
% Change the simulation stop time to 48 hours to match the dosing schedule.
cs = getconfigset(m1);
cs.StopTime = 48;
cs.TimeUnits = 'hour';
%%
% In addition, do not log the dose species data as you are mainly
% interested in monitoring the drug species which is the drug concentration
% in the system. This makes visualizing the species in a plot more
% convenient. To accomplish this, set the |StatesToLog| property to include
% the species |drug| only.
cs.RuntimeOptions.StatesToLog = {'drug'};
%%
% Simulate the model using the dosing schedule defined by the |d1 |dose
% object.
[t,sd,species] = sbiosimulate(m1,d1);
%% Plot Results
% Plot the concentration versus the time profile of the drug in the
% compartment.
plot(t,sd);
legend(species,'Location','NorthWest');
xlabel('Hours');
ylabel('Drug Concentration');