2017-08-31 65 views
1

我正在通過一本教科書,試圖繪製兩種品種'羊'和'狼'變量'能量'隨時間變化的方式。如何在NetLogo中繪製代理變量

當我嘗試並繪製了狼的能量,我用的是代碼:

plot [energy] of wolves

在「筆更新命令是爲了我的陰謀。當我嘗試使用旅途過程運行的模式,我得到了以下錯誤消息:

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'

我會很感激,如果有人能告訴我什麼,我做錯了,以及如何獲得試圖模擬代理人自己的變量隨着時間的推移而變化的方式。

回答

1

如果你有5只狼,那麼你要求NetLogo繪製一個5個數字的列表,但它需要一個數字來繪製(在y軸上,並且刻度/時間在x軸上)。你可能需要狼的平均能量。試試plot mean [energy] of wolves

+0

完美,謝謝! – Rory