simulatePopulation - end % Plot all eleven age classes from...

Info iconThis preview shows page 1. Sign up to view the full content.

View Full Document Right Arrow Icon
% Simulate age distribution of a population over time and plot the % distribution % Initialize various vectors A = getLeslieMatrix(10); w = zeros(11,1); w(1) = 5; f = zeros(11,1); f(1) = 1; % Multiply A by w and then add the new probability distribution to vector f for t = 1:50 w = matrixVectorMult(A, w); f = [f w./sum(w)];
Background image of page 1
This is the end of the preview. Sign up to access the rest of the document.

Unformatted text preview: end % Plot all eleven age classes from x=0 to x=50 x = 0:50; plot(x,f(1,:), x,f(2,:),x,f(3,:),x,f(4,:),x,f(5,:),x,f(6,:),x,f(7,:),x,f(8,:),x,f(9,:),x,f(10,: ),x,f(11,:)); xlabel('time'); ylabel('Fraction in each age class'); title ('Distribution of Age Groups of a Population Over Time');...
View Full Document

This note was uploaded on 10/04/2011 for the course 1920 1920 at Cornell University (Engineering School).

Ask a homework question - tutors are online