Title: Introduction to ODE Modeling: Lab
1Introduction to ODE ModelingLab
- Emrah Diril
- Carnegie Mellon University
3nd Biodefense Summer School, August 2008
2Step 2 Download
Main material - Matlab programs http//tsb.mssm.ed
u/summerschool/images/c/cb/ODE-Lab.zip Additional
Material Advanced models http//tsb.mssm.edu/s
ummerschool/images/0/0f/ODE_Advanced.zip
Step 3 Open Matlab
3Some Basic Matlab
Matlab deals with arrays of numbers a
1,2,3,4, b14, c 110000 b(2) the
second position in the array b a a(1)
a(3) Arrays can be horizontal as above or
vertical a To change the orientation of an
array use a, b, c Plotting graphs c
rand(1000,1) an array of 1000 random numbers
between 0 and 1 X 11000 plot(c) plot(x,c)
plot(x,c,r) plot(x,c,r)
plot(x,c,ro) title(Random)
Matlab is case sensitive x is not the same as X
4Matlab cont.
1. Repeating an operation many (100) times for
i1100 a(i) 1 set a(i) to 1 end Can do
it in one command a ones(100,1) 2.
Doing something only if a condition (xgt100)
holds If x gt 100 A 0 set A to zero if xgt
100 end
5Solving ODEs
- da/dt 0
- da/dt 1
- da/dt k a
Code EX1.m
Code EX2.m
Code EX3.m
6Modeling Reactions
A -gt 0 A -gt B A B -gt C Law of Mass Action The
rate of change of products is proportional to the
product of reactants concentration A -gt 0 da/dt
-ka A -gt B db/dt ka da/dt -k a
A B -gt C dc/dt k ab da/dt - kab
db/dt - kab Lets Matlab it! matlab codes
AB.m ABC.m
7Simulating Trafficking
L Number of Macrophages in the Lung LN Number
of Macrophages in the Lymph Node Trafficking
L -gt LN and LN -gt L written also as L
lt-gt LN The equations dL/dt -k1L k2
LN loss gain dLN/dt k2LN k1L loss
gain Code Trafficking.m
8Simulating Infection SIR model
Population has three groups Susceptible,
Infected and Recovered The dynamics is expressed
in the reactions S I -gt I I (rate r) I
-gt R (rate a) The differential
equations dS/dt - rSI dI/dt rSI
aI dR/dt aI Matlab code SIR.m Change the
parameters r,a When to expect epidemic? A
relation between parameters
9Modeling Infection an HIV model
T target cells (CD4 T cels) I infected cells V
virus Model assumptions -gt T (lambda)
target cells production T -gt 0 (d)
target cells natural death T V -gt V I (k)
target cell becomes infected by virus I -gt 0
(delta) infected cells death I -gt I V (p)
virus replication in infected cells V -gt 0
(c) virus clearance The ODE dT/dt
lambda d T k V T dI/dt k V T
delta I dV/dt p I c V Matlab code
HIV.m Additional material NatureReviewsPereleso
n.pdf