function z = zeroinfect(nu) %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% % function z = zeroinfect(nu) % % for % % A solution to CSE Your Homework Assignment Project 5 % % Models of Infection: Person to Person % % Dianne P. O'Leary 09/03 % % % % This function is used in Problem 5 to find a % % vaccination strategy that produces an average target % % infection rate. % % The input is the vaccination rate, and the output % % is the infection rate minus the target. % %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% global target ntimes n k tau delta for i=1:ntimes, zz(i) = modelmc(n,k,tau,delta,nu,0); end z = mean(zz)/(n*n) - target;