CPFSK Demodulator Baseband
Demodulate CPFSK-modulated data
Libraries:
Communications Toolbox /
Modulation /
Digital Baseband Modulation /
CPM
Description
The CPFSK Demodulator Baseband block demodulates a signal that was modulated using the continuous phase frequency shift keying (CPFSK) method. The input to this block is a baseband representation of the modulated signal. For more information about the demodulation and filtering applied, see Algorithms.
Examples
Demodulate a CPFSK-modulated signal impaired by AWGN and compute the bit error rate.
The cm_cpfsk_mod_demod model generates random integer data, converts it to bipolar values, and then applies CPFSK modulation to frames data. The CPFSK-modulated signal passes through an AWGN channel and then is demodulated by using the CPFSK method. The bit error rate is calculated on frames of data.
The Error Rate Calculation block has the receive delay set to the value of the traceback depth used by the CPFSK Baseband Demodulator block. The model uses the Find Delay block to confirm the delay equals the value of the traceback depth.

Transmit to receive delay is 16 symbols. BER = 0.0023474
Nonlinear digital demodulation techniques can be more prone to issues caused by misalignment of symbol boundaries due to their sensitivity to timing errors, increased susceptibility to intersymbol interference (ISI), and potential for introducing nonlinear distortions. For the demodulation to work correctly, the input signal to the demodulator block must have the correct alignment. Various blocks between the modulator and the demodulator introduce processing delays, leading to incorrect alignment. This example shows how to correct this type of misalignment.
Open the Model
The model includes the following blocks:
The Bernoulli Binary Generator block generates random binary inputs.
The CPFSK Modulator Baseband and CPFSK Demodulator Baseband blocks use continuous phase frequency shift keying (CFPSK) for modulation and demodulation.
The Raised Cosine Transmit Filter and Raised Cosine Receive Filter blocks to apply pulse shaping by interpolating and decimating the input signal using a raised cosine finite impulse response (FIT) filter.
The AWGN Channel block is for channel modeling.
The Error Rate Calculation block computes the bit error rate.
Adjust Delays
The CPFSK Demodulator block processes each collection of eight samples per symbol to compute one output symbol. For binary CPFSK with a modulation index of 1/2, the demodulator input must align along even numbers of symbols. The requirement applies only to binary CPFSK with a modulation index of 1/2. Other CPM schemes with different M-ary values and modulation indexes have different requirements.
Both the Raised Cosine Transmit Filter and the Raised Cosine Receive Filter introduce a group delay (GD) in the system. Set the Filter Span in Symbols property in both the filters to 2*2 . GD in symbols is half of the filter span which is 2 , and the combined GD is 4.



To ensure that the CPFSK Demodulator block receives the input samples in aligned to the start of the traceback depth specified in the block, you use the Delay block to introduce a delay of 12 samples. In sample-based mode, the CPFSK Demodulator block introduces a delay of Traceback length + 1 samples at its output. With a Traceback length of 16, the total CPFSK Demodulator Delay is 17 and the total receiver delay is 17 + 2 = 19 samples.
Run the Model
When you run the model, you can see:

Evaluate Error Rates
The Error Rate Calculation block shows a minimal error count, indicating an overall low error rate in the system compared to the number of samples evaluated. This outcome results from the absence of alignment issues, ensuring high data integrity and system performance.
To establish a baseline, remove the noise from the system by deleting the AWGN Channel block from the model. The Error Rate Calculation block then reports zero errors.
Observe Effects of Misalignment
In the model, remove the delay block. The demodulator input does not align along even numbers of symbols. Consequently, this misalignment leads to a significant increase in the error rate and the number of errors reported by the Error Rate Calculation block.
Conclusion
Managing delays and alignment ensures data integrity and system performance. By incorporating a delay block to compensate for the misalignment caused by the Raised Cosine Transmit and Receive Filter blocks, you can see that the model successfully aligns the symbol boundaries before the demodulation process and reduces the overall error rates.
Ports
Input
CPFSK-modulated baseband signal, specified as a scalar or column vector. The length of the input signal must be an integer multiple of the number of samples per symbol specified in the Samples per symbol parameter. For information on the processing rates, see Single-Rate Processing and Multirate Processing.
Data Types: double | single
Output
Demodulated output signal, returned as a scalar or column vector.
For more information, see Integer-Valued and Binary-Valued Output Signals and Traceback Depth and Output Delays.
Data Types: double | Boolean | int8 | int16 | int32
Parameters
To edit block parameters interactively, use the Property Inspector. From the Simulink® Toolstrip, on the Simulation tab, in the Prepare gallery, select Property Inspector.
Modulation order, specified as a power-of-two scalar. The modulation order M = 2k specifies the number of points in the symbol alphabet. k is a positive integer indicating the number of bits per symbol.
Integer or group of bits output indicator, specified as
Integer or Bit.
Set this parameter to
Integerto output data as integers.Set this parameter to
Bitto output data as bits.
For more information, see Integer-Valued and Binary-Valued Output Signals.
Symbol mapping, specified as Binary or
Gray. This parameter determines how each
integer maps to a group of output bits.
Set this parameter to
Binaryto map symbols using binary-coded ordering.Set this parameter to
Grayto map symbols using Gray-coded ordering.
For more information, see Integer-Valued and Binary-Valued Output Signals.
Dependencies
To enable this parameter, set Output
type to Bit.
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 property value is the initial phase offset of the modulated waveform.
Symbol sampling rate, specified as a positive integer. This parameter specifies the output symbol upsampling factor for each input sample.
For more information, see Signal Upsampling and Rate Changes.
Block processing rate, specified as one of these options:
Enforce single-rate processing— The input and output signals have the same port sample time. The block implements the rate change by making a size change at the output when compared to the input. The output width is the number of symbols (which is given by dividing the input length by the Samples per symbol parameter value when the Output type parameter is set toInteger).Allow multirate processing— The input and output signals have different port sample times. The output period is the same as the symbol period and equals the product of the input period and the Samples per symbol parameter value.
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.
Output data type, specified as double,
boolean, int8,
int16, or int32.
When you set the Output type parameter to
false, you can set the output to double-precision or signed-integer data types.When you set the Output type parameter to
true, you can set the output to double-precision, signed-integer, or logical data types.
Block Characteristics
Data Types |
|
Multidimensional Signals |
|
Variable-Size Signals |
|
More About
When you set the Output type parameter to
Integer:
The block outputs an integer column vector of length equal to N/NSPS. The output values are odd integers in the range [–(M–1), (M–1)].
You cannot set the Output datatype parameter to
boolean.
When you set the Output type parameter to
Bit:
The block outputs a binary column vector of length equal to k×(N/NSPS).
In bit output mode, the block follows this process:
Map each demodulated symbol to an odd integer L in the range [–(M–1), (M–1)].
Map L to the nonnegative integer (L + M–1)/2.
Map each nonnegative integer to a k-length binary word using binary-coded ordering or Gray-coded ordering, as specified by the Symbol set ordering parameter.
You can set the Output datatype parameter to only
double,boolean,int8,in16, orint32.
N is the number of input baseband modulated symbols in the input signal (specifically, the length of the input signal). NSPS represents the value of the Samples per symbol parameter. M represents the value of the M-ary number parameter. k = log2(M) and k is the number of bits per symbol.
In single-rate processing mode, the input and output signals have the same port sample time. The block implicitly implements the rate change by making a size change at the output when compared to the input. The input width must be an integer multiple of the Samples per symbol parameter value, and the input can be a column vector.
When you set Output type to
Bit, the output width is k times the number of input symbols.When you set Output type to
Integer, the output width is the number of input symbols.
In multirate processing mode, the input and output signals have different port sample times. The input must be a scalar. The output symbol time is the product of the input sample time and the Samples per symbol parameter value.
When you set Output type to
Bit, the output width equals the number of bits per symbol.When you set Output type to
Integer, the output is a scalar.
The traceback depth, D, is the number of trellis branches used to construct each traceback path in the trellis description of the modulation scheme for demodulation using the Viterbi algorithm.
Determine the optimal setting for traceback depth by calculating the minimum squared Euclidean distance. Alternatively, you can use a common heuristic based on the number of states. Specifically, the five-times-the-constraint-length rule, which approximates the traceback depth as D=5log2(numStates).
For a binary raised cosine pulse shape with a pulse length of 3 and h=2/3, applying this rule D=5log2(3×22) ~ 18 gives a result that is close to the optimum value of 20.
The Viterbi algorithm processing results in a delay preceding the first meaningful demodulated value in the output.
The traceback depth equals the value of the Traceback depth parameter. The length of the delay vector is:
(D+1) zero-value symbols, when the Rate options parameter is set to
Allow multirate processingand the model uses a variable-step solver or a fixed-step solver with the Tasking Mode parameter set toSingleTasking.D zero-value symbols, when the Rate options parameter is set to
Enforce single-rate processing.
Algorithms
CPFSK demodulation processing consists of a correlator followed by a maximum-likelihood sequence estimation (MLSE) detector that searches the paths through the state trellis for the minimum Euclidean distance path. When the modulation index is rational (h = m / p), a finite number of phase states exist in the symbol. The implementation uses the Viterbi algorithm to perform MLSE detection. The input to the demodulator is a baseband representation of the modulated signal.
The CPFSK demodulation implementation follows these steps to recover the original digital data from the modulated signal:
Apply a rectangular pulse-shaping filter to the input baseband signal to remove out-of-band noise and interference.
Use a quadrature demodulator to extract the in-phase (I) and quadrature (Q) components of the signal.
To improve tracking accuracy as the phase of the input signal changes over time, unwrap the phase to ensure continuity. For CPFSK, the phase shift per symbol is π × h, where h is the modulation index.
Compute the instantaneous phase of the signal using the arctangent function:
.
Differentiate the unwrapped phase to obtain the instantaneous frequency of the signal and extract the frequency deviation from the carrier frequency:
.
Symbol detection compares the instantaneous frequency to predefined frequency thresholds corresponding to different symbols in the M-ary symbol alphabet. Use a decision rule (e.g., maximum likelihood) to map the frequency deviations to the nearest symbol. When the modulation index is rational (h = m / p), a finite number of phase states exist in the symbol. The implementation uses the Viterbi algorithm to perform MLSE detection.
Bit recovery decodes the detected symbols into data symbols based on the modulation scheme and symbol mapping used.
Output the recovered data stream as bits or integers as specified by the configuration.
In your CPFSK modulated communications link, apply symbol synchronization to ensure that the sampling of the signal is synchronized with the symbol rate to prevent inter-symbol interference.
CPFSK modulation is a specific form of continuous phase modulation in which the pulse shaping filter, g(t), has a rectangular pulse of duration, LT=1.
Continuous phase modulation includes a convolutional encoder, a symbol mapper, and a modulator.
The output of the modulator is a baseband representation of the modulated signal:
where:
{αi} is a sequence of M-ary data symbols selected from the alphabet ±1, ±3, ±(M–1).
M must have the form 2k for some positive integer k, where M is the modulation order and specifies the size of the symbol alphabet.
{hi} is a sequence of modulation indices. hi moves cyclically through a set of indices {h0, h1, h2, ..., hH-1}.
When H=1, only one modulation index exists, h0, which is denoted as h. The phase shift over a symbol is π × h.
When hi varies from interval to interval, the modulator operates in multi-h. To ensure a finite number of phase states, hi must be a rational number.
The CPFSK modulation method uses pulse shaping to smooth the phase transitions of the modulated signal. The function q(t) is the phase response obtained from the frequency pulse g(t) through this relation:
.
The specified frequency pulse shape corresponds to this rectangular pulse shape expression for g(t).
L is the main lobe pulse duration in symbol intervals.
The duration of the pulse LT is the pulse length in symbol intervals. For CPFSK modulation, LT=1.
For more information on CPFSK modulation and pulse shape filtering, see [1].
References
[1] Anderson, John B., Tor Aulin, and Carl-Erik Sundberg. Digital Phase Modulation. New York: Plenum Press, 1986.
[2] Proakis, John G. Digital Communications. 5th ed. New York: McGraw Hill, 2007.
Extended Capabilities
C/C++ Code Generation
Generate C and C++ code using Simulink® Coder™.
Version History
Introduced before R2006a
See Also
Blocks
MATLAB Command
You clicked a link that corresponds to this MATLAB command:
Run the command by entering it in the MATLAB Command Window. Web browsers do not support MATLAB commands.
Select a Web Site
Choose a web site to get translated content where available and see local events and offers. Based on your location, we recommend that you select: .
You can also select a web site from the following list
How to Get Best Site Performance
Select the China site (in Chinese or English) for best site performance. Other MathWorks country sites are not optimized for visits from your location.
Americas
- América Latina (Español)
- Canada (English)
- United States (English)
Europe
- Belgium (English)
- Denmark (English)
- Deutschland (Deutsch)
- España (Español)
- Finland (English)
- France (Français)
- Ireland (English)
- Italia (Italiano)
- Luxembourg (English)
- Netherlands (English)
- Norway (English)
- Österreich (Deutsch)
- Portugal (English)
- Sweden (English)
- Switzerland
- United Kingdom (English)