NetLogo:直方图相对频率 [英] NetLogo: histogram relative frequency

查看:161
本文介绍了NetLogo:直方图相对频率的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我仍然遇到[histogram]的问题.

我有一个全局变量(适龄),用于存储海龟生病时的年龄...我想绘制分布图:histogram age-sick

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?

推荐答案

我试图通过以下方式解决该问题:

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]

这篇关于NetLogo:直方图相对频率的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆