I am writing a simple model for the food exchange in bees in NetLogo. I plotted a histogram to show the distribution of bees with different food amounts at each tick. Now I want to plot a normal distribution curve that overlay the histogram, each time I run my model, i.e. a curve that fits the histogram bars. I used one pen with this command to plot my histogram: histogram [food] of turtles
and also wrote a function like this to add another pen:
to draw-PDF
set-current-plot "OVERALL FOOD DISTRIBUTION"
create-temporary-plot-pen "normal"
set-plot-pen-color red
plot-pen-down
let distsd sqrt ( variance ([food] of turtles) )
let distmean mean [food] of turtles
let multconst Number_of_bees / distsd / sqrt(2 * pi)
let expconst 2 * distsd ^ 2
let b 0
while [ b < Number_of_bees]
[
let f foodofeachbee b
let exparg (- ((f - distmean) ^ 2)) / expconst
let y multconst * exp(exparg)
plotxy f y ]
end
foodofeachbee
is a reporter that I defined separately. But running this, I got the error that says "your model is too large to run!"
Any suggestions?