Coarse Frequency Compensator
Compensate for carrier frequency offset in PAM, PSK, or QAM
Libraries:
Communications Toolbox /
RF Impairments Correction
Communications Toolbox /
Synchronization
Description
The Coarse Frequency Compensator block compensates for carrier frequency offset in QAM, 8PSK, BPSK, OQPSK, PAM, and QPSK modulation schemes.
Examples
Compensate Signal Frequency and Phase Offset in Simulink
Compensate for a frequency offset imposed on a noisy 8PSK channel by using the Coarse Frequency Compensator block.
The doc_coarsefreqcomp
model compares a frequency offset impaired signal to one that has coarse frequency compensation applied.
A spectrum analyzer plot shows the transmitted signal before and after applying coarse frequency compensation.
Estimated frequency offset is 1999.9694824.2 Hz.
Ports
Input
In — Input signal
column vector
Input signal, specified as a column vector.
Data Types: single
 double
Complex Number Support: Yes
Output
Out — Compensated output signal
complex column vector
Compensated output signal, returned as a complex column vector with the same dimensions and data type as the input In.
Data Types: single
 double
FreqEst — Estimate of frequency offset
scalar
Estimate of the frequency offset, returned as a scalar.
Dependencies
To add this port, select Estimated frequency offset output port.
Data Types: single
 double
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 type of input signal — Modulation type
QAM
(default)  8PSK
 BPSK
 OQPSK
 PAM
 QPSK
Modulation type, specified as QAM
,
8PSK
, BPSK
,
OQPSK
, PAM
, or
QPSK
.
Estimation algorithm — Algorithm used to estimate frequency offset
FFTbased
(default)  Correlationbased
Specify the frequency offset estimation algorithm as
FFTbased
or
Correlationbased
.
The table shows the allowable combinations of the modulation type and the estimation algorithm.
Modulation  FFTBased Algorithm  CorrelationBased Algorithm 

8PSK , BPSK ,
PAM , QPSK  ✓  ✓ 
OQPSK , QAM  ✓  — 
For more information, see Algorithms.
Dependencies
This parameter appears when you set Modulation type of input signal to
8PSK
, BPSK
,
PAM
, or
QPSK
.
Frequency resolution (Hz) — Frequency resolution
100
(default)  positive scalar
Frequency resolution in Hz, specified as a positive real scalar.
Dependencies
This parameter applies when you set Estimation algorithm to
FFTbased
.
Samples per symbol — Number of samples per symbol
4
(default)  even integer greater than or equal to 4
Number of samples per symbol, specified as an even integer scalar greater than or equal to 4.
Dependencies
This parameter appears when you set Modulation type of input signal to
OQPSK
.
Maximum frequency offset (Hz) — Maximum measurable frequency offset
5e3
(default)  positive scalar
Maximum measurable frequency offset in Hz, specified as a positive scalar.
Dependencies
This parameter appears when you set Estimation algorithm to
Correlationbased
.
Estimated frequency offset output port — Option to add estimated frequency offset output port
on
(default)  off
Select this check box to add the FreqEst output port. The FreqEst port outputs the estimated frequency offset in Hz.
Simulate using — Type of simulation to run
Code generation
(default)  Interpreted execution
Type of simulation to run, specified as Code generation
or
Interpreted execution
.
Code generation
— Simulate the model by using generated C code. The first time you run a simulation, Simulink generates C code for the block. The model reuses the C code for subsequent simulations unless the model changes. This option requires additional startup time, but the speed of the subsequent simulations is faster than with theInterpreted execution
option.Interpreted execution
— Simulate the model by using the MATLAB^{®} interpreter. This option shortens startup time, but the speed of subsequent simulations is slower than with theCode generation
option. In this mode, you can debug the source code of the block.
For more information, see Simulation Modes (Simulink).
Block Characteristics
Data Types 

Multidimensional Signals 

VariableSize Signals 

Algorithms
CorrelationBased Estimation
Reference [ 1 ] describes the correlationbased estimation algorithm used to estimate the
frequency offset for PSK and PAM signals. To determine the frequency offset,
Δf, the algorithm performs a maximum likelihood (ML) estimation
of the complexvalued oscillation exp
(j2πΔft). The
observed signal, r_{k}, is represented as
$${r}_{k}={e}^{j\left(2\pi \Delta fk{\text{T}}_{s}+\theta \right)},\text{\hspace{0.17em}}1\le k\le N$$
T_{s} is the sampling interval, θ is an unknown random phase, and N is the number of samples. The ML estimation of the frequency offset is equivalent to seeking the maximum of the likelihood function,
$$\Lambda (\Delta f)\approx {\left{\displaystyle \sum _{i=1}^{N}{r}_{i}{e}^{j2\pi \Delta fi{T}_{s}}}\right}^{2}={\displaystyle \sum _{k=1}^{N}{\displaystyle \sum _{m=1}^{N}{r}_{k}{r}_{m}^{*}{e}^{j2\pi \Delta f{T}_{s}(km)}}}$$
After simplifying, the problem is expressed as a discrete Fourier transform, weighted by a parabolic windowing function. It is expressed as
$$\mathrm{Im}\left\{{\displaystyle \sum _{k=1}^{N1}k(Nk)R(k){e}^{j2\pi \Delta \widehat{f}{T}_{s}}}\right\}=0$$
R(k) denotes the estimated autocorrelation of the sequence r_{k} and is represented as
$$R(k)\triangleq \frac{1}{Nk}{\displaystyle \sum _{i=k+1}^{N}{r}_{i}\text{\hspace{0.17em}}{r}_{ik}^{*}},\text{\hspace{0.17em}}0\le k\le N1$$
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 r_{k} 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 L ≤ N – 1. The result is a modified ML estimation strategy in which
$$\mathrm{Im}\left\{{\displaystyle \sum _{k=1}^{L}R(k){e}^{j2\pi \Delta \widehat{f}k{T}_{s}}}\right\}=0$$
This equation results in an estimate of $$\Delta \widehat{f}$$ in which
$$\Delta \widehat{f}\cong \frac{{f}_{samp}}{\pi (L+1)}\mathrm{arg}\left\{{\displaystyle \sum _{k=1}^{L}R(k)}\right\}$$
The sampling frequency, f_{samp}, is the reciprocal of T_{s}. The number of elements used to compute the autocorrelation sequence, L, are determined as
$$L=\mathrm{round}\left(\frac{{f}_{samp}}{{f}_{max}}\right)1$$
f_{max} 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 f_{max} ≤
f_{samp} /
(4M).
FFTBased Estimation
FFTbased estimation algorithms can be used to estimate the frequency offset for various modulation types. The coarse frequency compensator implementation supports these modulation methods by using the algorithm noted.
For
BPSK
,QPSK
,8PSK
,PAM
, orQAM
modulation, the coarse frequency compensator uses the FFTbased algorithm described in [ 2 ]. The algorithm estimates $$\Delta \widehat{f}$$ by using a periodogram of the m^{th} power of the received signal and is given as$$\Delta \widehat{f}=\frac{{f}_{samp}}{N\cdot m}\mathrm{arg}\underset{f}{\mathrm{max}}\left{\displaystyle \sum _{k=0}^{N1}{r}^{m}(k){e}^{j2\pi kt/N}}\right,\text{\hspace{1em}}\left(\frac{{R}_{sym}}{2}\le f\le \frac{{R}_{sym}}{2}\right)$$
where m is the modulation order, r(k) is the received sequence, R_{sym} 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 [–R_{sym} / 2, R_{sym} / 2]. Because the form of the algorithm is the definition of the discrete Fourier transform of r^{m}(t), searching for a frequency that maximizes the time average is equivalent to searching for a peak line in the spectrum of r^{m}(t). The number of points required by the FFT is
$$N={2}^{\lceil {\mathrm{log}}_{2}\left(\frac{{f}_{samp}}{{f}_{r}}\right)\rceil}$$
where f_{r} is the desired frequency resolution.
For OQPSK modulation, the coarse frequency compensator uses the FFTbased algorithm 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.
References
[1] Luise, M., and R. Reggiannini. “Carrier Frequency Recovery in AllDigital Modems for BurstMode Transmissions.” IEEE^{®} Transactions on Communications, Vol. 43, No. 2/3/4, Feb. 1995, pp. 1169–1178.
[2] Wang, Y., et al. “NonDataAided Feedforward Carrier Frequency Offset Estimators for QAM Constellations: A Nonlinear LeastSquares Approach.” EURASIP Journal on Advances in Signal Processing, Vol. 2004, No. 13, Dec. 2004, p. 856139. https://doi.org/10.1155/S1110865704403175.
[3] Nakagawa, Tadao, et al. “NonDataAided WideRange Frequency Offset Estimator for QAM Optical Coherent Receivers.” Optical Fiber Communication Conference/National Fiber Optic Engineers Conference 2011, OSA, 2011, paper OMJ1. https://doi.org/10.1364/OFC.2011.OMJ1.
[4] Olds, Jonathan. Designing an OQPSK demodulator.
Extended Capabilities
C/C++ Code Generation
Generate C and C++ code using Simulink® Coder™.
Version History
Introduced in R2015bR2023b: Default settings change
The Coarse Frequency Compensator block parameters have new default values.
Parameter  New Default  Previous Default 

Frequency resolution (Hz)  100  0.001 
Maximum frequency offset (Hz)  5e3  0.05 
When executing code created in a previous release, confirm the coarse frequency compensator settings. The new default settings change your results. To produce results using the previous default settings, you can manually update the settings of your block.
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)