ni.com is currently undergoing scheduled maintenance.

Some services may be unavailable at this time. Please contact us for help or try again later.

LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

poor-quality Gaussian randoms in LabView

Dear LabView Engineers

No action item: this is just a bug report
concerning the poor-quality Gaussian random
variables in LabView. A workaround
is given.

* Trying to accomplish?
Generate Gaussian noise in Labview
* What is the problem?
The built-in vi "Gaussian~White~Noise"
generates poor-quality random numbers.
* What is the origin of the problem?
LabView is using an algorithm
which yields random numbers of poor
statistical quality.
* What is the suggested fix?
In the next release, implement the
Box-Muller method, as described in the
book "Numerical Recipes", Section 7.2.

Thanks! By the way, LabView is a great
product overall. You engineers do a
good job.

********* detailed description follows *****

\footnote{The expressions given for the variance of the skew
(\ref{eq:skewSigmaDont},\ref{eq:skewSigmaDo}) and kurtosis
(\ref{eq:kurtosisSigma}) have been validated against
numerical data generated in LabView (version 5.01fd). These
experiments uncovered serious deficiencies in the LabView vi
\texttt{Gaussian~White~Noise}. Briefly, noise generated by
\texttt{Gaussian~White~Noise} has significantly too-small
values of the fourth moment and all higher moments. A
sample of $5\times10^{5}$ points showed:
\[\begin{cases}
\expect{x^{2}} = 1.002 \pm 0.002 & \text{should be 1}\\
\expect{x^{4}} = 2.92 \pm 0.01 & \text{should be 3}\\
\expect{x^{6}} = 13.7 \pm 0.1 & \text{should be 15}\\
\expect{x^{8}} = 86.9 \pm 1.2 & \text{should be 105}
\end{cases}\]
These numerical values strongly suggest that LabView
generates Gaussian variables by the easy-to-program but
highly inaccurate algorithm
$g = \sum_{i=1}^{12}\,(r_{i}-0.5)$,
where $r$ is uniformly distributed on the interval $(0,1)$
and $g$ approximates a normally distibuted variable. With
some help from \emph{Mathematica}, the first four moments of
$g$ can be shown to be $\expect{x^{2}}=1$, $\expect{x^{4}}=29/10
\simeq 2.9$, $\expect{x^{6}} = 569/42 \simeq 13.5$, and
$\expect{x^{8}}=2569/30 \simeq 85.6$, in precise accord with
the LabView numerical results.

Shame on you, National Instruments, for generating Gaussian
variables by such a second-rate algorithm! The
much-superior Box-Muller algorithm (see \emph{Numerical
Recipes}) is implemented in
\texttt{JAS~Gaussian~White~Noise}, which is functionally
equivalent to LabView's \texttt{Gaussian~White~Noise}.}
0 Kudos
Message 1 of 1
(5,895 Views)