Let us consider a species of animal that has access to


Engineering Mathematics and Computing

MATLAB course

All the following exercises and problems have to be performed using MATLAB, with the exclusion of those in which you are required to solve the problem analytically (specified in the text of the exercise as "analytically" or "use an equation").

The results have to be uploaded on the dedicated drop box on Study Space under the form of a .pdf file (you may use Word to produce your .pdf file, or any other method of your choice).

For each problem, you are supposed to copy in the .pdf file the code you used to solve problem (your input in MATLAB) and the numerical result (MATLAB's output). If the output involves a graph, the figure has to be included, accompanied by an explanation (the inclusion of proper labels and legends in the figure is recommended). For the answers that involve mathematical formulae (analytical problems) you may even write the formulae by hand and include a figure (scan), if you feel more comfortable like that (of course you may also produce the formulae with Word or with the editor of your choice).

Since this is an individual assignment, you are not allowed to copy your answers from other people. You may anyway contact your instructor if you do not know how to solve a particular problem.

1 Exercise

Let us consider a species of animal that has access to unlimited resources. We may assume that both the number of deaths in the species and the number of off-springs will be proportional to the number of individuals. The differential equation for this model is

dx/dt = αx - βx.                              (1)

Here x is the number of animals, and α, β are constants, so that we may just re-define

γ = α - β and write

This may be solved writing

dx/dt = γx.                                     (2)

dx/x = γdt.                                     (3)

By setting t0 = 0 and x0 as the initial time and population, and integrating the left side between x0 and x, and the right side between 0 and t, we find the integral relation between x and t

x_0xdx'/x' = γt,                             (4)

from which we get

ln (x/x0) = γt,                                 (5)

x(t) = x0eγt.                                   (6)

In all the following problems we will assume x0 = 1000.

1.1 Problem

Plot eq. (6) for 3 different values of γ (namely: γ = 0.1, γ = 0, γ = -0.1) between t = 0 and t = 20. Use the same graph and different colours for each curve.

1.2

Assume γ = 0.1. We are going to use three different methods to predict the time at which the population will reach one billion individuals (according to the proposed model). For the following computations use the long format.

1.2.1 Problem

Use eq. (6) and MATLAB's non-linear solver to predict at which time t there will be 109 individuals.

In detail, we procede like this. From the change of variable rule dt = (dt/dx)dx = 1/(γx)dx,

t = t - t0 = t_0t dt = (1/γ) x_0x dx/x

1.2.2 Problem

Use eq. (4) and MATLAB's numerical integrator to predict at which time t there will be 109 individuals.

1.2.3 Problem

Using the analytical result eq. (5), predict at which time t there will be 109 individuals. Compare the result to those of problems 1.2.1 and

1.3. Problem

What happens if you use eq. (5) to obtain the time at which there will be 109 individuals in the γ = -0.1 case? Discuss the meaning of your result.

1.4 Problem

Setting γ = 0.1, plot the results of the first 20 iterations of the Euler Integration method for the eq. (2), starting again from x0 = 1000 and using ?t = 1 as an integration step, and compare to the analytical result eq. (6) (plot both results in the same graph).

1.5 Problem
For some kind of animals, the result of the Euler integrator may be more realistic than the analytical result eq. (6). Explain why.

2 Exercise
Let us assume now that the animals do not have access to unlimited resources. We may expect some competition to arise between them. One way to express this competition is through the logistic growth model.

dx/dt = γ (x - x2/C)                         (7)

Eq. (7) leads to the following integral (setting again t0 = 0 and x0 as the initial time and population)

x_0x dx'/ (x' - x'2/C) =  γt               (8)

2.1 Problem

Show (analytically) that this integral may be solved as

x(t) = Cx0eγt / (C - x0 + x0eγt)        (9)

2.2 Problem

Setting x0 = 1000, γ = 0.1, plot the function defined by eq. (9) between t = 0 and t = 100 for the following values of C: C = 500, C = 2000, C = 5000. Use the same graph and different colours for each curve.

2.3 Problem

Explain (using an equation) why C is named "the capacity" of the environment.

2.4

Let us set x0 = 1000, γ = 0.1 and C = 2000, and use the long format. We are going to use two different methods to check the time at which the proposed model predicts the presence of 1999 individuals in the environment.

2.4.1 Problem

Use eq. (9) and MATLAB's non-linear solver to predict at which time there will be 1999 individuals in the environment.

2.4.2 Problem

Use eq. (8) and MATLAB's numerical integrator to predict at which time there will be 1999 individuals in the environment. Compare with the result of problem 2.4.1.

3 Exercise

Let us now consider x as the number of preys (e.g., gazelles) and y the number of predators (lions). In the savanna there is plenty of grass, so as long as they do not meet lions, gazelles reproduce happily

dx/dt = αx,                                      (10)

α > 0. On the other hand, if they do not meet gazelles, lions starve to death

dy/dt = -γy,                                     (11)

γ > 0. But lions and gazelles do meet, and the dynamics of their populations is given (or better modelled) by the Lotka-Volterra equation

{dx/dt = αx - βxydy/dt = -γy + δxy       (12)

3.1 Problem

Write (12) as a vector equation

dx/dt = F(x),                                    (13)

i.e. explicitely write the functional dependence of the components Fi on the components xi.

3.2 Problem

Plot the vector field F (defined in problem 3.1) on the first quadrant (0 ≤ x ≤ 3000, 0 ≤ y ≤ 300).

3.3

Let us now set α = 0.1, β = 10-3, γ = 0.1 and δ = 10-4 Use MATLAB's numerical integrator ODE45 to solve eq. (12) between t = 0 and t = 500. For each initial condition, plot your results in two different graphs, one showing x and y as functions of time, and one showing y as a function of x. As initial conditions, use:

3.4 Problem

x0 = 2000, y0 = 40,

3.5 Problem

x0 = 3000, y0 = 20,

3.6 Problem

x0 = 1000, y0 = 100.

3.7 Problem

Explain (using an equation) what is special about the latter initial conditions.

Request for Solution File

Ask an Expert for Answer!!
Simulation in MATLAB: Let us consider a species of animal that has access to
Reference No:- TGS01369178

Expected delivery within 24 Hours