How can use NetLogo to simulate the outcome of a function

余生长醉 提交于 2019-12-09 03:56:33

问题


assuming I got a function like Y= 0.5*a+0.23*b+0.52*c+0.3

a is a continuous variable, b and c are categorical variables(like 1 or 0)

I wanna create multiple agents that can hatch the number of Y (round up to an integer) with different b and c

Honestly, I am new to Netlogo and I am not very familiar with coding.

I went through the three tutorials of the user manual, but I still have no clue to do that.

three tutorials of the user manual.

Thank you


回答1:


This does what you said. But I don't think it's actually what you mean.

to testme
  clear-all
  let a 5
  let b 10
  let c 20
  let Y ceiling (0.5 * a + 0.23 * b + 0.52 * c + 0.3)
  print Y
  create-turtles Y
  [ setxy random-xcor random-ycor
  ]
end


来源:https://stackoverflow.com/questions/57346005/how-can-use-netlogo-to-simulate-the-outcome-of-a-function

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!