User Tools

Site Tools


tutorial_15-implementing_using_two_compartments

Tutorial 15 - Implementing using two compartments

2/3

When implementing the Lotka-Volterra model using two Compartment blocks (one accounting for the predator and one for the prey), the equations needs to be split into the birth parts and the death parts. There won’t be connections between the two Compartments, they will have different units, number of rabbits and number of foxes. Modelling of new-born animals should instead be done using transfer functions from a Source/Sink block. The death of animals should be modelled using a Transfer block connected to a Source/Sink block. Figure 1 below illustrates conceptually how the implementation using two Compartment blocks could look like in Ecolego.

Figure 1 Ecolego matrix of two Compartment approach

Equations for Transfers:

  • BirthRabbits=Rabbits·a
  • BirthFoxes=e·b·Rabbits·Foxes
  • DeathRabbits=b·Rabbits·Foxes
  • DeathFoxes=c·Foxes

Initial Conditions for compartments:

  • For Rabbits = Rabbits0
  • For Foxes = Foxes0

Example parameter values could be as follows:

Parameter Unit Value Description
Rabbits0R 1000 initial number of rabbits
Foxes0 F 4 initial number of foxes
a 1/year 0.04 the natural growth rate of rabbits in the absence of predation
c 1/year 0.2 the natural death rate of foxes in the absence of food (rabbits)
b 1/(year F)5.0E-4the death rate per encounter of rabbits due to predation
e F/R 0.1 the efficiency of turning predated rabbits into foxes

Simulating the model 250 years the evolution of foxes and rabbits will be as follows:

Figure 2 Dynamic behavior of the Lotka-Volterra model.

Screenshot

Figure 3 Dynamic behavior of the Lotka-Volterra model in Matlab.

The above screenshot were generated using the following Matlab code:

ode45(@(t,y,a,c,b,e)[y(1)*e*b*y(2)-y(1)*c;y(2)*a-y(2)*b*y(1)],[0,250],[4,1000],odeset('Refine',1),.04,.2,5e-4,.1);

legend('Foxes','Rabbits')


Next

Previous

References

tutorial_15-implementing_using_two_compartments.txt · Last modified: 2023/04/03 15:26 by dmytroh