如何使用NetLogo模拟函数的结果 [英] How can use NetLogo to simulate the outcome of a function

查看:297
本文介绍了如何使用NetLogo模拟函数的结果的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

假设我有一个像Y = 0.5 * a + 0.23 * b + 0.52 * c + 0.3的函数

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

a是一个连续变量,b和c是类别变量(例如1或0)

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

我想创建多个代理,这些代理可以用不同的b和c填充Y的数量(四舍五入为整数)

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

老实说,我是Netlogo的新手,我对编码不是很熟悉.

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.

用户手册的三个教程.

谢谢

推荐答案

这就是您所说的.但我不认为这实际上是您的意思.

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

这篇关于如何使用NetLogo模拟函数的结果的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆