2

I have written a simple code for a model in NetLogo. At the same time the model is well studied through ordinary differential equations in literature. Now I would like to compare some plots of model obtained by both NetLogo and Matlab (used to solve differential equations). I used "ticks" command to increment the time in NetLogo, where as Matlab uses time in seconds. What kind of precautions ( changes ) should I keep in mind in order to compare the plots obtained by NetLogo and Matlab.

Seth Tisue
  • 29,985
  • 11
  • 82
  • 149
user1659936
  • 263
  • 2
  • 12

1 Answers1

4

In general, the ticks-axis of the plots from NetLogo should be some constant scalar of the time-axis of the MatLab plots. That scalar is often referred to in simulations as dt or "step size": the time per tick. If you were just using NetLogo to numerically solve differential equations (not recommended, though possible), you would likely explicitly set this to something (just as you do when numerically solving in MatLab). In most NetLogo models, however, the step size is implicit.

Some common parameters that correspond to step size in models:

  • speed of agents
  • rates of growth or decay
  • rates of diffusion

So, for example, if we're modeling traffic on a street with a speed limit of 100 kph (= (100000 m) / (60 min * 60 sec) = 27.8 m/s), and our patch-size is equal to 1 m and our agents travel at most 0.5 per tick, then we have:

27.8 m/s = (0.5 patches/tick) * (1 m/patches)  / (step-size s/tick) = (0.5 m/tick) / (step-size s/tick)

step-size s/tick = (0.5 m/tick) / (27.8 m/s) = 0.018 s/tick

So, in this case, each tick is about 0.018 seconds.

Basically, you should try to find some "per tick" parameter in your model that corresponds to "per second" parameter in the differential equations. Then, you should be able to determine how many seconds per tick there are by comparing these parameters.

Alternatively, you could kind of cheat by just comparing plots, seeing how they line up, and then determine the step size like that. Then, you can work backwards to figure out what parameters in your models are determining the step size.

Bryan Head
  • 12,360
  • 5
  • 32
  • 50