% Example of matrix population modeling. % Population is divided into 15-year age brackets. % set up a population matrix, L % L(1,j) = number of female children born to each woman % in the jth age bracket in 15 years. % L(j+1,j) = probability that members of the jth age bracket % survive the next 15 years % L(5,5) = probability that members of the last age bracket % survive the next 15 years L = [ 0 .5 .5 0 0 .95 0 0 0 0 0 .99 0 0 0 0 0 .95 0 0 0 0 0 .9 .5 ]; % initial female population, p0, is uniformly distributed p0 = [20;20;20;20;20]; % The jth column of the matrix P will contain the % female population vector at year 2000+(j-1)*15. P = [p0]; pj = p0; % iterate for numyears*15 years numyears = 33; for j=1:numyears pj = L*pj; % compute population at year 2000+j*15 P = [P pj]; % store information in column j+1 of P end % plot data as a bar chart figure(1), clf bar(2000+[0:numyears]*15, P','stacked') shading faceted, colormap(cool) xlabel('year', 'fontsize', 18) ylabel('population', 'fontsize',18) legend('0-14','15-29','30-44','45-59','60+')