**Description of MATLAB routine
virusspread.m**

VIRUS SPREAD A simulation of the spread of a virus.

You have a group of N people. The spread of the virus is tracked for maxdays

or until the entire population becomes infected.

CLASSROOM USE: Demonstration of a logistics curve.

The N people are numbered 1 through N.

First DAY: One randomly chosen person is infected.

Second Day: The infected individual chooses at random a number between 1 and N.

If the number chosen is different from the number assigned to the infected person, then there are two infected persons, otherwise
only one person is infected.

Third Day: Each previously infected person chooses at random a number

between 1 and N. The pool of infected persons may grow or

by chance remain the same.

Other Days: Repeat the previous procedure.

The process terminates when all N people are infected. (Since we are using a random number generator, it is possible that the one or
more people may remain uninfected for a long period of time. So we do not encounter an "infinite" loop a maximum number of days to track the virus

spread is required.)

INPUT: N - the number of people in the population.

maxdays - the maximum number of days to track the spread of the virus.

nograph - an optional input value (any numerical value will do)

to prevent the display of a graph of days vs number of

people infected.

OUTPUT: Optionally a graph, a table of the tracking information, and

the number of days needed to infect the entire population

(or the simulation terminates in the maximum

number of days specified for tracking the spread of the virus).

The graphplots days vs number of people infected.

USE in the form:

daysneeded=virusspread(N,maxdays,nograph) with nograph = 1 to just see the daysneeded

virusspread(N,maxdays) to see a graph of the simulation & table of data

virusspread to be prompted for the input, see a graph & table of data

AUXILIARY ROUTINES: rnumh by D.R.Hill

By: David R. Hill, Math Dept, Temple University,

Philadelphia, Pa. 19122 Email: dhill001@temple.edu

+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++

Since 3/1/2002