The **dynamics of a biological system** can be described using differential equations. One example of biological system is the **predator-prey system**, which consists in two interacting species, the predators and the prey.

The **population change** in time of a predator-prey system can be mathematically modeled with the **Lotka-Voltera equations**. These are a set of first-order, nonlinear, differential equations:

\frac{dx}{dt}=Ax – Bxy\\

\frac{dy}{dt}=Dxy – Cy

\end{split} \end{equation*} \]

where:

*x* – is the number of prey (e.g. rabbits)

*y* – is the number of predators (e.g. foxes)

*dx/dt* and *dy/dt* – are the growth rate in time of the population

*t* – time

*A* – the growth rate of prey in the absence of predators

*B* – the rate at which predators consume prey

*C* – death rate of predator in the absence of prey

*D* – rate at which the predators increase by consuming prey

The coefficients *A*, *B*, *C* and *D* are positive real parameters describing the interaction of the two species.

The **Xcos block diagram** implementation of the predator-prey system (Lotka-Voltera equations) is the following:

As you can see, we integrate the right side of differential equations using an `INTEGRAL_f`

block. The outputs of the integrator blocks represent the variation in time of the population of prey *x(t)* and predators *y(t)*. The coefficients `A`

, `B`

, `C`

and `D`

are set as parameters of the `GAINBLK`

blocks.

As **initial conditions** we assume that the prey population is `6`

and the predator population is `2`

.

The simulation is set to run for `12`

seconds, with the default Xcos settings for integration method and solver tolerance. The coefficients `A`

, `B`

, `C`

and `D`

are set using the `Set Context`

menu dialog.

The population number in time, for both prey and predators, are saved in the Scilab workspace as structure variables: `x_prey`

is the prey population number in time *x(t),* and `y_predator`

is the predator population number in time *y(t)*.

We have a post-processing Scilab script which will plot the number of prey and predator population versus time.

plot(x_prey.time,x_prey.values,'b','Linewidth',2) plot(y_predator.time,y_predator.values,'r','Linewidth',2) legend("prey","predator",1) hf=gcf(); hf.background = 8; ha=gca(); ha.grid = [1,1] ha.children(1).line_mode="off"; xlabel("time",'fontsize',2) ylabel("x, y",'fontsize',2) title("Predator-prey population growth in time",'fontsize',2)

By running the above Scilab script we get the plot of population number in time, for both prey and predators.

Notice that the population number at time `0 s`

starts with the initial values set in the integrator blocks, `6`

for prey and `2`

for predators.

By analyzing the plot of the population number, we can notice that:

- the predator population is always behind the prey population
- when the prey population is high, the predators start to increase due to abundance of food
- when the predators are too many, the prey population starts to decline
- when the prey is not anymore sufficient, the predators population starts to decline due to lack of food
- when the predators population is low, the prey population increases due to low mortality rate

For a different view of the results we can plot the population number of the predators *y(t)* versus the population number of the prey *x(t)* with the following Scilab script:

idx=find(x_prey.values < 6.01 & x_prey.values > 5.99); plot(x_prey.values(1:idx(2)),y_predator.values(1:idx(2)),'Linewidth',2) plot(x_prey.values(1),y_predator.values(1),'s') xgrid xlabel("Prey, x",'fontsize',2) ylabel("Predator, y",'fontsize',2) title("Predator vs. prey population growth",'fontsize',2)

By running the above Scilab instructions, we get the following plot:

The same analysis can be done on the vs. plot above. The start point are the initial values, `6`

prey and `2`

predators. Following the contour of the plot, we can notice the same behavior as in the time plot. With the initial population number, the predators start to increase, due to abundance of food, while the prey starts to decline.

The apex of the predator population is at `3.94`

, an the minimum is `0.36`

. The maximum number of the prey population is `6.13`

and the minimum is `1.17`

.

The number of predators and prey should be regarded as relative numbers, for example, number of individuals on 10 km^{2}.

For any questions, observations and queries regarding this article, use the comment form below.

Don’t forget to Like, Share and Subscribe!