# generating white gaussian noise in matlab using two different functions

I want to know the difference between the two Gaussian noises generated below? Which one is white and how can i make the other one white?

y=wgn(1,10000,0)


and

y=randn(1,10000);

• Welcome to DSP.SE! They are both white. Why do you think otherwise? – Peter K. May 4 '16 at 14:31
• because it is not mentioned in the matlab help that they are white. i believe they are just samples of a gaussian distribution. – zahraesb May 4 '16 at 14:46
• thank u Peter.im happy to be here.actually i'm having a hard time distinguishing the difference between whitness of samples and their gaussianity.i believe some samples generated of a specific distribution are not white(or uncorrelated) by them self and we shoud white them – zahraesb May 4 '16 at 14:57
• randn produces independent samples of a Gaussian random variable, which happens to be the same as Gaussian white noise. Note that this white noise is actually filtered to fit in the bandwidth specified by the sampling rate. – MBaz May 4 '16 at 15:02

A white noise sequence is one for which each (random) element is uncorrelated from every other element: $$E[y[n]y[m]] = \left \{ \begin{array}{ll} 0 & \mbox{for } n\not=m\\ \sigma_y^2 & \mbox{for } n = m \end{array} \right . \\= \sigma_y^2 \delta[n-m]$$ where $$\sigma^2_y$$ is the variance of $$y$$.

Note that I am assuming (because of the whiteness) that the signal is zero mean.

The whiteness of a signal says nothing about the distribution of its values. To know something about that, Gaussianity or some other distribution needs to be invoked.

The functions wgn and randn both produce white, Gaussian noise sequences.

Calling the function rand would produce a white, uniformly distributed noise sequence.

• A white noise sequence is one for which each s̶a̶m̶p̶l̶e̶ ̶i̶s̶ ̶s̶t̶a̶t̶i̶s̶t̶i̶c̶a̶l̶l̶y̶ ̶i̶n̶d̶e̶p̶e̶n̶d̶e̶n̶t̶ ̶f̶r̶o̶m̶ ̶e̶v̶e̶r̶y̶ ̶o̶t̶h̶e̶r̶ ̶s̶a̶m̶p̶l̶e̶ (random) element is statistically independent from every other element – toes Jan 24 at 14:27
• @toes What is the impact of your suggested change? Feel free to edit and have it reviewed. – Peter K. Jan 24 at 18:48
• I misquoted in my previous comment. Should've read ...is uncorrelated from every other element... Post is corrected now anyway – toes Jan 30 at 16:59

wgn() is specifically meant to create a white noise with a predefined power levels while randn() is meant to generate normally distributed random numbers WITHOUT specifying the power. You will have to scale the values generated from randn() to meet the desired noise power level. Basically wgn() (usually used with awgn()) makes your life easier if you want to create a noise with known power level.

Hope this helps!