如何在 NetLogo 中绘制代理变量

How to plot agent variables in NetLogo

我正在研究一本教科书,并试图为两个品种 'sheep' 和 'wolves' 绘制变量 'energy' 随时间变化的方式。

当我尝试绘制狼的能量时,我使用代码:

plot [energy] of wolves

在 'pen update commands' 中用于我的情节。当我尝试使用 go 过程 运行 模型时,我收到以下错误消息:

PLOT expected input to be a number but got the list [105.09999999999982 129.59999999999982 112.09999999999982 112.09999999999982 112.09999999999982 108.59999999999982 129.59999999999982 115.59999999999982 108.59999999999982 119.09999999999982] instead. error while observer running PLOT called by plot 'Energy over Time' pen 'wolves' update code called by procedure GO called by Button 'go'

如果有人能告诉我我做错了什么,以及如何让情节模拟代理人拥有的变量随时间变化的方式,我将不胜感激。

如果你有 5 只狼,那么你要求 NetLogo 绘制一个包含 5 个数字的列表,但它需要一个数字来绘制(在 y 轴上,tick/time 在 x 轴上)。你可能想要狼的平均能量。尝试 plot mean [energy] of wolves