LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

How to generate a random number within a specified tolerance and control that tolerance.

Solved!
Go to solution

I am trying to simulate data without using a DAQ device by using a random number generator and I want to be able to control the "range" of the random number generated though.  On the front pannel, the user would be able to input a nominal number, and the random number generator would generate numbers within plus or minus .003 of that nominal number.  The data would then be plotted on a graph.  Anyone know how to do this?  Or if it's even possible?

 

Just for information sake, the random number is supposed to look like thickness measurements, that's why I want to simulate plus and minus .003 because the data could be thinner or thicker than the nominal.  

 

Thanks in advance!!

0 Kudos
Message 1 of 6
(6,041 Views)
Solution
Accepted by topic author SPSUENGR
Two ways to approach this.  First, for a uniform distribution you could "Roll the Dice" which is the Random Number (0,1) function, multiply the result by 0.06 and then add Mean - 0.03 to center the distribution around Mean.  If you are simulating a real process, then my initial guess would be that the results would follow a normal distribution.  In this case you could use the Gaussian White Noise VI from the Signal Generation Pallete with a standard deviation of 0.015 if you wanted 0.03 to be the 2 sigma point, and then add Mean to the results.
Message 2 of 6
(6,033 Views)
I always wondered why the the random number generator didnt have optional inputs like range and mean or max, min.  Most of the time this is how they are used.
Paul Falkenstein
Coleman Technologies Inc.
CLA, CPI, AIA-Vision
Labview 4.0- 2013, RT, Vision, FPGA
0 Kudos
Message 3 of 6
(6,028 Views)

falkpl wrote:
I always wondered why the the random number generator didnt have optional inputs like range and mean or max, min.  Most of the time this is how they are used.

Hmm.................. Kudos on your "Idea exchange" post................

 

Oh,..... wait,,,,,,,,,,,,, you haven't idea'd it-  YET.

 

 

Link to here from the LV Idea X.  good_Idea

 

Message Edited by Jeff Bohrer on 04-09-2010 09:09 PM

"Should be" isn't "Is" -Jay
0 Kudos
Message 4 of 6
(6,017 Views)
Thanks Darin,  I used the Gaussian White Noise.vi and it worked beautifully.  I was able to simulate what I needed and impress my professor also.  Thanks again!
0 Kudos
Message 5 of 6
(5,961 Views)

You can create a random number with a gaussian probability profile using two equal distributed (0...1) random numbers and applying the Box Muller transform.

 

I wrote one many years ago, her it is. 🙂 (LabVIEW 8.0). 

Message Edited by altenbach on 04-12-2010 09:13 PM
0 Kudos
Message 6 of 6
(5,948 Views)