Corona pandemic has changed the world. We all witnessed the spread of the virus and have experienced various measures by the officials to stop the pandemic. In this problem you will see how fast a virus can spread under certain assumptions. You are going to implement a function "coronaSpread" which takes a population size "n" (number of people) and an array of infected individuals. We assume each person has a unique index from 1 to "n" and the parameter "infected" contains an array of indices of the infected individuals before the start of the simulation. You will implement 2 different simulations for this problem represented by 2 nested functions. Before we set the random seed to be "randSeed". (Already done for you in template) For the first simulation you will need to code a nested function "fullPandemic()" that will calculate how many days it takes for a virus to spread across the entire populations given that each infected person can infect at most 1 random person per day. You need to take into account the following: We start with some number of infected population. Remember an array "infected" contains indices of infected individuals. In each day: each of the infected individuals randomly infects at most one other person among "n" person in our simulation. That "other" individual can be the person itself as well which would mean that that person didnt infect anyone on that day. Also that random "other" person can be someone already infected. That means that in each iteration each person infects every other individual with the probability 1/"n". Your simulation stops once the entire peopulation is infected and you will store the number of days it took in the variable "day". Consider the following example that illustrates the algorithm for n=5 and infected=[2,5] Day 1: Infected individuals: [2,5]. person 2 randomly infects person 3 and person 5 randomly infects person 2. Note here that person 2 is laready infeted so nothing changes for that individual. Day 2: Infected individuals: [2,3,5]. person 2 randomly infects person 5. Person 3 randomly infects person 1. Person 5 randomly infects person 5. Day 3: Infected individuals: [1,2,3,5]. Person 1 randomly infects person 2. Person 2 randomly infecets person 4. Person 3 randomly infects person 4. Person 5 randomly infects person 3. Here our simulation stops and we know that the entire peopulation has been infected in 3 days.For the second simulation we assume that infected individuals will infect at most one person per day (as before) but this time they will self-isolate. That means that they will no longer infect others in the future. They can still be chosen randomly by someone else but their situation will not change. For the "selfIsolation()" nested function you will need to take into account the following: 
We start as before with the original number of infected population (given to you by the parameter "infected"). This population is not isolated at the moment. For each day: Each infected (and not isolated) person infects at most one other random individual. After that all the infected persons go into self-isolation (they will no longer infect others). However the newly infected individuals will infect others in the next iteration. You stop once the number of newly infected individuals in an iteration is 0 and return the total number of infected individuals for the entire simulation. Consider again the following example that illustrates the a;lgorithm for n=6 and infected = [2,5] Day 1: Infected individuals: [2,5]. isolated individuals=[]. Person 2 randomly infects person 3 and person 5 randomly infects person 2. Note here that person 2 is already infected so nothing changes for that individual. Day 2: Infected individuals: [2,3,5]. Isolated individuals=[2,5] Person 3 randomly infects person 6. Day 3: Infected individuals: [2,3,5,6]. Isolated individuals=[2,3,5] Person 6 randomly infects person 2. Here our simulation stops as the number of newly infected persons is 0 for this day and we return 4 as the total number of infected individuals. Once you are done coding the 2 nested functions. You will need to call them in order to run the simulation. (Already done for you in the template). Tips you have use: to model the individuals consider using structs. Use "randi" to get randomly infected individual for each person. You can use "randi" to get multiple random numbers at the same time. You are given the following code in matlab just fill it in: function [day, totalNumberInfected] = coronaSpread(randSeed, n, infected)
rng(randSeed);
% Simulation 1: Nobody isolates
function fullPandemic()
% Initialize the simulation where currently affected individuals are
% the ones given in the array "infected". This can be an array or
% struct or some other way you want to keep track of infected
% individuals
% Run the simulation -> at the end the variable "day" needs to be set
end
% Simulation 2: everybody isolates after infection
function selfIsolation()
% Initialize the simulation again like in the part 1
% Run the simulation -> at the end the variable "totalNumberInfected"
% needs to be set
end
fullPandemic()
selfIsolation()
end.