Answered step by step
Verified Expert Solution
Question
1 Approved Answer
A well-known way to model the spread of virus over time t is the so-called SIRD model. Suppose the total residential population of a
A well-known way to model the spread of virus over time t is the so-called SIRD model. Suppose the total residential population of a county is N that remains constant over t [0, 100]. At time t, the number of susceptible individuals is S(t), the number of infected individuals is I(t), the number of recovered individuals (after being infected) is R(t), the number of deceased individuals is D(t). The SIRD model is given by the nonlinear ODE d.S B IS. dt N dI B dR dt dD dt d dt where the parameters 3..>0 denote rates of infection, recovery, and mortality, respectively. Notice that the above ODE satisfies (S(t) + I(t) + R(t) + D(t)) = 0 as it should, since S(t) I(t) +R(t)+D(t) = N constant. (a) [10 +10+5 = 25 points] Write a MATLAB function SIRD dynamics.m that specifies the above dynamics of virus spread for infection rate = 0.45, recovery rate = 0.04, mortality rate = 0.01, and total population N = 1000. Then write another file YourlastnameYourfirstnameHW9p1.m that calls your MATLAB func- tion SIRD dynamics.m to solve the above ODE using ode45 over time t = [0.100] with initial conditions S(0)=995. I(0)=5, R(0) = 0. D(0) = 0. Your file YourlastnameYourfirstnameHW9p1.m should then plot the time series for the vari- ables S(t), I(t), R(t), D(t) as solid lineplots all in the same figure window. Use different linecolors for different variables' solid lineplots: blue for S(t), red for I(t), green for R(t), black for D(t). (b) [10 +10+5 = 25 points] Write a MATLAB function FixedStepRK4.m that implements the fixed step-size fourth order Runge-Kutta method (RK4) for any vector ODE dy dt = f(t, y). Call this MATLAB function in the file YourlastnameYourfirstname HW9p1.m that you wrote in part (a) to solve for the variables S(t), I(t), R(t). D(t) with the same parameters and initial conditions as in part (a) for the same time horizon [0,100]. Use step-size At = 0.5. Inside YourlastnameYourfirstnameHW9p1.m. you need to pass the function SIRD dynamics as argu- ment to the function FixedStepRK4. Plot these time-series computed using RK4 on the same figure window generated in part (a). To avoid visual clutter, plot the RK4 results using circular markers but no lines, with the same color scheme as in part (a). For example, to plot S(t) from RK4, use plot(......., 'bo'). To plot I(t) from RK4, use plot(......., 'ro') etc. Submit all your codes/scripts from parts (a)-(b) within YourlastnameYourfirstnameHW9.zip.
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started