A Guide to MATLAB for Beginners and Experienced Users

We are going to look at two models for population growth of a species. The first is a standard exponential growth and decay model that describes quite well the population of a species becoming extinct, or the short-term behavior of a population growing in an unchecked fashion. The second, more realistic model, describes the growth of a species subject to constraints of space, food supply, competitors, and predators.
We assume that the species starts with an initial population P 0. The population after n times units is denoted P n. Suppose that in each time interval, the population increases or decreases by a fixed proportion of its value at the begining of the interval. Thus P n = P n = P n ?1 + rP n ?1, n ? 1. The constant r represents the difference between the birth rate and the death rate. The population increases if r is positive, decreases if r is negative, and remains fixed if r = 0.
Here is a simple M-file that will compute the population at stage n, given the population at the previous stage and the rate r:
<b class="bold">function X = itseq(f, Xinit, n, r)% computing an iterative sequence of valuesX = zeros(n + 1, 1);X(1) = Xinit;for i = 1:n X(i + 1) = f(X(i), r);end</b>
In fact, this is a simple program for computing...