MATLAB: A person, who is infected by Novel Corona virus, can spread infection unto 3 people in one day. Initially there is 1 infected person.

corona virusmonte carlowhile loop

Write a complete MATLAB program using while loop to estimate how many infected people will be there after 5 days and display the following:
Day: 1, Infected: 4
Day: 2, Infected: 16
Day: 3, Infected: 64
Day: 4, Infected: 256
Day: 5, Infected: 1024

Best Answer

Hint:
day = 1;
numInfected(1) = 1;
while day < 5
% Code for you to do, which increments numInfected and the day number.
end