# LabVIEW

cancel
Showing results for
Did you mean:

Afternoon All,

I am looking to add some normally distributed noise about a mean with a known standard deviation so I can run some Monte Carlo simulations using Labview. Fun times. Can anyone tell me why my histogram in the attached VI is not normally distributed?

Paul

Message 1 of 6
(2,254 Views)

## Re: Adding Normally distributed noise.

Because you're reading off the pdf value, not sampling from a normal distribution. Use "Continuous Random.vi" or "Continuous Inverse CDF.vi" with the Random Number (0,1) as your input to get a normally distributed rv.

There's also a Gaussian Noise signal generator you could use if you application involves waveform data.

Message 2 of 6
(2,232 Views)

## Re: Adding Normally distributed noise.

I will have a look at those VIs. I think the issue isn't so much the PDF, it is that x is random rather than increasing in fixed steps. If I use a ramp between max min VI and feed that in, it produces a normal distribution.

Message 3 of 6
(2,198 Views)

## Re: Adding Normally distributed noise.

What I'm saying is that you don't get a normally distributed random number out of that VI. You simply get the probability density for a given number in the support. You can see this by plotting the values as they come out. It will trace out a normal curve but there will be no randomness to the data. Put down a waveform chart in your for loop and you will see there's no jumping about as you expect for random noise.
Message 4 of 6
(2,189 Views)

## Re: Adding Normally distributed noise.

You don't want a graph of a Normal Distribution, you want samples drawn from a Normal Distribution.  Consider LabVIEW's "Random number" generator, which returns a random number between 0 and 1.  If you were to look at the PDF for the Uniform Distribution, it would be 1 for X between XMin and XMax, 0 otherwise.

Note that you can use the Central Limit Theorem to get an excellent (and pretty fast) approximation to a Normal Distribution with mean 0 and variance 1 -- simply sum 12 Uniform (0, 1) random numbers and subtract the expected mean (6).  This is, in fact, the approximation that IBM distributed with their Scientific Software Package (Fortran) in the 60's.

Bob Schor

Message 5 of 6
(2,186 Views)

## Re: Adding Normally distributed noise.

Bob,

That worked beautifully to create a normal distribution. Thanks for sharing. I tried Kudos but getting an error.

David Fox

Message 6 of 6
(269 Views)