【问题标题】:How to plot agent variables in NetLogo如何在 NetLogo 中绘制代理变量
【发布时间】:2017-08-31 11:05:47
【问题描述】:

我正在研究一本教科书,并试图绘制变量“能量”随时间变化的方式,用于两个品种,“绵羊”和“狼”。

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

plot [energy] of wolves

在我的情节的“笔更新命令”中。当我尝试使用 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'

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

【问题讨论】:

    标签: netlogo


    【解决方案1】:

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

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多