In a certain city, residents either live in the city, in the suburbs, or outside
ID: 3698587 • Letter: I
Question
In a certain city, residents either live in the city, in the suburbs, or outside the suburbs (including those who live outside the region). If someone lives in the city, there is a 10% chance that they will move to the suburbs and a 15% chance that they will move outside the area entirely. If someone lives in the suburbs, there is a 5% chance that they will move into the city and a 20% chance that they will move outside the region. There is an 8% chance that someone who lives outside the region will move to the suburbs, and a 2% chance that someone who lives outside the region will move into the city. If initially 2% of the population lives in the city, 3% of the population lives in the suburbs, and 95% chance lives outside the region,(a) Use Matlab to find the distribution of the population after ten years.
(c) In the solution of the previous question, you created a matrix. Find the eigenvalues of that matrix.
(d) Use MATLAB to find the fixed point of this system. (Hint: Set it up a matrix equation.)
In a certain city, residents either live in the city, in the suburbs, or outside the suburbs (including those who live outside the region). If someone lives in the city, there is a 10% chance that they will move to the suburbs and a 15% chance that they will move outside the area entirely. If someone lives in the suburbs, there is a 5% chance that they will move into the city and a 20% chance that they will move outside the region. There is an 8% chance that someone who lives outside the region will move to the suburbs, and a 2% chance that someone who lives outside the region will move into the city. If initially 2% of the population lives in the city, 3% of the population lives in the suburbs, and 95% chance lives outside the region,
(a) Use Matlab to find the distribution of the population after ten years.
(c) In the solution of the previous question, you created a matrix. Find the eigenvalues of that matrix.
(d) Use MATLAB to find the fixed point of this system. (Hint: Set it up a matrix equation.)
In a certain city, residents either live in the city, in the suburbs, or outside the suburbs (including those who live outside the region). If someone lives in the city, there is a 10% chance that they will move to the suburbs and a 15% chance that they will move outside the area entirely. If someone lives in the suburbs, there is a 5% chance that they will move into the city and a 20% chance that they will move outside the region. There is an 8% chance that someone who lives outside the region will move to the suburbs, and a 2% chance that someone who lives outside the region will move into the city. If initially 2% of the population lives in the city, 3% of the population lives in the suburbs, and 95% chance lives outside the region,
(a) Use Matlab to find the distribution of the population after ten years.
(c) In the solution of the previous question, you created a matrix. Find the eigenvalues of that matrix.
(d) Use MATLAB to find the fixed point of this system. (Hint: Set it up a matrix equation.)
Explanation / Answer
x = [0.02; 0.03; 0.95];
A = [[0.75 0.05 0.02]; [0.1 0.75 0.08]; [0.15 0.20 0.9]];
%%
y = (A^10)*x;
fprintf(' Question 1: After 10 years, %.2f percent people live in the city, %.2f percent people live in the suburbs and %.2f percent people live outside the city', y(1)*100, y(2)*100, y(3)*100);
%%
fprintf(' Question 2:');
fprintf(' The matrix used was:');
A
fprintf(' its eigenvalues are:');
eig(A)
%%
y = zeros(3,6);
t = zeros(1,6);
for i = 1:6
t(1,i) = 2^i;
y(:,i) = (A^t(1,i))*x;
end
figure;
hold on;
plot(t, y(1,:));
plot(t, y(2,:));
plot(t, y(3,:));
ylabel('Fraction of people in the city, suburbs and outside the city');
xlabel('Years');
hold off;
y = (A^100)*x;
fprintf(' Question 3: After 100 years, %.2f percent people live in the city, %.2f percent people live in the suburbs and %.2f percent people live outside the city', y(1)*100, y(2)*100, y(3)*100);
fprintf(' These are the set point values of the system. As seen from the plot, the values do not change noticeably after year 80');
% If you have any doubts, please mention it in the comments