clear all; % Supplement to Chapter 8 in book on Ranaviruses (Gray and Chinchar, eds.) % published in 2014 by Springer. % This model is an SIR model in continuous time based on ordinary % differential equations with density dependent transmission to be run in matlab. % Make sure the sir.m file is in the same folder as this file % Parameters t0 = 0; % initial time for the model- here is time zero tf = 100; % final time evaluated for the model N0 = [99 1 0]; % Number of idividuals in each population at t0. Refers to % population size of susceptibles, infected, and recovered. % Integration [t N] = ode45('sir',[t0 tf],N0); % ode45 integrates the system of ordinary % differential equations from time 0 (t0) to the final time (tf) for the % function sir given the initial population distribution (N0). Outputs t % (the time points evaluated) and the N for each population at each t. % Plot the populations over time plot(t,N(:,1),t,N(:,2),t,N(:,3)) title('SIR Model') xlabel('Time') ylabel('Population Size') legend('Susceptible', 'Infected', 'Recovered')