Documentation

# comm.PhaseNoise

Apply phase noise to baseband signal

## Description

The `comm.PhaseNoise` System object™ adds phase noise to a complex signal. This object emulates impairments introduced by the local oscillator of a wireless communication transmitter or receiver. The object generates filtered phase noise according to the specified spectral mask and adds it to the input signal. For a description of the phase noise modeling, see Algorithms.

To add phase noise using a `comm.PhaseNoise` object:

1. Create the `comm.PhaseNoise` object and set its properties.

2. Call the object with arguments, as if it were a function.

## Creation

### Syntax

``phznoise = comm.PhaseNoise``
``phznoise = comm.PhaseNoise(Name,Value)``
``phznoise = comm.PhaseNoise(level,offset,samplerate)``

### Description

````phznoise = comm.PhaseNoise` creates a phase noise System object with default property values.```

example

````phznoise = comm.PhaseNoise(Name,Value)` creates a phase noise object with the specified property `Name` set to the specified `Value`. You can specify additional name-value pair arguments in any order as (`Name1`,`Value1`,...,`NameN`,`ValueN`).```
````phznoise = comm.PhaseNoise(level,offset,samplerate)` creates a phase noise object with the phase noise level, frequency offset, and sample rate properties specified as value-only arguments. When specifying a value-only argument, you must specify all preceding value-only arguments.```

## Properties

expand all

Unless otherwise indicated, properties are nontunable, which means you cannot change their values after calling the object. Objects lock when you call them, and the `release` function unlocks them.

If a property is tunable, you can change its value at any time.

Phase noise level in decibels relative to carrier per hertz (dBc/Hz), specified as a vector of negative scalars. The `Level` and `FrequencyOffset` properties must have the same length.

Data Types: `double`

Frequency offset in Hz, specified as a vector of positive increasing values. The `Level` and `FrequencyOffset` properties must have the same length.

Data Types: `double`

Sample rate in samples per second, specified as a positive scalar. To avoid aliasing, the sample rate must be greater than twice the largest value specified by `FrequencyOffset`.

Data Types: `double`

Source of the random stream, specified as `'Global stream'` or `'mt19937ar with seed'`.If `RandomStream` is set to `'mt19937ar with seed'`, the mt19937ar algorithm is used for normally distributed random number generation, in which case the reset method reinitializes the random number stream to the value of the `Seed` property.

Data Types: `char` | `string`

Initial seed for `RandomStream`, specified as a positive scalar less than 232.

#### Dependencies

To enable this property, set `RandomStream` to `'mt19937ar with seed'`.

Data Types: `double`

## Usage

### Syntax

``out = phznoise(in)``

### Description

example

````out = phznoise(in)` adds phase noise, specified by the `phznoise` System object, to the input signal. The result is returned in `out`.```

### Input Arguments

expand all

Input signal, specified as an NS-by-1 vector of complex values. NS is the number of samples.

Data Types: `double`
Complex Number Support: Yes

### Output Arguments

expand all

Output signal, returned as an NS-by-1 vector of complex values. NS equals the number of samples in the input signal.

Data Types: `double`
Complex Number Support: Yes

## Object Functions

To use an object function, specify the System object as the first input argument. For example, to release system resources of a System object named `obj`, use this syntax:

`release(obj)`

expand all

 `visualize` Visualize spectrum mask of phase noise
 `step` Run System object algorithm `release` Release resources and allow changes to System object property values and input characteristics `reset` Reset internal states of System object

## Examples

expand all

Add a phase noise vector and frequency offset vector to a 16-QAM signal. Then plot the signal.

Create a phase noise System object.

`pnoise = comm.PhaseNoise('Level',-50,'FrequencyOffset',20);`

Generate modulated symbols.

```M = 16; % From 16-QAM data = randi([0 M-1],1000,1); modData = qammod(data,M);```

Use `pnoise` to apply phase noise. Plot the impaired data.

```y = pnoise(modData); scatterplot(y)```

Create a sine wave generator having a carrier frequency of 100 Hz, a sample rate of 1000 Hz, and a frame size of 10,000 samples.

```sinewave = dsp.SineWave('Frequency',100,'SampleRate',1000, ... 'SamplesPerFrame',1e4,'ComplexOutput',true); ```

Create a phase noise object. Specify the phase noise level to be ?40 dBc/Hz for a 100 Hz offset and ?70 dBc/Hz for a 200 Hz offset.

```pnoise = comm.PhaseNoise('Level',[-40 -70],'FrequencyOffset',[100 200], ... 'SampleRate',1000); ```

Create a spectrum analyzer.

```spectrum = dsp.SpectrumAnalyzer('NumInputPorts',2,'SampleRate',1000, ... 'SpectralAverages',10,'PowerUnits','dBW'); ```

Generate a sine wave and add phase noise to it. Plot the spectrum of the sine wave and the noisy signal.

```x = sinewave(); y = pnoise(x); spectrum(x,y) ```

The phase noise is ?40 dBW within �100 Hz of the carrier. The phase noise is ?70 dB below the carrier for offsets greater than 200 Hz.

## Algorithms

The output signal, yk, is related to input sequence xk by yk=xkejφk, where φk is the phase noise. The phase noise is filtered Gaussian noise such that φk=f(nk), where nk is the noise sequence and f represents a filtering operation.

To model the phase noise, define the power spectrum density (PSD) mask characteristic by specifying scalar or vector values for the frequency offset and phase noise level.

• For a scalar frequency offset and phase noise level specification, an IIR digital filter computes the spectrum mask. The spectrum mask has a 1/f characteristic that passes through the specified point.

• For a vector frequency offset and phase noise level specification, an FIR filter computes the spectrum mask. The spectrum mask is interpolated across log10(f). It is flat from DC to the lowest frequency offset, and from the highest frequency offset to half the sample rate.

IIR Digital Filter

For the IIR digital filter, the numerator coefficient is

`$\lambda =\sqrt{2\pi {f}_{offset}{10}^{L/10}}\text{\hspace{0.17em}},$`

where foffset is the frequency offset in Hz and L is the phase noise level in dBc/Hz. The denominator coefficients, γi, are recursively determined as

`${\gamma }_{i}=\left(i-2.5\right)\frac{{\gamma }_{i-1}}{i-1}\text{\hspace{0.17em}},$`

where γ1 = 1, i = {1, 2,..., Nt}, and Nt is the number of filter coefficients. Nt is a power of 2, from `2`7 to `2`19. The value of Nt grows as the phase noise offset decreases towards 0 Hz.

FIR Filter

For the FIR filter, the phase noise level is determined through log10(f) interpolation for frequency offsets over the range [df, fs / 2], where df is the frequency resolution and fs is the sample rate. The phase noise is flat from 0 Hz to the smallest frequency offset, and from the largest frequency offset to fs / 2. The frequency resolution is equal to $\frac{{f}_{s}}{2}\left(\frac{1}{{N}_{t}}\right)$, where Nt is the number of coefficients, and is a power of 2 less than or equal to `2`16. If Nt < `2`8, a time domain FIR filter is used. Otherwise, a frequency domain FIR filter is used.

The algorithm increases Nt until these conditions are met:

• The frequency resolution is less than the minimum value of the frequency offset vector.

• The frequency resolution is less than the minimum difference between two consecutive frequencies in the frequency offset vector.

• The maximum number of FIR filter taps is `2`16.

## References

[1] Kasdin, N. J., "Discrete Simulation of Colored Noise and Stochastic Processes and 1/(f^alpha); Power Law Noise Generation." The Proceedings of the IEEE. Vol. 83, No. 5, May, 1995, pp 802–827.