LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Adding Normally distributed noise.

Solved!
Go to solution

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

"When I read about the horrors of drinking, I gave up reading"
0 Kudos
Message 1 of 6
(5,146 Views)

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.

0 Kudos
Message 2 of 6
(5,124 Views)

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.

"When I read about the horrors of drinking, I gave up reading"
0 Kudos
Message 3 of 6
(5,090 Views)
Solution
Accepted by MancPablo
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
(5,081 Views)
Solution
Accepted by MancPablo

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
(5,078 Views)
Solution
Accepted by MancPablo

Bob,

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

David Fox

0 Kudos
Message 6 of 6
(3,161 Views)