Making Independent Gaussian White Noise Sources

Regarding making independent noise sources, there was a thread that ran earlier, but comments in that thread never really ever produced a very 'satisfactory' solution; so here's one:

It is my contention that it is possible to use rand() to obtain independent noise sources. Plus, it is also possible to use rand() to get a very close approximation to gaussian distribution; and then also create a large number of "gaussian white noise" sources, which are completely independent. Plus, these noise sources will yield predictable/calibrated performance.

BACKGROUND: The built-in LTspice feature of rand() is calculated for every integer value of its argument. As rand() is used, it is never reseeded and its value is identical for any argument that is identical. Fortuitously, the function does NOT seem to repeat even for very large values of its argument, apparently as large as 2^48.

PROPOSED METHODOLOGY: Make independent noise sources by simply OFFSETTING each argument term, being certain that the argument's values NEVER overlap. In other words, OFFSET is similar to reseeding the function.

NOTE: The historical flaw in using a multiplier times the argument in an attempt to create independency is bound for failure in obtaining that independency. To see why, envision the spectrum of each noise source. No matter WHAT multiplier is used in the argument, even another random number, that multiplier only varies the spectrum, like 'shrinks' the spectrum, and at the low end there will always be some amount of overlaying. That explains why all the attempts posted here earlier resulted in the spectrums having a 'tilt' from low frequency end down to the higher frequency end.

To avoid this effect and make each noise source independent, instead SHIFT the argument a large enough amount to avoid repetition of the argument.

USING IN LTspice: set up the following for any schematic: .options plotwinsize=0 need to set up some parameters first .param dt=50nS N=100000 .param tstart={0} tstop={N*dt} .param Fstart={1/N/dt} Fstop={1/2/dt} .param BW={1/N/dt} now any of these command lines will work: .ac dec 100 {Fstart} {Fstop} .noise V(out) Vin dec 100 {Fstart} {Fstop} .tran 0 {tstop} {tstart} {dt/10} Note that when using ANY FFT be sure to truncate the display back to a maximum of Fstop. [the reason why the maximum step allowed is dt/10 will be explained later] Also to my knowledge, the actual term, BW, is NOT used anywhere. BW appears here as reminder for the calculation to find how to interpret the time waveforms AND the FFT plots.

Now here is a series of independent noise sources: Again, rand() does NOT appear to repeat even with the argument as large as

2^48, so taking advantage of that fact enables one to create a series of independent noise sources by 'offsetting' each of the arguments by a sufficient amount of shift: vn1=rand(time/dt)-0.5 vn2=rand(N+time/dt)-0.5 vn3=rand(2*N+time/dt)-0.5 . . .

A large enough offset value of N ensures that the 'argument' for rand() is ALWAYS different, thus you have a capability to make a large number of independent noise sources, each with uniform pdf.

CONTROLLING AMPLITUDE To make the output 1 Vrms, simply calculate the rms of a time ramp function [that's like a uniform distribution] the rms of a signal going from -0.5 to 0.5 is 1/sqrt(12), so multiply each proposed noise source by sqrt(12) to get 1Vrms: vn1=sqrt(12)*(rand(time/dt)-0.5) vn2=sqrt(12)*(rand(N+time/dt)-0.5) and so on.

GAUSSIAN NOISE SOURCE: How to make gaussian white noise sources? Simple. Use an approximation based upon the principle that when two independent noise sources are added together [as long as the two sources are really independent], each addition convolves their pdf's! That means adding two uniform distributions yield a pdf that is triangular. Convolve again and you get parabolic, and again, and again, until infinite number and you have gaussian, but stopping at five or seven makes for a pretty decent shape [by inspection/comparison]!

therefore, using five rand(): vgn=rand(time/dt)+rand(N+time/dt)+rand(2*N+time/dt)+rand(3*N+time/dt)+rand(4*N+time/dt) is a fairly close approximation to a gaussian white noise source.

CONTROLLING AMPLITUDE of GAUSSIAN however how to make 1Vrms? simple; remember that adding independent noise sources increase their energy by the sqrt of the number of sources, not by the number of sources, so now the 'adjusted' output of the total noise source becomes vgn=sqrt(12/5)*(rand(time/dt)+rand(N+time/dt)+rand(2*N+time/dt)+rand(3*N+time/dt)+rand(4*N+time/dt)) yields an approximation to a true gaussian white noise source of 1 Vrms.

Now to make several independent gaussian white noise sources use more rand's shifted appropriately: vgn1=sqrt(12/5)*(rand(time/dt)+rand(N+time/dt)+rand(2*N+time/dt)+rand(3*N+time/dt)+rand(4*N+time/dt)) vgn2=sqrt(12/5)*(5*N+rand(time/dt)+rand(6*N+time/dt)+rand(7*N+time/dt)+rand(8*N+time/dt)+rand(9*N+time/dt)) and so on.

CONCLUSION: There is a simple way to make a series of independent gaussian white noise sources by adding a multitude of rand() and making certain each rand is independent by offsetting its argument by a sufficient distance -- being certain that the maximum argument for rand is not exceeded.

USING THESE NOISE SOURCES: There are quirks inside LTspice that can cause confusion as these noise sources are used. LTspice linearly interpolates between points which causes 'apparent' errors, up to as much as 16% from what should be there.

To avoid these effects, it is recommended to force LTspice to make each step as small as possible. That is the reason for using dt/10. If you look at the time waveform, you will see that LTspice 'holds' the value of the rand() a bit, but ramps between each change in rand(). That ramping if allowed to be a major portion of the time waveform [for example, if you let dt be the maximum step] will cause 'blurring' of the random values. Blurring, or smearing, creates havoc with the distribution and havoc with the spectrum, so best to force the analyses to use way more than necessary steps. Even the effects from using dt/20 instead of dt/10 can be noticed.

There is an additional advantage to using steps much smaller than the intended dt step size. When ltpsutil.exe is used to make the steps uniform, the program linearly interpolates between values. Again, non-judicious linear interpolation smears the data by nature of its averaging. With many small steps, smearing only occurs at the transition points, thus after export, it is possible to post process the data by dessimating the data back down to N, the number of data points originally sought. By performing such a sequence, one can completely avoid the otherwise deleterious effects of 'linear interpolation' which would otherwise completely smear the information.

Fotuitously, sometimes to prevent LTspice from 'bouncing' around as LTspice calculates each analysis point and thereby injecting 'artifact' noise into the solution; it is often necessary to decrease the maximum step size, often down to 1/20th what LTspice would otherwise do. That requirement is perfect for helping to use all the above 'gaussian white noise' sources. I found anywhere from dt/20 to dt/10 provides decent performance. The advantage is the ltsputil.exe can reduce the steps to 5 or 10*N, then EXPORT and dessimate using an octave form: data=data(3:5:end-2); Again, go through a dt/10, make uniform, dessimate, and yield EXACTLY the required value of N originally desired. And LTspice's 'smearing' is minimal, below 1-2%

Reply to
RobertMacy
Loading thread data ...

This information was also posted to the LTspice user's group where Helmut has converted the description into actual models, 7 segment I believe. So anybody interested can simply run a sample and observe and not have to 'noodle' the obtuse use of my English.

Reply to
RobertMacy

ElectronDepot website is not affiliated with any of the manufacturers or service providers discussed here. All logos and trade names are the property of their respective owners.