Randomly sampling pulses.

Use this forum to post Vensim related questions.
Post Reply
nikvyas
Senior Member
Posts: 112
Joined: Mon Apr 24, 2006 3:17 pm

Randomly sampling pulses.

Post by nikvyas »

Good morning all.

I was wondering if somebody could help with the following conundrum. I have a series of non-uniform, non-random pulses throughout a year (called "pulses1"). I want to filter this series so that, for instance, half continue to be a pulse (value 1) wheras the other half become 0. I can achieve this with the use of the following equation:

IF THEN ELSE( MODULO( Time , 2 ), "pulses1" , 0)

However, as you can see, the pattern is not random and will be exactly the same every run. How do I introduce an amount of randomness?

Simply making the number 2 a random distribution with a mean of 2 obviously doesn't work.

Thanks again.

Nik

[Edited on 11-27-2006 by nikvyas]

[Edited on 11-27-2006 by nikvyas]

[Edited on 11-27-2006 by nikvyas]
nikvyas
Senior Member
Posts: 112
Joined: Mon Apr 24, 2006 3:17 pm

Post by nikvyas »

Do you guys think the following approach is OK?

variable=RANDOM EXPONENTIAL( 0 , 1 , 0 , 0.5 , 1234 )

filtered=IF THEN ELSE( variable<=0.5,"pulses1",0)

So, if I only want 40% of pulses to go through, I can just alter the equation to:

filtered=IF THEN ELSE( variable<=0.4,"pulses1",0)

All advise greatly appreciated.

Thanks

Nik
bob@vensim.com
Senior Member
Posts: 1107
Joined: Wed Mar 12, 2003 2:46 pm

Post by bob@vensim.com »

Hi Nik,

That approach will work but you need to use RANDOM UNIFORM not RANDOM EXPONENTIAL or you will get the wrong percentage.
nikvyas
Senior Member
Posts: 112
Joined: Mon Apr 24, 2006 3:17 pm

Post by nikvyas »

Thanks a lot Bob.
Post Reply