0% found this document useful (0 votes)
30 views

Modelling Discrete Systems

The document discusses two models - a predator-prey model and a random motion particle model. For the predator-prey model, populations N and P are governed by difference equations and the model is solved using code in MATLAB. For the random motion particle model, the likelihood of a particle hitting the east wall of a box is considered, assuming repulsion from the west wall and random noise.

Uploaded by

Abdulai Sheriff
Copyright
© Attribution Non-Commercial (BY-NC)
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
30 views

Modelling Discrete Systems

The document discusses two models - a predator-prey model and a random motion particle model. For the predator-prey model, populations N and P are governed by difference equations and the model is solved using code in MATLAB. For the random motion particle model, the likelihood of a particle hitting the east wall of a box is considered, assuming repulsion from the west wall and random noise.

Uploaded by

Abdulai Sheriff
Copyright
© Attribution Non-Commercial (BY-NC)
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
You are on page 1/ 3

Modelling Discrete Systems There are many problems which require simulation: this is largely because it is not viable

to actually run the physical tests. This covers things from experiments on aircrafts (which are too dangerous or expensive) to population studies and economic strategies. We consider the example of two populations N and P. The evolution of these co-existing populations are governed by the difference equations:

This is an example of a predatorprey model. This is solved simply using the code r = 2; a = 1; nt = 20; t = 1:1:nt; N = zeros(size(t)); P = zeros(size(t)); N(1) = r*log(r)/(a*(r-1))+0.01; P(1) = log(r)/a; for j = 1:(nt-1) N(j+1) = r*N(j)*exp(-a*P(j)); P(j+1) = N(j)*(1-exp(-a*P(j))); end subplot(2,1,1) plot(t,N,o,MarkerSize,12) title(N values) subplot(2,1,2) plot(t,P,r+,MarkerSize,12) title(P values) Random Motion Let us now consider a particle in a box and ask the question of how likely it is to hit the east wall. We assume that the western wall repels the particles and that there is no vertical motion. In this case the position at a subsequent time is related to the current position by where f(x) = k/x2 so that the force away from the western wall at x = 0 is proportional to the inverse of the distance squared. The noise is given by times a random number between minus one and one. The eastern wall

is taken to be at x = 5 and the constant of proportionality for the repulsive force is k = 0.5, with a noise amplitude of 1. x0 = 2.5; noise = 1.; east_wall = 5; k = 0.5; no_experiments = 200; for j = 1:no_experiments x = x0; steps = 0; while x<east_wall steps=steps+1; x = x + k./x2 + noise*(rand(1)-0.5)*2; end st_store(j) = steps; end The result of one simulation is given as

Running the code for two hundred experiments yields these results:

We can use the MATLAB commands mean and std to extract statistical information from the experiments. But perhaps the most helpful command is hist(st store) which yields:

This shows how many of the runs took for instance above 100 steps to reach the eastern wall.

You might also like