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.


Add white Gaussian noise to signal


y = awgn(x,snr)
y = awgn(x,snr,sigpower)
y = awgn(x,snr,'measured')
y = awgn(___,streamhandle)
y = awgn(___,seed)
y = awgn(___,powertype)


y = awgn(x,snr) adds white Gaussian noise to the vector signal x. The scalar snr specifies the signal-to-noise ratio per sample, in dB. If x is complex, awgn adds complex noise. This syntax assumes that the power of x is 0 dBW.

y = awgn(x,snr,sigpower) accepts the input sigpower, which specifies the power of x in dBW.

y = awgn(x,snr,'measured') accepts the input 'measured' to specify that the power of x is measured before adding noise.

y = awgn(___,streamhandle) accepts input combinations from prior syntaxes and a random stream handle to generate normal random noise samples by using randn. Providing a random stream handle or using the reset function on the default random stream object enables you to generate repeatable noise samples. For more information, see RandStream.

y = awgn(___,seed) accepts a seed value for initializing the normal random number generator, randn, before white Gaussian noise is added to the input signal. If you want to generate repeatable noise samples, then either reset the random stream input before calling awgn or use the same seed input.

y = awgn(___,powertype) specifies the signal and noise power type as 'dB' or 'linear'.

  • If powertype is 'db', then snr is measured in dB and sigpower is measured in dBW.

  • If powertype is 'linear', then snr is measured as a ratio and sigpower is measured in watts.

For the relationships between SNR and other measures of the relative power of the noise, such as Es/N0, and Eb/N0, see Describing the Noise Level of an AWGN Channel.


collapse all

Create a sawtooth wave.

t = (0:0.1:10)';
x = sawtooth(t);

Apply white Gaussian noise and plot the results.

y = awgn(x,10,'measured');
plot(t,[x y])
legend('Original signal','Signal with AWGN')

Transmit and receive data using a nonrectangular 16-ary constellation in the presence of Gaussian noise. Show the scatter plot of the noisy constellation and estimate the symbol error rate (SER) for two different signal-to-noise ratios.

Create a 16-QAM constellation based on the V.29 standard for telephone-line modems.

c = [-5 -5i 5 5i -3 -3-3i -3i 3-3i 3 3+3i 3i -3+3i -1 -1i 1 1i];
M = length(c);

Generate random symbols.

data = randi([0 M-1],2000,1);

Modulate the data using the genqammod function. General QAM modulation is necessary because the custom constellation is not rectangular.

modData = genqammod(data,c);

Pass the signal through an AWGN channel having a 20 dB signal-to-noise ratio (SNR).

rxSig = awgn(modData,20,'measured');

Display a scatter plot of the received signal and the reference constellation, c.

h = scatterplot(rxSig);
hold on

Demodulate the received signal using the genqamdemod function and determine the number of symbol errors and the symbol error ratio.

demodData = genqamdemod(rxSig,c);
[numErrors,ser] = symerr(data,demodData)
numErrors = 1
ser = 5.0000e-04

Repeat the transmission and demodulation process with an AWGN channel having a 10 dB SNR. Determine the symbol error rate for the reduced SNR. As expected, the performance degrades when the SNR is decreased.

rxSig = awgn(modData,10,'measured');
demodData = genqamdemod(rxSig,c);
[numErrors,ser] = symerr(data,demodData)
numErrors = 462
ser = 0.2310

See Also


Introduced before R2006a

Was this topic helpful?