1. Write down a simple three-species ecological model (in terms differential equations describing their population) that exhibits the following features:
Ans:
Let the populations of A, B, C be PA, PB, and PC respectively. The simple ecological model can be described by the following equations
d PA/dt = -dAPA+bAPAPB
d PB/dt = -dBPAPB+bBPBPC
d PC/dt = -dCPBPC+bCPC
To obtain equilibrium we must have d PA/dt=d PB/dt=d PC/dt=0. This is only possible if
PB =dA/bA =bC/dC and dBPA = bBPC.
For arbitrary set of parameters (dA, bA, etc.), this is not possible.
To solve these equations using Matlab
% assign parameter values
dA=1.0;bA=1.5;dB=1.25; bB=1.0;
dC=0.5; bC=0.1;
dP = [-dA*P(1)+bA*P(1)*P(2);-dB*P(1)*P(2)+bB*P(2)*P(3);...
-dC*P(2)*P(3)+bC*P(3)];
and call it by
P0 = [1.0, 1.0, 1.0]; %initial
population
tspan = [0 10];
[t, P] = ode45('dp3', tspan,
P0);
plot(t, P(:,1),'--', t,
P(:,2),'+', t, P(:,3),'o')
2. Consider Logistic Map: Show that a) is a fixed point of the map, and b) when r>3, there is a 2-cycle solution, where x takes values and alternately.
Ans.:
Let (The map is written as ), we can then show that
--- is a fixed point
Similarly we can show that . Thus we have a 2-cycle solution with x taking values alternating between .
3. The following Matlab codes is used to generate the Mandelbrot fractal
N_iter=50;
N=200;
M_set=zeros(N,N);
x1=-1.5; x2=1.0;
y1=-1.0; y2=1.0;
for m=1:N
x=x1+(x2-x1)*m/N;
for n=1:N
y=y1+(y2-y1)*n/N;
k=0;
z0=x+i*y; z=z0;
while(k<N_iter & abs(z)<2.0)
z=z*z+z0;
k=k+1;
end
M_set(m,n)=k;
end
end
image(M_set)
axis equal
Describe the iteration process used in generating the Mandelbrot fractal.
Ans.:
The basic iteration is done on the complex plane where the complex variable is updated according to
For a given point (x, y), the iteration starts with , if the kth iteration is the first iteration when abs(z) is greater than 2, then the corresponding point is labeled by the color with index equal to k (N_iter is the maximum number of iteration used). The map is generated by scanning through the points contained in the rectangle .
4. One-dimensional Random Walk. Write Matlab codes to simulate a one-dimensional random walk and plot the result x(n) vs. n, where x(n) is the position of the walker at nth step.
Ans.:
N=10000;
D=1.0;
p=2*D*rand(N,1)-D;
walk=cumsum([0; p]);
plot(0:N, walk)
5. Traffic flow model. Describe a simple model of traffic flow that can be simulated on a computer. For simplicity, use the following assumptions
The following simple model can be simulated on a computer:
Now this model is well-defined and a computer program can be written for simulating this model. There are active research being done by using various extended versions of this simple model.