%SEIR model with quarantine for i = 1:10 q = i/10; tempfunc = @(t,Y) func(t,Y,q); [t,Z] = ode45(tempfunc, [0 20],[100,0,0, 1 ,0]); subplot(2,5,i) plot(t, Z) title(strcat('q = ',num2str(q))) axis([0 20 0 100]) legend('Susceptible','Exposed', 'Quarantined', 'Infected','Recovered') end function v = func(t,Y,q) b = .05; %Rate of exposure eta = .5; nu = .5; gamma = .1; S = Y(1); E = Y(2); Q = Y(3); I = Y(4); R = Y(5); v(1) = -b*S*I+ gamma*R; v(2) = b*S*I - eta*E; v(3) = q*eta*E - nu*Q; v(4) = (1-q)*eta*E - nu*I; v(5) = nu*(I+Q) - gamma*R; v = v'; end