B15: Bicycle Pool Steady-State Distribution

disp('B15: Bicycle Pool');

% Transition matrix based on B15 problem description

P_b15 = [160/200, 40/200, 60/200;

20/200, 140/200, 40/200;

20/200, 20/200, 100/200];

% Initial state: equal number of bicycles at each location

x0_b15 = [1/3; 1/3; 1/3];

% Initialize vectors to track state evolution

vResidence = [x0_b15(1)];

vLibrary = [x0_b15(2)];

vAthleticCentre = [x0_b15(3)];

% Iteratively apply P to find steady state for B15

for i = 1:500

x1_b15 = P_b15 * x0_b15;

vResidence = [vResidence x1_b15(1)];

vLibrary = [vLibrary x1_b15(2)];

vAthleticCentre = [vAthleticCentre x1_b15(3)];

x0_b15 = x1_b15; % Prepare for the next iteration

end

% Plotting for B15

subplot(2,1,2); % Subplot for B15

hold on

plot(vResidence, 'g');

plot(vLibrary, 'r');

plot(vAthleticCentre, 'b');

legend('Residence', 'Library', 'Athletic Centre');

xlabel('Days');

ylabel('Proportion of Bicycles');

title('B15: Bicycle Distribution Evolution');p