Main Content

comm.CPFSKDemodulator

Demodulate using CPFSK method and Viterbi algorithm

Description

The comm.CPFSKDemodulator System object™ demodulates a signal that was modulated using the continuous phase frequency shift keying (CPFSK) method. The input is a baseband representation of the modulated signal.

To demodulate a signal that was modulated using the CPFSK method:

  1. Create the comm.CPFSKDemodulator object and set its properties.

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

To learn more about how System objects work, see What Are System Objects?

Creation

Description

cpfskDemod=comm.CPFSKDemodulator creates a demodulator System object. This object demodulates the input CPFSK-modulated data using the Viterbi algorithm.

cpfskDemod=comm.CPFSKDemodulator(Name=Value) creates a CPFSK demodulator object and sets properties using one or more name-value arguments. For example, comm.CPFSKDemodulator(InitialPhaseOffset=pi/4,TracebackDepth=25), configures the object with an initial phase offset of pi/4 radians and a Viterbi algorithm traceback depth of 25.

example

cpfskDemodcomm.CPFSKDemodulator(M,Name=Value) creates a CPFSK demodulator object with the ModulationOrder property set to M, and optional name-value 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.

For more information on changing property values, see System Design in MATLAB Using System Objects.

Size of the symbol alphabet, specified as a power-of-two integer scalar.

Option to output data as bits, specified as a numeric or logical 1 (true) or 0 (false).

  • When you set this property to false, output Y is an (N / SamplesPerSymbol) long column vector containing integers in the range [–(M–1), (M–1)]. N is the number of input baseband modulated symbols (specifically, the length of the input signal). M represents the value of the ModulationOrder property.

  • When you set this property to true, output Y is a binary column vector of a length equal to P×(N / SamplesPerSymbol). The output contains length-P bit words, where P = log2(M). In this scenario, the object first maps each demodulated symbol to an odd integer value, K, in the range [–(M–1), (M–1)]. The object then maps K to the nonnegative integer (K+M–1)/2. Finally, the object maps each nonnegative integer to a length-P bit word, using the mapping that you specify in the SymbolMapping property.

Symbol encoding, specified as 'Binary' or 'Gray'. This property determines how the object maps each demodulated integer symbol value to a P-length bit word, where P = log2(M) and M represents the ModulationOrder property. The integer symbol values are in the range [0, M].

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

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

Dependencies

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

Modulation index, specified as a scalar, h, or a column vector, [h0, h1, …. hH–1]. 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.

Initial phase offset in radians, specified as a numeric scalar.

Number of samples per input symbol, specified as a positive, integer scalar.

Traceback depth for the Viterbi algorithm, specified as a positive, integer scalar. The value of this property is also the value of the output delay. That value is the number of zero symbols that precede the first meaningful demodulated symbol in the output.

Data type of the output, specified as 'double', 'int8', 'int16', 'int32', or 'logical'.

  • When you set the BitOutput property to false, you can set the output data type to 'double', 'int8', 'int16', or 'int32'.

  • When you set the BitOutput property to true, you can set the output data type to 'double' or 'logical'.

Usage

Description

Y = cpfskDemod(X) demodulates the input signal by using the CPFSK method.

Input Arguments

expand all

CPFSK-modulated baseband signal, specified as a column vector with a length equal to an integer multiple of the number of SamplesPerSymbol.

This object accepts variable-size inputs. After the object is locked, you can change the size of each input channel, but you cannot change the number of channels. For more information, see Variable-Size Signal Support with System Objects.

Data Types: double | single
Complex Number Support: Yes

Output Arguments

expand all

Demodulated output signal, returned as a column value or a matrix. To specify whether the object outputs values as integers or bits, use the BitOutput property. To specify the output data type, use the OutputDataType property.

Data Types: double | int8 | int16 | int32 | logical

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

stepRun System object algorithm
releaseRelease resources and allow changes to System object property values and input characteristics
resetReset internal states of System object

Examples

collapse all

Create a CPFSK modulator, an AWGN channel, and a CPFSK demodulator. Configure the modulator and demodulator with modulation order set to 8, bit input, and Gray-encoded symbol mapping.

M = 8; % Modulation order
cpfskMod = comm.CPFSKModulator(M, ...
    BitInput=true, ...
    SymbolMapping='Gray');
awgnChan = comm.AWGNChannel( ...
    NoiseMethod='Signal to noise ratio (SNR)', ...
    SNR=0);
cpfskDemod = comm.CPFSKDemodulator(M, ...
    BitOutput=true, ...
    SymbolMapping='Gray');

Define the simulation parameters. Create an error rate calculator, accounting for the delay caused by the Viterbi algorithm that the CPFSK demodulator uses.

numFrames = 1000; % Number of frames transmitted
k = log2(M);      % Bits per symbol 
spf = 100;        % Symobls per frame

delay = log2(M)*cpfskDemod.TracebackDepth;
errorRate = comm.ErrorRate( ...
    ReceiveDelay=delay);
for counter = 1:numFrames
    data = randi([0 1],k*spf,1);
    modSignal = cpfskMod(data);
    noisySignal = awgnChan(modSignal);
    receivedData = cpfskDemod(noisySignal);
    errorStats = errorRate(data,receivedData);
end

fprintf('Error rate = %f\nNumber of errors = %d\n', ...
    errorStats(1),errorStats(2))
Error rate = 0.004247
Number of errors = 1274

Algorithms

expand all

For CPFSK, the phase shift per symbol is π × h, where h is the modulation index.

References

[1] Anderson, John B., Tor Aulin, and Carl-Erik Sundberg. Digital Phase Modulation. New York: Plenum Press, 1986.

Extended Capabilities

Version History

Introduced in R2012a

expand all