Main Content


Compensate for frequency offset for PAM, PSK, or QAM


The CoarseFrequencyCompensator System object™ compensates for the frequency offset of received signals.

To compensate for the frequency offset of a PAM, PSK, or QAM signal:

  1. Define and set up your coarse frequency compensator object. See Construction.

  2. Call step to compensate for the frequency offset of a PAM, PSK, or QAM signal according to the properties of comm.CoarseFrequencyCompensator. The behavior of step is specific to each object in the toolbox.


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.


CFC = comm.CoarseFrequencyCompensator creates a coarse frequency offset compensator object, CFC. This object uses an open-loop technique to estimate and compensate for the carrier frequency offset in a received signal.

CFC = comm.CoarseFrequencyCompensator(Name,Value) creates a coarse frequency offset compensator object, CFC, with the 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 signal modulation type as BPSK, QPSK, OQPSK, 8PSK, PAM, or QAM. The default is QAM. This property is nontunable.


Algorithm used to estimate frequency offset

Specify the estimation algorithm as one of FFT-based or Correlation-based. The default is FFT-based. This property is nontunable.

The table shows the allowable combinations of the modulation type and the estimation algorithm.

ModulationFFT-Based AlgorithmCorrelation-Based Algorithm

Use the correlation-based algorithm for HDL implementations and for other situations in which you want to avoid using an FFT.

This property appears when Modulation is 'BPSK', 'QPSK', '8PSK', or 'PAM'.


Frequency resolution (Hz)

Specify the frequency resolution for the offset frequency estimation as a positive, real scalar of data type double. This property establishes the FFT length used to perform spectral analysis and must be less than the sample rate. The default is 0.001. This property is nontunable.


Maximum measurable frequency offset (Hz)

Specify the maximum measurable frequency offset as a positive, real scalar of data type double.

The value of this property must be less than fsamp / M, where fsamp is the sample rate and M is the modulation order. As a best practice, set MaximumOffset to less than r / (4M). This property applies only if Algorithm is Correlation-based. The default is 0.05. This property is nontunable.


Sample rate (Hz)

Specify the sample rate in samples per second as a positive, real scalar of data type double. The default is 1. This property is nontunable.


Samples per symbol

Specify the number of samples per symbol, s, as a real positive finite integer scalar, such that s ≥ 2. The default value is 4. This property is nontunable.

This property appears when Modulation is 'OQPSK'.


infoCharacteristic information about coarse frequency compensator
stepCompensate for frequency offset
Common to All System Objects

Allow System object property value changes


Reset internal states of System object


collapse all

Compensate for a 4 kHz frequency offset imposed on a noisy QPSK signal.

Set the example parameters.

nSym = 2048;       % Number of input symbols
sps = 4;           % Samples per symbol
nSamp = nSym*sps;  % Number of samples
fs = 80000;        % Sampling frequency (Hz)

Create a square root raised cosine transmit filter.

txfilter = comm.RaisedCosineTransmitFilter(...
    'RolloffFactor',0.2, ...
    'FilterSpanInSymbols',8,   ...

Create a phase frequency offset object to introduce the 4 kHz frequency offset.

freqOffset = comm.PhaseFrequencyOffset(...
    'FrequencyOffset',-4000, ...

Create a coarse frequency compensator object to compensate for the offset.

freqComp = comm.CoarseFrequencyCompensator(...
    'Modulation','QPSK', ...
    'SampleRate',fs, ...

Generate QPSK symbols, filter the modulated data, pass the signal through an AWGN channel, and apply the frequency offset.

data = randi([0 3],nSym,1);
modData = pskmod(data,4,pi/4);
txSig = txfilter(modData);
rxSig = awgn(txSig,20,'measured');
offsetData = freqOffset(rxSig);

Compensate for the frequency offset using freqComp. When the frequency offset is high, it is beneficial to do coarse frequency compensation prior to receive filtering because filtering suppresses energy in the useful spectrum.

[compensatedData,estFreqOffset] = freqComp(offsetData);

Display the estimate of the frequency offset.

estFreqOffset =


Return information about the freqComp object. To obtain the FFT length, you must call freqComp prior to calling the info method.

freqCompInfo = info(freqComp)
freqCompInfo = 

  struct with fields:

    FFTLength: 131072
    Algorithm: 'FFT-based'

Create a spectrum analyzer object and plot the offset and compensated spectra. Verify that the compensated signal has a center frequency at 0 Hz and that the offset signal has a center frequency at -4 kHz.

specAnal = dsp.SpectrumAnalyzer('SampleRate',fs,'ShowLegend',true, ...
    'ChannelNames',{'Offset Signal' 'Compensated Signal'});
specAnal([offsetData compensatedData])

Correct for a phase and frequency offset in a noisy QAM signal using a carrier synchronizer. Then correct for the offsets using both a carrier synchronizer and a coarse frequency compensator.

Set the example parameters.

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

Create a QAM modulator and an AWGN channel.

channel = comm.AWGNChannel('EbNo',20,'BitsPerSymbol',k,'SamplesPerSymbol',sps);

Create a constellation diagram object to visualize the effects of the offset compensation techniques. Specify the constellation diagram to display only the last 4000 samples.

constdiagram = comm.ConstellationDiagram(...
    'ReferenceConstellation',qammod(0:M-1,M), ...
    'SamplesPerSymbol',sps, ...
    'SymbolsToDisplaySource','Property','SymbolsToDisplay',4000, ...
    'XLimits',[-5 5],'YLimits',[-5 5]);

Introduce a frequency offset of 400 Hz and a phase offset of 30 degrees.

phaseFreqOffset = comm.PhaseFrequencyOffset(...

Generate random data symbols and apply 16-QAM modulation.

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

Create a raised cosine filter object and filter the modulated signal.

txfilter = comm.RaisedCosineTransmitFilter('OutputSamplesPerSymbol',sps, ...
txSig = txfilter(modSig);

Apply the phase and frequency offset, and then pass the signal through the AWGN channel.

freqOffsetSig = phaseFreqOffset(txSig);
rxSig = channel(freqOffsetSig);

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

fineSync = comm.CarrierSynchronizer('DampingFactor',0.7, ...
    'NormalizedLoopBandwidth',0.005, ...
    'SamplesPerSymbol',sps, ...
rxData = fineSync(rxSig);

Display the constellation diagram of the last 4000 symbols.


Even with time to converge, the spiral nature of the plot shows that the carrier synchronizer has not yet compensated for the large frequency offset. The 400 Hz offset is 1% of the sample rate.

Repeat the process with a coarse frequency compensator inserted before the carrier synchronizer.

Create a coarse frequency compensator to reduce the frequency offset to a manageable level.

coarseSync = comm.CoarseFrequencyCompensator('Modulation','QAM','FrequencyResolution',1,'SampleRate',fs*sps);

Pass the received signal to the coarse frequency compensator and then to the carrier synchronizer.

syncCoarse = coarseSync(rxSig);
rxData = fineSync(syncCoarse);

Plot the constellation diagram of the signal after coarse and fine frequency compensation.


The received data now aligns with the reference constellation.



The correlation-based estimation algorithm, which can be used to estimate the frequency offset for PSK and PAM signals, is described in [1]. To determine the frequency offset, Δf, the algorithm performs a maximum likelihood (ML) estimation of the complex-valued oscillation exp(j2πΔft). The observed signal, rk, is represented as


where Ts is the sampling interval, θ is an unknown random phase, and N is the number of samples. The maximum likelihood estimation of the frequency offset is equivalent to seeking the maximum of the likelihood function, Λ(Δf),


After simplifying, the problem is expressed as a discrete Fourier transform, weighted by a parabolic windowing function. It is expressed as


where R(k) denotes the estimated autocorrelation of the sequence rk and is represented as


The term k(N–k) is the parabolic windowing function. In [1], it is shown that R(k) is a poor estimate of the autocorrelation of rk when k = 0 or when k is close to N. Consequently, the windowing function can be expressed as a rectangular sequence of 1s for k = 1, 2, ..., L, where LN – 1. The results is a modified ML estimation strategy in which


This results in an estimate of Δf^ in which


The sampling frequency, fsamp, is the reciprocal of Ts. The number of elements used to compute the autocorrelation sequence, L, are determined as


where fmax is the maximum expected frequency offset and round is the nearest integer function. The frequency offset estimate improves when L ≥ 7 and leads to the recommendation that fmaxfsamp / (4M).


FFT-based algorithms can be used to estimate the frequency offset for all modulation types. Two variations are used in comm.CoarseFrequencyCompensator.

  • For BPSK, QPSK, 8PSK, PAM, or QAM modulations the FFT-based algorithm used is described in [2]. The algorithm estimates Δf^ by using a periodogram of the mth power of the received signal and is given as


    where m is the modulation order, r(k) is the received sequence, Rsym is the symbol rate, and N is the number of samples. The algorithm searches for a frequency that maximizes the time average of the mth power of the received signal multiplied by various frequencies in the range of [–Rsym/2, Rsym/2]. As the form of the algorithm is the definition of the discrete Fourier transform of rm(t), searching for a frequency that maximizes the time average is equivalent to searching for a peak line in the spectrum of rm(t). The number of points required by the FFT is


    where fr is the desired frequency resolution.

  • For OQPSK modulation the FFT-based algorithm used is described in [4]. The algorithm searches for spectral peaks at +/- 200 kHz around the symbol rate. This technique locates desired peaks in the presence of interference from spectral content around baseband frequencies due to filtering.


[1] Luise, M. and R. Regiannini. “Carrier recovery in all-digital modems for burst-mode transmissions.” IEEE® Transactions on Communications. Vol. 43, No. 2, 3, 4, Feb/Mar/April, 1995, pp. 1169–1178.

[2] Wang, Y., K. Shi, and E. Serpedi. “Non-Data-Aided Feedforward Carrier Frequency Offset Estimators for QAM Constellations: A Nonlinear Least-Squares Approach.” EURASIP Journal on Applied Signal Processing. 2004:13, pp. 1993–2001.

[3] Nakagawa, T., M. Matsui, T. Kobayashi, K. Ishihara, R. Kudo, M. Mizoguchi, and Y. Miyamoto. “Non-Data-Aided Wide-Range Frequency Offset Estimator for QAM Optical Coherent Receivers.” Optical Fiber Communication Conference and Exposition (OFC/NFOEC), 2011 and the National Fiber Optic Engineers Conference. March 2011, pp. 1–3.

[4] Olds, Jonathan. "Designing an OQPSK demodulator".

Extended Capabilities

Introduced in R2015b