
%
%          SIR_rhs_IC
%
  function dy = SIR_rhs_IC(t,y,params);

  global N 

  gamma = params(1);
  r = params(2);
  delta = params(3);

  S = y(1);
  I = y(2);
  S_S0 = y(3);
  I_S0 = y(4);
  S_I0 = y(5);
  I_I0 = y(6);
  Svec = [S_S0; I_S0; S_I0; I_I0];
  J = [(-delta-gamma*I) -gamma*S; gamma*I (gamma*S-(r+delta))];
  Der = blkdiag(J,J); 
  Sen = Der*Svec;

%
% Construct the right-hand side
%
  dy = [delta*(N-S) - gamma*I*S;
        gamma*I*S - (r+delta)*I;
        Sen];


