function [val,isterminal,dir] = epi1end(t,y,z)

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%  function [val,isterminal,dir] = epi1end(t,y,z)        %
%  Solution to CSE Your Homework Assignment Project 6    %
%  More Models of Infection: It's Epidemic               %
%  epi1end.m Dianne P. O'Leary   11/03                   %
%                                                        %
%  This program tests whether the integration should be  %
%  terminated in Problems 1-3 because the epidemic has   %
%  run its course and either left no infected or no      %
%  susceptible.                                          %
%  The y vector has 3 components:                        %
%        infected, susceptible, and recovered.           %
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
global mythreshhold

val = min(y(1),y(2)) - mythreshhold;
isterminal = 1;    % This tells the integrator to stop when val=0.
dir = 0;           % This says it doesn't matter whether val
                   % is increasing or decreasing.




