Page 1 of 1

Help with PULSE TRAIN and random variable

Posted: Fri Mar 08, 2024 3:43 pm
by Nub_User
Dear experts,

I need model a variable that maintains a constant value (but obtained from a random variable) that lasts for 365 days and repeats periodically every 365 days.

What I want to simulate is a constant but random value every 365 days, and that the function keeps that value constant for 365 days.

I used a function based on PULSE TRAIN and RANDOM PINK NOISE, but I get a continuous random function while I need a discrete function lasting 365.

Could you please help me with that?

Thank you very much.

Re: Help with PULSE TRAIN and random variable

Posted: Fri Mar 08, 2024 3:57 pm
by tomfid
Try this instead ...
PULSE_test 2.mdl
(2.16 KiB) Downloaded 688 times
You can also use SAMPLE IF TRUE for this (though I think it's not available in all versions).

Re: Help with PULSE TRAIN and random variable

Posted: Fri Mar 08, 2024 4:21 pm
by Nub_User
Thank you very much for the solution @tomfid!

Iam working with PLE+ version. SAMPLE IF TRUE is available in these version. Conceptually, how can I use it?

Re: Help with PULSE TRAIN and random variable

Posted: Sat Mar 09, 2024 8:28 am
by Administrator

Re: Help with PULSE TRAIN and random variable

Posted: Mon Mar 11, 2024 6:10 pm
by Nub_User
Thank you @administrator.
I read the syntax and help from the documentation Help. But I was referring to how the recommendation can be implemented for the specific problem I raised.

Re: Help with PULSE TRAIN and random variable

Posted: Tue Mar 12, 2024 2:42 pm
by Administrator
SAMPLE IF TRUE will hold a value until something is "true". So create a variable that equals 1 every 365 days, and use that in the call to SAMPLE IF TRUE.

Re: Help with PULSE TRAIN and random variable

Posted: Tue Mar 12, 2024 4:40 pm
by Nub_User
thank you very much @Administrator :D