This is machine translation

Translated by Microsoft
Mouseover text to see original. Click the button below to return to the English version of the page.

Note: This page has been translated by MathWorks. Please click here
To view all translated materials including this page, select Japan from the country navigator on the bottom of this page.

comm.CarrierSynchronizer System object

Compensate for carrier frequency offset


The CarrierSynchronizer System object™ compensates for carrier frequency and phase offsets for single carrier modulation schemes.

To compensate for frequency and phase offsets:

  1. Define and set up the CarrierSynchronizer object. See Construction.

  2. Call step to compensate for the carrier frequency and phase offsets according to the properties of comm.CarrierSynchronizer. The behavior of step is specific to each object in the toolbox.

The algorithm inherent to the carrier synchronizer is compatible with BPSK, QPSK, OQPSK, 8-PSK, QAM, and PAM modulation schemes.


This object does not resolve phase ambiguities created by the synchronization algorithm. See QPSK Transmitter and Receiver for an example of how ambiguities are addressed.


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.


S = comm.CarrierSynchronizer creates a compensator System object, S, that compensates for the carrier frequency and phase offsets.

S = comm.CarrierSynchronizer(Name,Value) creates a compensator object with each specified property Name set to the specified Value. You can specify additional name-value pair arguments in any order as (Name1,Value1,...,NameN,ValueN).



Modulation type

Specify the modulation type as BPSK, QPSK, OQPSK, 8PSK, QAM, or PAM. The default value is QAM. This property is nontunable.

This object supports CPM. It has been tested for a CPM signal having 1 sample per symbol and a modulation index of 0.5.


Modulation phase offset method

Specify the method used to calculate the modulation phase offset as either Auto or Custom.

  • Auto applies the traditional offset for the specified modulation type.

    ModulationPhase Offset
    QPSK or OQPSKπ/4
    QAM or PAM0
  • Custom enables the CustomPhaseOffset property, which you can use to specify your own phase offset.

The default value is Auto. This property is tunable.


Phase offset

Specify the phase offset in radians as a real scalar. This property is available only when the ModulationPhaseOffset property is set to Custom. The default value is 0. This property is tunable.


Samples per symbol

Specify the number of samples per symbol as a positive integer scalar. The default value is 2. This property is tunable.


Damping factor of the loop

Specify the damping factor of the loop as a positive real finite scalar. The default value is 0.707. This property is tunable.


Normalized bandwidth of the loop

Specify the normalized loop bandwidth as a real scalar between 0 and 1. The loop bandwidth is normalized by the sample rate of the synchronizer. The default value is 0.01. This property is tunable.


infoCharacteristic information about carrier synchronizer
resetReset states of the carrier synchronizer object
stepCompensate for carrier frequency and phase offset
Common to All System Objects

Create System object with same property values


Expected number of inputs to a System object


Expected number of outputs of a System object


Check locked states of a System object (logical)


Allow System object property value changes


expand all

Correct phase and frequency offsets of a QPSK signal passed through an AWGN channel.

Create a phase and frequency offset System object™, where the frequency offset is 1% of the sample rate.

pfo = comm.PhaseFrequencyOffset(...

Create a carrier synchronizer object.

carrierSync = comm.CarrierSynchronizer( ...

Generate random data symbols and apply QPSK modulation.

data = randi([0 3],10000,1);
modSig = pskmod(data,4,pi/4);

Apply phase and frequency offsets using the pfo System object. Then, pass the offset signal through an AWGN channel.

modSigOffset = pfo(modSig);
rxSig = awgn(modSigOffset,15);

Display the scatter plot of the received signal. The data appear in a circle instead of being grouped around the reference constellation points due to the frequency offset.


Correct for the phase and frequency offset by using the carrier synchronizer object.

syncSignal = carrierSync(rxSig);

Display the first 1000 symbols of corrected signal. The synchronizer has not yet converged so the data is not grouped around the reference constellation points.


Display the last 1000 symbols of the corrected signal. The data is now aligned with the reference constellation because the synchronizer has converged to a solution.


Estimate the frequency offset introduced into a noisy 8-PSK signal using the carrier synchronizer System object™.

Set the example parameters.

M = 8;                  % Modulation order
fs = 1e6;               % Sample rate (Hz)
foffset = 1000;         % Frequency offset (Hz)
phaseoffset = 15;       % Phase offset (deg)
snrdb = 20;             % Signal-to-noise ratio (dB)

Create a phase frequency offset object to introduce offsets to a modulated signal.

pfo = comm.PhaseFrequencyOffset(...

Create a carrier synchronizer object to correct for the phase and frequency offsets. Set the Modulation property to 8PSK.

carrierSync = comm.CarrierSynchronizer('Modulation','8PSK');

Generate random data and apply 8-PSK modulation.

data = randi([0 M-1],5000,1);
modData = pskmod(data,M,pi/M);

Introduce offsets to the signal and add white noise.

rxSig = awgn(pfo(modData),snrdb);

Use the carrier synchronizer to estimate the phase offset of the received signal.

[~,phError] = carrierSync(rxSig);

Determine the frequency offset by using the diff function to compute an approximate derivative of the phase error. The derivative must be scaled by because the phase error is measured in radians.

estFreqOffset = diff(phError)*fs/(2*pi);

Plot the running mean of the estimated frequency offset. After the synchronizer converges to a solution, the mean value of the estimate is approximately equal to the input value of 1000 Hz.

rmean = cumsum(estFreqOffset)./(1:length(estFreqOffset))';
ylabel('Estimated Frequency Offset (Hz)')

Correct phase and frequency offsets for a QAM signal in an AWGN channel. Coarse frequency estimator and carrier synchronizer System objects™ are used to compensate for a significant offset.

Set the example parameters.

fs = 10000;           % Sample rate (Hz)
sps = 4;              % Samples per symbol
M = 16;               % Modulation order
k = log2(M);          % Bits per symbol

Create an AWGN channel System object™.

awgnChannel = comm.AWGNChannel('EbNo',15,'BitsPerSymbol',k,'SamplesPerSymbol',sps);

Create a pulse shaping filter

txFilter = comm.RaisedCosineTransmitFilter(...
rxFilter = comm.RaisedCosineReceiveFilter(...
    'InputSamplesPerSymbol',sps, ...
    'DecimationFactor', sps);

Create a constellation diagram object to visualize the effects of the carrier synchronization.

constDiagram = comm.ConstellationDiagram(...
    'ReferenceConstellation',qammod(0:M-1,M), ...
    'XLimits',[-5 5],'YLimits',[-5 5]);

Create a QAM coarse frequency estimator to roughly estimate the frequency offset. This is used to reduce the frequency offset of the signal passed to the carrier synchronizer. In this case, a frequency estimate to within 10 Hz is sufficient.

coarse = comm.QAMCoarseFrequencyEstimator('SampleRate',fs, ...

Create a carrier synchronizer System object. Because of the coarse frequency correction, the carrier synchronizer will converge quickly even though the normalized bandwidth is set to a low value. Lower normalized bandwidth values enable better correction.

fine = comm.CarrierSynchronizer( ...
    'DampingFactor',0.7, ...
    'NormalizedLoopBandwidth',0.005, ...

Create phase and frequency offset objects. pfo is used to introduce a phase and frequency offset of 30 degrees and 250 Hz, respectively. pfc is used to correct the offset in the received signal by using the output of the coarse frequency estimator.

pfo = comm.PhaseFrequencyOffset(...

pfc = comm.PhaseFrequencyOffset('FrequencyOffsetSource','Input port', ...

Generate random data symbols and apply 16-QAM modulation.

data = randi([0 M-1],10000,1);
txSig = txFilter(qammod(data,M));

Pass the signal through an AWGN channel and apply a phase and frequency offset.

rxSig = awgnChannel(pfo(txSig));

Estimate the frequency offset and compensate for it using PFC. Plot the constellation diagram of the output, syncCoarse. From the spiral nature of the diagram, you can see that the phase and frequency offsets are not corrected.

freqEst = coarse(rxSig);
syncCoarse = pfc(rxSig,-freqEst);

Apply fine frequency correction to the signal by using the carrier synchronizer object.

rxData = rxFilter(fine(syncCoarse));

Display the constellation diagram of the last 1000 symbols. You can see that these symbols are aligned with the reference constellation because the carrier synchronizer has converged to a solution.


This example shows how to model channel impairments such as timing phase offset, carrier frequency offset, and carrier phase offset for a minimum shift keying (MSK) signal. The example also shows the use of System objects™ to synchronize such signals at the receiver.


This example models an MSK transmitted signal undergoing channel impairments such as timing, frequency, and phase offset as well as AWGN noise. An MSK timing synchronizer recovers the timing offset, while a carrier synchronizer recovers the carrier frequency and phase offsets.

Initialize system variables by using the MATLAB script configureMSKSignalRecoveryEx. Define logical control variables to enable timing phase and carrier frequency and phase recovery.

recoverTimingPhase = true;
recoverCarrier = true;

Modeling Channel Impairments

Specify the sample delay, timingOffset , that the channel model applies, and create a variable fractional delay object to introduce the timing delay to the transmitted signal.

timingOffset = 0.2;
varDelay = dsp.VariableFractionalDelay;

Introduce carrier phase and frequency offsets by creating a phase and frequency offset object, PFO. Because the MSK modulator upsamples the transmitted symbols, set the SampleRate property appropriately.

freqOffset = 50;
phaseOffset = 30;
pfo = comm.PhaseFrequencyOffset(...
    'FrequencyOffset', freqOffset, ...
    'PhaseOffset', phaseOffset, ...
    'SampleRate', samplesPerSymbol/Ts);

Create an AWGN channel to add additive white Gaussian noise to the modulated signal. The noise power is determined by the bit energy to noise power spectral density ratio EbNo property. Because the MSK modulator generates symbols with 1 Watt of power, the signal power property of the AWGN channel is also set to 1.

EbNo = 20 + 10*log10(samplesPerSymbol);
chAWGN = comm.AWGNChannel(...
    'NoiseMethod', 'Signal to noise ratio (Eb/No)', ...
    'EbNo', EbNo,...
    'SignalPower', 1, ...
    'SamplesPerSymbol', samplesPerSymbol);

Timing Phase, Carrier Frequency, and Carrier Phase Synchronization

Construct an MSK timing synchronizer to recover symbol timing phase using a fourth-order nonlinearity method.

timeSync = comm.MSKTimingSynchronizer(...
    'SamplesPerSymbol', samplesPerSymbol, ...
    'ErrorUpdateGain', 0.02);

Construct a carrier syncrhonizer to recover both carrier frequency and phase. Set the modulation to QPSK, because the MSK constellation is QPSK with a 0 degree phase offset.

phaseSync = comm.CarrierSynchronizer(...
    'Modulation', 'QPSK', ...
    'ModulationPhaseOffset', 'Custom', ...
    'CustomPhaseOffset', 0, ...
    'SamplesPerSymbol', 1);

Stream Processing Loop

The system modulates data using MSK modulation. The modulated symbols pass through the channel model, which applies timing delay, carrier frequency and phase shift, and additive white Gaussian noise. In this system, the receiver performs timing phase, and carrier frequency and phase recovery. Finally, the system demodulates the symbols and calculates the bit error rate using an error rate calculator object. The plotResultsMSKSignalRecoveryEx script generates scatter plots to show these effects:

  1. Channel impairments

  2. Timing synchronization

  3. Carrier synchronization

At the end of the simulation, the example displays the timing phase, frequency, and phase estimates as a function of simulation time.

for p = 1:numFrames
  % Generate and modulate data
  txBits = randi([0 1],samplesPerFrame,1);
  txSym = modem(txBits);
  % Transmit through channel
  % Add timing offset
  rxSigTimingOff = varDelay(txSym,timingOffset*samplesPerSymbol);
  % Add carrier frequency and phase offset
  rxSigCFO = pfo(rxSigTimingOff);
  % Pass the signal through an AWGN channel
  rxSig = chAWGN(rxSigCFO);
  % Save the transmitted signal for plotting
  plot_rx = rxSig;
  % Timing recovery
  if recoverTimingPhase
    % Recover symbol timing phase using fourth-order nonlinearity method
    [rxSym,timEst] = timeSync(rxSig);
    % Calculate the timing delay estimate for each sample
    timEst = timEst(1)/samplesPerSymbol;
    % Do not apply timing recovery and simply downsample the received signal
    rxSym = downsample(rxSig,samplesPerSymbol);
    timEst = 0;
  % Save the timing synchronized received signal for plotting
  plot_rxTimeSync = rxSym;
  % Carrier frequency and phase recovery
  if recoverCarrier
    % The following script applies carrier frequency and phase recovery
    % using a second order PLL, and remove phase ambiguity
    [rxSym,phEst] = phaseSync(rxSym);
    freqShiftEst = mean(diff(phEst)/(Ts*2*pi));
    phEst = mod(mean(phEst),360); % in degrees
    freqShiftEst = 0;
    phEst = 0;

  % Save the phase synchronized received signal for plotting
  plot_rxPhSync = rxSym;
  % Demodulate the received symbols
  rxBits = demod(rxSym);
  % Calculate the bit error rate
  errorStats = BERCalc(txBits,rxBits);
  % Plot results

Display the bit error rate, BitErrorRate , as well as the total number of symbols, NumberOfSymbols , processed by the error rate calculator.

ber = errorStats(1)
ber = 4.0001e-06
numSym = errorStats(3)
numSym = 499982

Conclusion and Further Experimentation

The recovery algorithms are demonstrated by using constellation plots taken after timing, carrier frequency, and carrier phase synchronization.

Click on the Open This Example button to create a writable copy of this example and its supporting files. Then, to show the effects of the recovery algorithms, you can enable and disable the control variables recoverTimingPhase and recoverCarrier and rerun the simulation.


This example uses these scripts:

  • configureMSKSignalRecoveryEx

  • plotResultsMSKSignalRecoveryEx

  • removePhaseAmbiguityMSKSignalRecoveryEx


The CarrierSynchronizer is a closed-loop compensator that uses the PLL-based algorithm described in [1]. The output of the synchronizer, yn, is a frequency shifted version of the complex input signal, xn. The synchronizer output is


where λn is the output of the direct digital synthesizer, DDS. The DDS is the discrete-time version of a voltage-controlled oscillator and is a core component of discrete-time phase locked loops. In the context of this System object, the DDS can be thought of as an integration filter.

To correct for the frequency offset, first the algorithm determines the phase error, en, for the nth symbol. The value of the phase error depends on the modulation scheme.

ModulationPhase Error
QAM or QPSK [1]

en = sgn(Re(xn)) ✕ Im(xn) - sgn(Im(xn) )✕ Re(xn)

BPSK or PAM [1]

en = sgn(Re(xn)) ✕ Im(xn)

8-PSK [2]en={(21)sgn(Re{xn})×Im{xn}sgn(Im{xn})×Re{xn};Re{xn}Im{xn}sgn(Re{xn})×Im{xn}(21)sgn(Im{xn})×Re{xn};Re{xn}<Im{xn}

en = sgn(Re(xn-SamplesPerSymbol/2)) ✕ Im(xn-SamplesPerSymbol/2) - sgn(Im(xn) )✕ Re(xn)

To ensure system stability, the phase error passes through a biquadratic loop filter governed by


where ψn is the output of the loop filter at sample n, and gI is the integrator gain. The integrator gain is determined from the expression


where θ, d, K0, and KP are determined from the System object properties. Specifically,


where Bn is the normalized loop bandwidth and ζ is the damping factor. The phase recovery gain, K0, is equal to the number of samples per symbol. The phase error detector gain, KP, is determined by the modulation type.


The output of the loop filter then passes to the DDS. The DDS is implemented as another biquadratic filter whose expression is based on the forward Euler integration rule such that


where gP is the proportional gain that is expressed as


The info method of the System object returns estimates of the normalized pull-in range, the maximum frequency lock delay, and the maximum phase lock delay. The normalized pull-in range, (Δf)pull-in, expressed in radians, is calculated as


The expression for (Δf)pull-in becomes less accurate as 2π2ζBn approaches 1.

The maximum frequency and phase lock delays, TFL and TPL, expressed in samples, are given by


Selected Bibliography

[1] Rice, Michael. Digital Communications: A Discrete-Time Approach. Upper Saddle River, NJ: Prentice Hall, 2009, pp. 359–393.

[2] Huang, Zhijie, Zhiqiang Yi, Ming Zhang, and Kuang Wang. “8PSK Demodulation for New Generation DVB-S2.” International Conference on Communications, Circuits and Systems, 2004. ICCCAS 2004. Vol. 2, 2004, pp. 1447–1450.

Extended Capabilities

Introduced in R2015a

Was this topic helpful?