NetLogo: histogram relative frequency

送分小仙女□ 提交于 2019-12-11 19:15:29

问题


I'm still having problems with [histogram].

I have a global variable (age-sick) that stores the age of the turtles when they got sick...and I want to plot the distribution: histogram age-sick

However I do not want the absolute number of turtles who got sick per every age, rather the relative one. Is there a way to do so?


回答1:


I have tried to overcome the problem in the following way:​​

let age-freq (list)
let i 0
while [ i <= (max age-sick)] [
let a filter [? = i] age-sick
repeat (length a / length age-sick * 1000) [set age-freq lput i age-freq]
set i i + 1]
histogram age-freq]


来源:https://stackoverflow.com/questions/37051972/netlogo-histogram-relative-frequency

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!