Just wondered how do we use the Random Lookup function for vensim? I got a problem here which is my lookup value is always constant from the lookup graph for all the days. Is it because I define my X as constant?
For example,
I define Lookup(x) when X is a const value and lookup is the predefined graph that I made. The result I got is always one value from the graph
Random Function
-
- Super Administrator
- Posts: 4835
- Joined: Wed Mar 05, 2003 3:10 am
If you are just accessing the lookup using a constant (and not the RANDOM LOOKUP FUNCTION) it will always return a constant.
The Vensim code below will work if you are using the RANDOM LOOKUP function.
random sample=
RANDOM LOOKUP ( some lookup , 0 , 10 , 0 , 1 , noise seed )
~ dmnl
~ |
some lookup( [(0,0)-(10,10)],(0,1.22807),(0.917431,3.02632),(1.6208,2.2807),(1.74312,4.95614),(3.11927\
,2.89474),(3.36391,4.69298),(3.94495,3.28947),(4.6789,5.61404),(5.1682,7.67544),(6.02446\
,8.59649),(8.62385,3.11404),(9.11315,1.92982),(9.44954,0.877193),(10,0.263158))
~ dmnl
~ |
The Vensim code below will work if you are using the RANDOM LOOKUP function.
random sample=
RANDOM LOOKUP ( some lookup , 0 , 10 , 0 , 1 , noise seed )
~ dmnl
~ |
some lookup( [(0,0)-(10,10)],(0,1.22807),(0.917431,3.02632),(1.6208,2.2807),(1.74312,4.95614),(3.11927\
,2.89474),(3.36391,4.69298),(3.94495,3.28947),(4.6789,5.61404),(5.1682,7.67544),(6.02446\
,8.59649),(8.62385,3.11404),(9.11315,1.92982),(9.44954,0.877193),(10,0.263158))
~ dmnl
~ |