Graphics Programs Reference
In-Depth Information
model, describes the growth of a species subject to constraints of space, food
supply, competitors, and predators.
Exponential Growth and Decay
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 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 :
function X = itseq(f, Xinit, n, r)
% computing an iterative sequence of values
X = zeros(n + 1, 1);
X(1) = Xinit;
for i = 1:n
X(i + 1) = f(X(i), r);
end
In fact, this is a simple program for computing iteratively the values of a
sequence a n = f ( a n 1 ) , n 1, provided you have previously entered the
formula for the function f and the initial value of the sequence a 0 . Note the
extra parameter r built into the algorithm.
Now let's use the program to compute two populations at five-year
intervals for different values of r :
r = 0.1; Xinit = 100; f = inline('x*(1 + r)', 'x', 'r');
X = itseq(f, Xinit, 100, r);
format long; X(1:5:101)
ans =
1.0e+006 *
0.00010000000000
0.00016105100000
0.00025937424601
0.00041772481694
Search WWH ::




Custom Search