MATLAB Answers

I don't understand what this means or how to do it

2 views (last 30 days)
Coby Juarez
Coby Juarez on 16 Oct 2021
I've been given an assignment in this class where I have to simulate a population while a sickness is spreading. I represents the immune, S represents the sick, and W represents the well. You input the amount of days you'd like to pass as well as the initial population values of the different groups and it returns the new population values as a percentage of the whole population after that many days. My function works fine and is shown below.
function [popPerc] = PercPopAfterT(t,I0,S0,W0)
Population = [I0 S0 W0];
for day = 1:t
I=Population(1,1)+.12*Population(1,2)-.01*Population(1,1);
S=Population(1,2)+.08*Population(1,3)-.04*Population(1,2)-.02*Population(1,2)-.12*Population(1,2);
W=Population(1,3)+.06*Population(1,3)+.02*Population(1,2)-.02*Population(1,3)-.08*Population(1,3)+.03*Population(1,1);
Population=[round(I) round(S) round(W)];
end
popPerc = 100*(Population/sum(Population, 'all'));
The next question is: "Using the PercPopAfterT function, find the long-term equilibrium population percentages." Does anyone know what this question is asking me and how I would go about solving this. I'm lost and it's gonna be due soon.

Answers (0)

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by