Documentation |
Package: comm
Add white Gaussian noise to input signal
The AWGNChannel object adds white Gaussian noise to a real or complex input signal. When the input uses a real-valued signal, this object adds real Gaussian noise and produces a real output signal. When the input uses a complex signal, this object adds complex Gaussian noise and produces a complex output signal.
When the inputs to the object have a variable number of channels, the EbNo, EsNo, SNR, BitsPerSymbol, SignalPower, SamplesPerSymbol, and Variance properties must be scalars, when applicable.
To add white Gaussian noise to an input signal:
Define and set up your additive white Gaussian noise channel object. See Construction.
Call step to add white Gaussian noise to the input signal according to the properties of comm.AWGNChannel. The behavior of step is specific to each object in the toolbox.
H = comm.AWGNChannel creates an additive white Gaussian noise (AWGN) channel System object™, H. This object then adds white Gaussian noise to a real or complex input signal.
H = comm.AWGNChannel(Name,Value) creates an AWGN channel object, H, with each specified property set to the specified value. You can specify additional name-value pair arguments in any order as (Name1,Value1,...,NameN,ValueN).
NoiseMethod |
Method to specify noise level Select the method to specify the noise level as one of Signal to noise ratio (Eb/No) | Signal to noise ratio (Es/No)| Signal to noise ratio (SNR) | Variance. The default is Signal to noise ratio (Eb/No). |
EbNo |
Energy per bit to noise power spectral density ratio (Eb/No) Specify the Eb/No ratio in decibels. You can set this property to a numeric, real scalar or row vector with a length equal to the number of channels. This property applies when you set the NoiseMethod property to Signal to noise ratio (Eb/No). The default is 10. This property is tunable. |
EsNo |
Energy per symbol to noise power spectral density ratio (Es/No) Specify the Es/No ratio in decibels. You can set this property to a numeric, real scalar or row vector with a length equal to the number of channels. This property applies when you set the NoiseMethod property to Signal to noise ratio (Es/No). The default is 10. This property is tunable. |
SNR |
Signal to noise ratio (SNR) Specify the SNR value in decibels. You can set this property to a numeric, real scalar or row vector with a length equal to the number of channels. This property applies when you set the NoiseMethod property to Signal to noise ratio (SNR). The default is 10. This property is tunable. |
BitsPerSymbol |
Number of bits in one symbol Specify the number of bits in each input symbol. You can set this property to a numeric, positive, integer scalar or row vector with a length equal to the number of channels. This property applies when you set the NoiseMethod property to Signal to noise ratio (Eb/No). The default is 1 bit. |
SignalPower |
Input signal power in Watts Specify the mean square power of the input signal in Watts. You can set this property to a numeric, positive, real scalar or row vector with a length equal to the number of channels. This property applies when you set the NoiseMethod property to Signal to noise ratio (Eb/No), Signal to noise ratio (Es/No), or Signal to noise ratio (SNR). The default is 1. The object assumes a nominal impedance of 1 Ω. This property is tunable. |
SamplesPerSymbol |
Number of samples per symbol Specify the number of samples per symbol. You can set this property to a numeric, positive, integer scalar or row vector with a length equal to the number of channels. This property applies when you set the NoiseMethod property to Signal to noise ratio (Eb/No) or Signal to noise ratio (Es/No). The default is 1. |
VarianceSource |
Source of noise variance Specify the source of the noise variance as one of Property | Input port. The default is Property. Set this property to Input port to specify the noise variance value using an input to the step method. Set this property to Property to specify the noise variance value using the Variance property. This property applies when you set the NoiseMethod property to Variance. |
Variance |
Noise variance Specify the variance of the white Gaussian noise. You can set this property to a numeric, positive, real scalar or row vector with a length equal to the number of channels. This property applies when you set the NoiseMethod property to Variance and the VarianceSource property to Property. The default is 1. This property is tunable. |
RandomStream |
Source of random number stream Specify the source of random number stream as one of Global stream | mt19937ar with seed. The default value of this property is Global stream. When you set this property to Global stream, the object uses the current global random number stream for normally distributed random number generation. When you set this property to mt19937ar with seed, the object uses the mt19937ar algorithm for normally distributed random number generation. In this scenario, when you call the reset method, the object re-initializes the random number stream to the value of the Seed property. |
Seed |
Initial seed of mt19937ar random number stream Specify the initial seed of a mt19937ar random number generator algorithm as a double-precision, real, nonnegative integer scalar. The default value of this property is 67. This property applies when you set the RandomStream property to mt19937ar with seed. For each call to the reset method, the object re-initialize the mt19937ar random number stream to the Seed value. |
clone | Create AWGN channel object with same property values |
getNumInputs | Number of expected inputs to step method |
getNumOutputs | Number of outputs from step method |
isLocked | Locked status for input attributes and nontunable properties |
release | Allow property value and input characteristics changes |
reset | Reset states of the AWGNChannel System object |
step | Add white Gaussian noise to input signal |
This object implements the algorithm, inputs, and outputs described on the AWGN Channel block reference page. The object properties correspond to the block parameters, except for:
The block uses a random number generator based on the V5 RANDN (Ziggurat) algorithm and an initial seed, set with the Initial seed parameter to initialize the random number generator. Every time the system that contains the block is run, the block generates the same sequence of random numbers. Similarly, on the object, when you set the RandomStream property to mt19937ar with seed, you can generate reproducible numbers by resetting the object.
When you set the RandomStream property to Global stream, this object uses the MATLAB^{®} default random stream to generate random numbers. To generate reproducible numbers using this object, you can reset the MATLAB default random stream using the following code.
reset(RandStream.getGlobalStream)
For more information, see help for RandStream.
Sometimes, the input to the step method is complex. In such cases, if you try to match the block and object's random generator and seed by setting the random stream of MATLAB, the random numbers do not appear in the same order.
The object creates the random data as follows:
noise = randn(lengthInput,1) + 1i$$\times $$randn(lengthInput,1) |
The block creates random data as follows:
randData = randn(2$$\times $$lengthInput,1) |
noise = randData(1:2:end) + 1i$$\times $$randData(2:2:end) |
The Symbol period block parameter corresponds to the SamplesPerSymbol property.
The Variance from mask and Variance from port block parameter options of the Mode parameter correspond to the VarianceSource property.