Question
IN MATLAB CODE PLEASE! [Task 2 - function supdateS (s,t,A,isVac, thresholdVac, thresholdNonVac) Update the s matrix (the infection-status-vs-time matrix) to add infection status data to
IN MATLAB CODE PLEASE!
[Task 2 - function supdateS (s,t,A,isVac, thresholdVac, thresholdNonVac) Update the s matrix (the infection-status-vs-time matrix) to add infection status data to the column t+1 s (logical) s (logical) 1 2 3 45 1 2 3 45 1 11 0 0 0 2 0 1 0 0 0 1 1 1 1 0 0 2 0 1 1 3 0 0 4 0 0 4 0 01 00 Time step: 2 of 5 Time step: 3 of 5 0.5 0.5 0.5 0.5 Idea: .The current time step is t, e.gt 2. .The next time step is t+1, which is 3. .Current infection status the column t of s matrix, which is known. Find the column t+1 of s matrix, which is not known yet. Pseudocode: (one of many approaches, not efficient, but easier to explain) For person P, from 1 to N If person P is already infected in the current time step (t), then will remain infected in the next time step (t+1) else (person P is healthy), then, find how many neighbors of person P is infected. if number of infected neighborsthreshold of person P % else (person P will be healthy in the next time step) end then person P becomes infected at the next time step (t+1). % Do nothing. Already preallocate the whole matrix as false. end]
IVE BEEN TOLD THE BELOW IS THE ANSWER BEFORE, IT IS NOT PLEASE DO NOT POST THIS AGAIN
#include #include #include #include #include #include #include
#include
// PURPOSE: To tell the maximum value that a tree can have. const int MAX_VALUE = 64; // PURPOSE: To tell how many problems to do. const int NUM_PROBLEMS = 4096; #include "Node.h" #include "NodeBuffer.h"Task 2 - function supdateS (s,t,A,isVac, thresholdVac, thresholdNonVac) Update the s matrix (the infection-status-vs-time matrix) to add infection status data to the column t+1 s (logical) s (logical) 1 2 3 45 1 2 3 45 1 11 0 0 0 2 0 1 0 0 0 1 1 1 1 0 0 2 0 1 1 3 0 0 4 0 0 4 0 01 00 Time step: 2 of 5 Time step: 3 of 5 0.5 0.5 0.5 0.5 Idea: .The current time step is t, e.gt 2. .The next time step is t+1, which is 3. .Current infection status the column t of s matrix, which is known. Find the column t+1 of s matrix, which is not known yet. Pseudocode: (one of many approaches, not efficient, but easier to explain) For person P, from 1 to N If person P is already infected in the current time step (t), then will remain infected in the next time step (t+1) else (person P is healthy), then, find how many neighbors of person P is infected. if number of infected neighborsthreshold of person P % else (person P will be healthy in the next time step) end then person P becomes infected at the next time step (t+1). % Do nothing. Already preallocate the whole matrix as false. end Task 2 - function supdateS (s,t,A,isVac, thresholdVac, thresholdNonVac) Update the s matrix (the infection-status-vs-time matrix) to add infection status data to the column t+1 s (logical) s (logical) 1 2 3 45 1 2 3 45 1 11 0 0 0 2 0 1 0 0 0 1 1 1 1 0 0 2 0 1 1 3 0 0 4 0 0 4 0 01 00 Time step: 2 of 5 Time step: 3 of 5 0.5 0.5 0.5 0.5 Idea: .The current time step is t, e.gt 2. .The next time step is t+1, which is 3. .Current infection status the column t of s matrix, which is known. Find the column t+1 of s matrix, which is not known yet. Pseudocode: (one of many approaches, not efficient, but easier to explain) For person P, from 1 to N If person P is already infected in the current time step (t), then will remain infected in the next time step (t+1) else (person P is healthy), then, find how many neighbors of person P is infected. if number of infected neighborsthreshold of person P % else (person P will be healthy in the next time step) end then person P becomes infected at the next time step (t+1). % Do nothing. Already preallocate the whole matrix as false. end
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started