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. For more information about the demodulation and filtering applied, see Algorithms.

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 to demodulate input CPFSK-modulated signals using the Viterbi algorithm.

cpfskDemod=comm.CPFSKDemodulator(Name=Value) 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.

cpfskDemodcomm.CPFSKDemodulator(M,Name=Value) sets the ModulationOrder property to M and optional name-value arguments.

example

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.

Modulation order, specified as a power-of-two scalar. The modulation order, M = 2k specifies number of points in the symbol alphabet. k is a positive integer indicating the number of bits per symbol.

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

  • Set this property to false to output data as integers.

  • Set this property to true to output data as bits.

For more information, see Integer-Valued and Binary-Valued Output Signals.

Symbol mapping, specified as 'Binary' or 'Gray'. This property determines how each integer maps to a group of output bits.

  • Set this property to 'Binary' to map symbols using binary-coded ordering.

  • Set this property to 'Gray' to map symbols using Gray-coded ordering.

Dependencies

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

Modulation index {hi}, specified as a nonnegative scalar or column vector. The modulator operates in multi-h. For more information, see CPFSK Demodulation.

Initial phase offset in radians, specified as a scalar. This parameter value is initial phase offset of the modulated waveform.

Symbol sampling rate, specified as a positive integer. This property specifies the input symbol downsampling factor for each output sample.

Traceback depth for the Viterbi algorithm, specified as a positive integer. The traceback depth specifies the number of trellis branches that the Viterbi algorithm uses to construct each traceback path. The value of this parameter is also the output delay and the number of zero symbols that precede the first meaningful demodulated symbol in the output. For more information, see Traceback Depth and Output Delays.

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 to double-precision, or signed-integer data types.

  • When you set the BitOutput property to true, you can set the output to double-precision or logical data types.

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 frame size (number of rows) of the signal during simulation. For more information, see Variable-Size Signals in Code.

Data Types: double | single
Complex Number Support: Yes

Output Arguments

expand all

Demodulated output signal, returned as a column vector or a matrix. For more information, see Integer-Valued and Binary-Valued Output Signals and Traceback Depth and Output Delays.

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

More About

expand all

Algorithms

expand all

References

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

Extended Capabilities

expand all

Version History

Introduced in R2012a

expand all