Ask MATLAB Expert

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.

MATLAB, Engineering

  • Category:- MATLAB
  • Reference No.:- M91737872

Have any Question?


Related Questions in MATLAB

Assignment - matlab programmingusing appropriate matlab

Assignment - MatLab Programming Using appropriate MatLab syntax, write the code required to analyse and display the data as per the problem description. The order of the MatLab Program should be as follows: Variables and ...

Assignment details -need to write a code for connecting

Assignment Details - Need to write a code for connecting segments (Lines) a special case of TSP. The problem is to connect lines in 2d/ 3d space with path obstructions. Can you help me write the code for this? Hope you m ...

Assignment -we have daily gridded rainfall data of 40 years

Assignment - We have daily gridded rainfall data of 40 years and structure of the dataset is like below; Lat = [6.5:0.25:38.5]; Lon = [66.5:0.25:100]; Rainfall (135x129x365x40) (Lon, Lat, days, years). Now, we looking fo ...

Question a safe prime is a prime number that can be written

Question : A safe prime is a prime number that can be written in the form 2p + 1 where p is also a prime number. Write a MATLAB script file that finds and displays all safe primes between 1 and 1000.

Question - verify the attached paper with matlab and get

Question - Verify the attached paper with matlab and get all the results in the paper and explain step by step the matlab code. Paper - Improving Massive MIMO Belief Propagation Detector with Deep Neural Network. Attachm ...

Assignment -data is given on which want to do computational

Assignment - Data is given on which want to do computational production planning using Metaheuristic MATLAB Programming: 1) Ant Colony Algorithm on both Partial and Total Flexible Problem. 2) Bee Algorithm on both Partia ...

What comparison of means test was used to answer the

What comparison of means test was used to answer the question

Question 1 manipulate spectral imagehyperspectral images

Question 1. Manipulate spectral image Hyperspectral images can be seen as a generalisation of normal colour images such as RGB images. In a normal RGB colour image, there are 3 channels, i.e. channels for red colour, gre ...

Assignment -matlab codes and simulated model in

Assignment - Matlab codes and simulated model in simulink/matlab and truetime. 1. Matlab codes and simulink model for pid controller optimization using particle swarm optimization (PSO) my plant is integer order 1000/(s^ ...

Assignment matlab programmingusing appropriate matlab

Assignment: MatLab Programming Using appropriate MatLab syntax, write the code required to analyse and display the data as per the problem description. The order of the MatLab Program should be as follows: Variables and ...

  • 4,153,160 Questions Asked
  • 13,132 Experts
  • 2,558,936 Questions Answered

Ask Experts for help!!

Looking for Assignment Help?

Start excelling in your Courses, Get help with Assignment

Write us your full requirement for evaluation and you will receive response within 20 minutes turnaround time.

Ask Now Help with Problems, Get a Best Answer

Why might a bank avoid the use of interest rate swaps even

Why might a bank avoid the use of interest rate swaps, even when the institution is exposed to significant interest rate

Describe the difference between zero coupon bonds and

Describe the difference between zero coupon bonds and coupon bonds. Under what conditions will a coupon bond sell at a p

Compute the present value of an annuity of 880 per year

Compute the present value of an annuity of $ 880 per year for 16 years, given a discount rate of 6 percent per annum. As

Compute the present value of an 1150 payment made in ten

Compute the present value of an $1,150 payment made in ten years when the discount rate is 12 percent. (Do not round int

Compute the present value of an annuity of 699 per year

Compute the present value of an annuity of $ 699 per year for 19 years, given a discount rate of 6 percent per annum. As