Hello,
I have a 3 nodes in circuit, and I'll like to apply a signal to each
of them in a random manner while observing the output.
Is there a way to make the SPICE RND function do this?
Thanks.
I'm not quite clear on what you mean by "in a random manner." Do you
mean each signal is a (pseudo)random value, or that each signal is on
or off at a point in time determined by a random draw? Or perhaps you
mean something else.
I use LTSpice; its random function is certainly up to either task,
though the second is easier, especially if you are willing to divide
time into equal segments. You get a different random number,
uniformly distributed between 0 and 1, from LTSpice's rand(x)
function, for each different value of integer(x). That is to say, if
you get y1 for rand(x), you will get y1 if you ask for rand(x) again
with the same x, or with any x with the same integer part. You will
get a different y for each different integer value of the argument.
So you can do something like rand(1e6*time) to get a new random value
each microsecond of your simulation. You can use SW components and
boolean functions to generate on and off states of the switches as you
desire--or you can multiply your signals by some function of the
random value--or.... For example, "B 0 1 V=rand(1e6*time)>0.4"
generates 1 volt 60% of the time, and 0 volts 40% of the time, divided
into microsecond long chunks. Repeating the simulation gives the same
result; add a large integer to the argument for rand to get a
different set of random values.
Cheers,
Tom