How do I add a time-variable parameter into my ODE model?
Afficher commentaires plus anciens
I'm new to MATLAB and I have been stuck on this problem for a while now. I'd really appreciate if you help me solve this small problem.
I am trying to solve a mathemical model defined by a system of ODE. The ODE is given below as follows.

I've coded the above system as follows:
IC = [300;0;1;0;300;0;0];
tspan = [0 5000];
[t, Y] = ode45(@odefun, tspan, IC);
function DYdt = odefun(t, Y)
% Y is 7x1 vector
Sh = Y(1);
Eh = Y(2);
Ih = Y(3);
Rh = Y(4);
Sm = Y(5);
Em = Y(6);
Im = Y(7);
a = 0.25;
b = 0.04;
c = 1/14;
d = 0.205;
f = 0.415;
g = 1/12;
h = 1/365;
j = 1/365;
l = 0.4/365;
Lambdah = 0.028;
muh = 0.0000391;
alphah = 0.0004;
Lambdam = 6;
mum = 0.04;
alpham = 0.01;
ITN = 0.5;
IRS = 0.5;
LLIN = 0;
dShdt = -a*Im*Sh*(1-ITN-LLIN)/(Sh+Eh+Ih+Rh)+b*Rh+Lambdah-muh*Sh;
dEhdt = a*Im*Sh*(1-ITN-LLIN)/(Sh+Eh+Ih+Rh)-c*Eh-muh*Eh;
dIhdt = c*Eh-d*Ih-muh*Ih-alphah*Ih;
dRhdt = d*Ih-b*Rh-muh*Rh;
dSmdt = -f*Ih*Sm*(1-ITN-LLIN)/(Sm+Em+Im)+Lambdam-mum*Sm-h*ITN*Sm-l*LLIN*Sm-j*IRS*Sm;
dEmdt = f*Ih*Sm*(1-ITN-LLIN)/(Sm+Em+Im)-g*Em-mum*Em-h*ITN*Em-l*LLIN*Em-j*IRS*Em;
dImdt = g*Em-mum*Im-alpham*Im-h*ITN*Im-l*LLIN*Im-j*IRS*Im;
DYdt = [dShdt; dEhdt; dIhdt; dRhdt; dSmdt; dEmdt; dImdt];
end
NOW, I would like to change some of the parameters from constants to variables that change with time. In this example, the parameter h lineraly degrades over the entire time span. I tried doing this by adding the following code:
h = (1/365)*(1-(t/5000));
But, I see NO change when I run this model, and get the same exact graphs as before. How do integrate this into my model, so that I can have linearly degrading variables in my model?
Thank you so, so much in advance! I would deeply appreciate the assistance. Please do try and help me out!
Réponses (0)
Catégories
En savoir plus sur Ordinary Differential Equations dans Centre d'aide et File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!