本文介绍了在NetLogo中,我可以要求座席沿着中央补丁沿着梯度消亡吗?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
在我的模型中,我在整个环境中都有随机发芽的药剂.我想要这些试剂的密度梯度.
In my model I have agents sprout at random throughout the environment. I'd like to to have a density gradient of these agents.
是否有比在不同半径上运行类似方法更整洁的方法?:
Is there a neater way to do it than running something like this for different radii?:
ask patch 0 0 [ask n-of 20 turtles in-radius 20 [die]]
谢谢
推荐答案
您可以按照以下方式进行操作:
You could do something along those lines:
to setup
clear-all
let max-distance max [ distancexy 0 0 ] of patches
ask patches [
if random-float 1.0 > (distancexy 0 0 / max-distance) [
sprout 1
]
]
end
许多变体都是可能的.关键是结合使用random-float
和distancexy 0 0
来获得所需的密度.
Many variants are possible. The key is to use a combination of random-float
and distancexy 0 0
to get the density you want.
这篇关于在NetLogo中,我可以要求座席沿着中央补丁沿着梯度消亡吗?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!