我需要帮助我的代码,我正在制作一个图表,我在这里用滴答来表示时间。当我绘制它时,它会在图表上显示错误的数字。如果我的人口是1000并且它在第二个刻度上,它应该是500,但是在图表上它在第一个刻度上显示500。 This is the graph
globals [
]
to setup ;; resets everything to appropriate initial values
clear-all
reset-ticks
end
to go
tick
update-and-plot
end
to update-and-plot ;; updates values for plot
update-and-plot-m/n
end
to update-and-plot-m/n
set-current-plot "Population"
plot ( NUm / ticks )
end
答案 0 :(得分:1)
The tick
command is also what updates the plots, so your plot is not being updated until the beginning of the next tick. Try putting tick
at the end of the go
procedure, where it normally goes. (You may then need to check for ticks = 0
in your plotting procedure since ticks starts at zero.)