This is machine translation

Translated by Microsoft
Mouseover text to see original. Click the button below to return to the English verison of the page.

Note: This page has been translated by MathWorks. Please click here
To view all translated materals including this page, select Japan from the country navigator on the bottom of this page.


Generate white Gaussian noise


y = wgn(m,n,p)
y = wgn(m,n,p,imp)
y = wgn(m,n,p,imp,state)
y = wgn(...,powertype)
y = wgn(...,outputtype)


y = wgn(m,n,p) generates an m-by-n matrix of white Gaussian noise. p specifies the power of y in decibels relative to a watt. The default load impedance is 1 ohm.

y = wgn(m,n,p,imp) is the same as the previous syntax, except that imp specifies the load impedance in ohms.

y = wgn(m,n,p,imp,s) uses s, which is a random stream handle, to generate random noise samples with randn. This syntax is useful to generate repeatable outputs. Type help RandStream for more information.

y = wgn(m,n,p,imp,state) is the same as the previous syntax, except that wgn first resets the state of the normal random number generator randn to the integer state.

    Note:   This usage is deprecated and may be removed in a future release. Instead of state, use s, as in the previous example.

y = wgn(...,powertype) is the same as the previous syntaxes, except that the character vector powertype specifies the units of p. Choices for powertype are 'dBW', 'dBm', and 'linear'.

y = wgn(...,outputtype) is the same as the previous syntaxes, except that the character vector outputtype specifies whether the noise is real or complex. Choices for outputtype are 'real' and 'complex'. If outputtype is 'complex', then the real and imaginary parts of y each have a noise power of p/2.

    Note:   The unit of measure for the output of the wgn function is Volts. For power calculations, it is assumed that there is a load of 1 Ohm.


collapse all

Generate a column vector of length 1000 containing real white Gaussian noise of power 0 dBW.

y1 = wgn(1000,1,0);

Confirm that the power is approximately 0 dBW, that is, 1 W.

ans =


Generate a vector of complex white Gaussian noise having power -6 dBW.

y2 = wgn(1000,1,-6,'complex');

Confirm that the power is 0.25 W (-6 dBW).

ans =


See Also


Introduced before R2006a

Was this topic helpful?