comm.CPMDemodulator

Demodulate using CPM method and Viterbi algorithm

Description

The CPMDemodulator object demodulates a signal that was modulated using continuous phase modulation. The input is a baseband representation of the modulated signal.

To demodulate a signal that was modulated using continuous phase modulation:

  1. Define and set up your CPM demodulator object. See Construction.

  2. Call step to demodulate a signal according to the properties of comm.CPMDemodulator. The behavior of step is specific to each object in the toolbox.

Note

Starting in R2016b, instead of using the step method to perform the operation defined by the System object™, you can call the object with arguments, as if it were a function. For example, y = step(obj,x) and y = obj(x) perform equivalent operations.

Construction

H = comm.CPMDemodulator creates a demodulator System object, H. This object demodulates the input continuous phase modulated (CPM) data using the Viterbi algorithm.

H = comm.CPMDemodulator(Name,Value) creates a CPM demodulator 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).

H = comm.CPMDemodulator(M,Name,Value) creates a CPM demodulator object, H, with the ModulationOrder property set to M, and the other specified properties set to the specified values.

Properties

ModulationOrder

Size of symbol alphabet

Specify the size of the symbol alphabet. The value of this property requires a power of two, real, integer scalar. The default is 4.

BitOutput

Output data as bits

Specify whether the output consists of groups of bits or integer values. The default is false.

When you set this property to false, the step method outputs a column vector of length equal to N/SamplesPerSymbol and with elements that are integers between -(ModulationOrder-1) and ModulationOrder–1. Here, N, is the length of the input signal which indicates the number of input baseband modulated symbols.

When you set this property to true, the step method outputs a binary column vector of length equal to P×(N/SamplesPerSymbol), where P = log2(ModulationOrder). The output contains length-P bit words. In this scenario, the object first maps each demodulated symbol to an odd integer value, K, between –(ModulationOrder–1) and ModulationOrder–1. The object then maps K to the nonnegative integer (K+ModulationOrder–1)/2. Finally, the object maps each nonnegative integer to a length-P binary word, using the mapping specified in the SymbolMapping property.

SymbolMapping

Symbol encoding

Specify the mapping of the demodulated symbols as one of Binary | Gray. The default is Binary. This property determines how the object maps each demodulated integer symbol value (in the range 0 and ModulationOrder–1) to a P-length bit word, where P = log2(ModulationOrder).

When you set this property to Binary, the object uses a natural binary-coded ordering.

When you set this property to Gray, the object uses a Gray-coded ordering.

This property applies when you set the BitOutput property to true.

ModulationIndex

Modulation index

Specify the modulation index. The default is 0.5. The value of this property can be a scalar, h, or a column vector, [h0, h1, …. hH-1]

where H-1 represents the length of the column vector.

When hi varies from interval to interval, the object operates in multi-h. When the object operates in multi-h, hi must be a rational number.

FrequencyPulse

Frequency pulse shape

Specify the type of pulse shaping that the modulator has used to smooth the phase transitions of the input modulated signal as one of Rectangular | Raised Cosine | Spectral Raised Cosine | Gaussian | Tamed FM. The default is Rectangular.

MainLobeDuration

Main lobe duration of spectral raised cosine pulse

Specify, in number of symbol intervals, the duration of the largest lobe of the spectral raised cosine pulse. This value is the value that the modulator used to pulse-shape the input modulated signal. The default is 1. This property requires a real, positive, integer scalar. This property applies when you set the FrequencyPulse property to Spectral Raised Cosine.

RolloffFactor

Rolloff factor of spectral raised cosine pulse

Specify the roll off factor of the spectral raised cosine pulse. This value is the value that the modulator used to pulse-shape the input modulated signal. The default is 0.2. This property requires a real scalar between 0 and 1. This property applies when you set the FrequencyPulse property to Spectral Raised Cosine.

BandwidthTimeProduct

Product of bandwidth and symbol time of Gaussian pulse

Specify the product of bandwidth and symbol time for the Gaussian pulse shape. This value is the value that the modulator used to pulse-shape the input modulated signal. The default is 0.3. This property requires a real, positive scalar. This property applies when you set the FrequencyPulse property to Gaussian.

PulseLength

Pulse length

Specify the length of the frequency pulse shape in symbol intervals. The value of this property requires a real positive integer. The default is 1.

SymbolPrehistory

Symbol prehistory

Specify the data symbols used by the modulator prior to the first call to the step method. The default is 1. This property requires a scalar or vector with odd integer elements between –(ModulationOrder–1) and (ModulationOrder–1). If the value is a vector, then its length must be one less than the value in the PulseLength property.

InitialPhaseOffset

Initial phase offset

Specify the initial phase offset of the input modulated waveform in radians as a real, numeric scalar. The default is 0.

SamplesPerSymbol

Number of samples per input symbol

Specify the expected number of samples per input symbol as a positive, integer scalar. The default is 8.

TracebackDepth

Traceback depth for Viterbi algorithm

Specify the number of trellis branches that the Viterbi algorithm uses to construct each traceback path as a positive, integer scalar. The default is 16. The value of this property is also the output delay, which is the number of zero symbols that precede the first meaningful demodulated symbol in the output.

OutputDataType

Data type of output

Specify the output data type as one of int8 | int16 | int32 | double, when you set the BitOutput property to false. When you set the BitOutput property to true, specify the output data type as one of logical | double. The default is double.

Methods

resetReset states of CPM demodulator object
stepDemodulate using CPM method and Viterbi algorithm
Common to All System Objects
release

Allow System object property value changes

Examples

collapse all

% Create a CPM modulator, an AWGN channel, and a CPM demodulator. 
    hMod = comm.CPMModulator(8, 'BitInput', true, ...
                         'SymbolMapping', 'Gray');
    hAWGN = comm.AWGNChannel('NoiseMethod', ...
                         'Signal to noise ratio (SNR)','SNR',0);
    hDemod = comm.CPMDemodulator(8, 'BitOutput', true, ...
                         'SymbolMapping', 'Gray');
% Create an error rate calculator, account for the delay caused by the Viterbi algorithm.
    delay = log2(hDemod.ModulationOrder)*hDemod.TracebackDepth;
    hError = comm.ErrorRate('ReceiveDelay', delay);
    for counter = 1:100
        % Transmit 100 3-bit words
        data = randi([0 1],300,1);
        modSignal = step(hMod, data);
        noisySignal = step(hAWGN, modSignal);
        receivedData = step(hDemod, noisySignal);
        errorStats = step(hError, data, receivedData);
    end
    fprintf('Error rate = %f\nNumber of errors = %d\n', ...
      errorStats(1), errorStats(2))
Error rate = 0.004006
Number of errors = 120

Using the comm.CPMModulator and comm.CPMDemodulator System objects apply GFSK modulation and demodulation to random bit data.

Create a GFSK modulator and demodulator object pair.

gfskMod = comm.CPMModulator('ModulationOrder', 2, 'FrequencyPulse', 'Gaussian', ... 
               'BandwidthTimeProduct', 0.5, 'ModulationIndex', 1, ...
               'BitInput', true);
gfskDemod = comm.CPMDemodulator('ModulationOrder', 2, 'FrequencyPulse', 'Gaussian', ... 
               'BandwidthTimeProduct', 0.5, 'ModulationIndex', 1, ...
               'BitOutput', true);

Generate random bit data and apply GFSK modulation. Use a scatter plot to view the constellation.

numSym = 100;
x = randi([0 1],numSym*gfskMod.SamplesPerSymbol,1);
y = gfskMod(x);
eyediagram(y,16)

Demodulate the GFSK modulated data. To verify that the demodulated signal data is equal to the original data, you must account for the delay introduced by the Gaussian filtering in the GFSK modulation and demodulation processing.

z = gfskDemod(y);
delay = finddelay(x,z);
isequal(x(1:end-delay),z(delay+1:end))
ans = logical
   1

Algorithms

This object implements the algorithm, inputs, and outputs described on the CPM Demodulator Baseband block reference page. The object properties correspond to the block parameters. For CPM the phase shift per symbol is π × h, where h is the modulation index.

Extended Capabilities

Introduced in R2012a