This function can be called as tgauss to avoid possible conflict with the gauss math function.
parameter description default value units stddev standard deviation none mean mean value none lattice sample period seconds interp interpolation 0 none
The gauss function can be used to generate correlated random output. This function takes three or four arguments.
The parameter lattice is for use in transient analysis. A new random value is computed at each time increment of lattice. If lattice is 0, then no lattice is used, and an uncorrelated random value is returned for each call. The interp parameter, used when lattice is nonzero, can have value 1 or 0. If interp is nonzero, the value returned by the function is the (first order) interpolation of the random values at the lattice points which frame the time variable. If interp is 0, the function returns the lattice cell's value for any time within the lattice cell, i.e., a random step with an amplitude change at every lattice point.
The first example above provides a random signal with standard deviation of .5V and mean of 2V, based on random samples taken every 100nS.
The lattice value should be on the order of the user print increment tstep in the transient analysis. It should not be less than the maximum internal time step, since the past history is not stored, and a rejected time point may back up the time across more than one lattice cell, thus destroying the correlation.
This function applies only to transient analysis, where time is the running variable. The argument count is used to distinguish this function from the math function of the same name.
If this function is used bare and not part of an expression in a voltage or current source, then the general source instance parameters prm1 etc. map as below. It is possible to read and alter these values using the special vector @device[param] construct, or with the alter and sweep commands. However, there is no sanity checking so bad numbers can cause wild behavior or worse.
prm1 stddev prm2 mean prm3 lattice prm4 interp
One important application of this function is to provide time-domain noise generation for noise modeling. For example, below is a circuit which simulates the thermal noise generated in a resistor at 4.2K.
*** noise demo
*@ define noise(r,t,dt,n) gauss(sqrt(2*boltz*t/(r*dt)), 0, dt, n)
r1 1 0 1.0
ir1 1 0 noise(1.0, 4.2, 0.5p, 1)
c1 1 0 1p
tran 1p 1n
The second line defines a function named ``noise'' that takes four arguments: the resistance, temperature in Kelvin, the lattice time increment, and the interpolation method. This is simply a wrapper around a gauss call, incorporating the standard noise equation for current through a resistor at a given temperature, and taking the inherent bandwidth to be one half of the reciprocal of the lattice time increment (per Nyquist). The noise function is used in the specification for current source ir1. In a more complicated case, each resistor in a circuit may have an associated noise current source similarly defined. It may be possible to demonstrate errors due to thermal noise when simulating the circuit.