System

Experiment 1: constant dosage of 0.3

In[]:=
parameters={rw->0.6*(1-Tanh[15*(c[t]-0.3)]),rr->0.59*(1-Tanh[15*(c[t]-0.6)]),μw->0.01,γw->0.01,γr->0.01,κ->0.075,α->0.05,δ->0.05};​​​​equations={​​pw'[t](rw*(1-μw)-γw)*pw[t]-κ*pw[t]*i[t],​​pr'[t](rr-γr)*pr[t]-κ*pr[t]*i[t]+rw*μw*pw[t],​​i'[t]==α*(pw[t]+pr[t])-δ*i[t],​​c[t]==If[t<2,0,0.3]​​}/.parameters;​​​​startingConditions={pw[0]==10,pr[0]==0,i[0]==2};​​​​soln=NDSolve[Join[equations,startingConditions],{pw[t],pr[t],i[t]},{t,0,20}][[1]];​​​​Show[Plot[If[t<2,0,30],{t,0,20},PlotStyle->None,FillingBottom],Plot[{pw[t]/.soln,pr[t]/.soln},{t,0,20},PlotRangeAll,PlotLegends{"Wild type","Resistant type","Infection"}],PlotRange->{All,{0,150}}]
Out[]=
Wild type
Resistant type

Experiment 2: constant dosage of 0.5

In[]:=
parameters={rw->0.6*(1-Tanh[15*(c[t]-0.3)]),rr->0.59*(1-Tanh[15*(c[t]-0.6)]),μw->0.01,γw->0.01,γr->0.01,κ->0.075,α->0.05,δ->0.05};​​​​equations={​​pw'[t](rw*(1-μw)-γw)*pw[t]-κ*pw[t]*i[t],​​pr'[t](rr-γr)*pr[t]-κ*pr[t]*i[t]+rw*μw*pw[t],​​i'[t]==α*(pw[t]+pr[t])-δ*i[t],​​c[t]==If[t<2,0,0.35]​​}/.parameters;​​​​startingConditions={pw[0]==10,pr[0]==0,i[0]==2};​​​​soln=NDSolve[Join[equations,startingConditions],{pw[t],pr[t],i[t]},{t,0,20}][[1]];​​​​Show[Plot[If[t<2,0,50],{t,0,20},PlotStyle->None,FillingBottom],Plot[{pw[t]/.soln,pr[t]/.soln},{t,0,20},PlotRangeAll,PlotLegends{"Wild type","Resistant type","Infection"}],PlotRange->{All,{0,70}}]
Out[]=
Wild type
Resistant type

Constant dosage Manipulate[]

In[]:=
Manipulate[​​parameters={rw->0.6*(1-Tanh[15*(c[t]-0.3)]),rr->0.59*(1-Tanh[15*(c[t]-0.6)]),μw->0.01,γw->0.01,γr->0.01,κ->0.075,α->0.05,δ->0.05};​​​​equations={​​pw'[t](rw*(1-μw)-γw)*pw[t]-κ*pw[t]*i[t],​​pr'[t](rr-γr)*pr[t]-κ*pr[t]*i[t]+rw*μw*pw[t],​​i'[t]==α*(pw[t]+pr[t])-δ*i[t],​​c[t]==If[t<2,0,const]​​}/.parameters;​​​​startingConditions={pw[0]==10,pr[0]==0,i[0]==2};​​​​soln=NDSolve[Join[equations,startingConditions],{pw[t],pr[t],i[t]},{t,0,100}][[1]];​​​​Show[Plot[If[t<2,0,50],{t,0,100},PlotStyle->None,FillingBottom],Plot[{pw[t]/.soln,pr[t]/.soln},{t,0,100},PlotRangeAll,PlotLegends{"Wild type","Resistant type","Infection"}],PlotRange->{All,{0,150}}],{const,0.2,0.6}]
Out[]=
​
const
Wild type
Resistant type

Experiment 3: pulsed dosage of 0.5

In[]:=
parameters={rw->0.6*(1-Tanh[15*(c[t]-0.3)]),rr->0.59*(1-Tanh[15*(c[t]-0.6)]),μw->0.01,γw->0.01,γr->0.01,κ->0.075,α->0.05,δ->0.05};​​​​equations={​​pw'[t](rw*(1-μw)-γw)*pw[t]-κ*pw[t]*i[t],​​pr'[t](rr-γr)*pr[t]-κ*pr[t]*i[t]+rw*μw*pw[t],​​i'[t]==α*(pw[t]+pr[t])-δ*i[t],​​c[t]==If[t<2,0,If[FractionalPart[t/1]<0.5,0.5,0]]​​}/.parameters;​​​​startingConditions={pw[0]==10,pr[0]==0,i[0]==2};​​​​soln=NDSolve[Join[equations,startingConditions],{pw[t],pr[t],i[t]},{t,0,20}][[1]];​​​​Show[Plot[If[t<2,0,If[FractionalPart[t/1]<0.5,50,0]],{t,0,20},PlotStyle->None,FillingBottom],Plot[{pw[t]/.soln,pr[t]/.soln},{t,0,20},PlotRangeAll,PlotLegends{"Wild type","Resistant type","Infection"}],PlotRange->{All,{0,160}}]