% Matlab Program % Sample paths of Continuous Time Markov Chain and % Stochastic Differential Equation % SIS Epidemic Model with births and natural deaths % Population size is constant % ODE Solution and Three Sample Paths for CTMC and SDE clear all %Parameters and Initial Condition beta=1; b=0.25; gam=.25;N=100; init=2; %Number of simulations, time step for SDE, and end time dt=0.01; sim=3; time=20; % Euler's method ODE Model y(1)=init; for k=1:time/dt y(k+1)=y(k)+dt*(beta*(N-y(k))*y(k)/N-(b+gam)*y(k)); end subplot(2,1,1) plot([0:dt:time],y,'k-','LineWidth',2); hold on %CTMC Model for k=1:sim clear i t t(1)=0;i(1)=init; j=1; while i(j)>0 & t(j)