Virus Program: Write a program to compute the spread of a virus.
Simulations should run with R0=1.4 but the student should be able to change this from 0.8 to 15.
A. The program must randomly select a townsperson as the first infected. Their index is
X=randi(m), m=1000
B. The students in the town with m=1000 people are the only residents in there homes, and all
residents have two neighbors except resident i=1 and i=1000 who each have one neighbor.
C. All residents can infect an uninfected adjacent neighbor, i-1 and i+1.
D. All student residents can ALSO infect any student, using the same probability per day as they can
their neighbor.
E. The probability of infecting a neighbor or classmate is the same each day, RO/28 during the
period of infection, 14 days.
F. The neighbor or classmate will be infected by running a random number generator from 0 to 1.0
and if it falls < RO/28 that neighbor or classmate will be infected. If a neighbor has two adjacent
infected neighbors, this will be run twice. If a classmate has N infected classmates it will be run
N times in a loop.
G. The students are even distributed through the city, so for 100 students, a student will have the
indices A(10*i), A(10), A(20)....A(1000) are students. This can be found in the manner just stated
or by other means (mod functions for example).
H. Initialize the healthy town as A=0 for all residents. The first randomly infected person has a
value changed to A(x)=1, each new infected resident (and student) A(i)=1, and an outer loop
running each day should increment this value by 1, so that if A(i)>0, A(i)=A(i)+1, until A(i)=15
then A(i)=-1. In this manner, A(i)>0 means infected, A(i)<0 means recovered and immune, and
A(i)=0 means uninfected and available to infect. No one can infect if A(i)=-1, nor A(i)=15 as this
latter state should change immediately to A(i)= -1.
Report the following
1. Each day, find the number of infected townspeople, and save in an array the count of existing
active infected, Ninfected(d)-CountActiveInfected Townspersons for each day beginning on day
1, when one person is randomly infected.
2. Find the number of infected students, and save this as well each day,
Ninfstudents(d)=CountActiveInfectedStudents
3. Keep track of the total number infected, while the above daily number is the current active
infections, this number is just a total counting all who were or are iinfected.
NCountToDate(d)=NCountTotal (this should be updated each time someone is newly infected,
and only then).
4. Keep track of the total with immunity, or recovered this is just the ones for whom A(i) = -1 on
any day
Nimmune(d)=countEnegative Keep track of days Days(d)=d, so that we can find the day at which
no one is infected as they have reached sufficient immunity and the virus has died out.
Plot the above values versus days as four plots, and "publish" your program to the assignment
folder, also save the .m file.