Algorithm Search⌘K

Algorithmadvanced

Luise and Reggiannini frequency estimator

Also called L and R frequency estimator.

Estimates the carrier frequency from the angle of a sum of L sample autocorrelations. With L near N/2 it stays close to the CRB down to low SNR; its range |nu| < 1/(L+1) shrinks as L grows.

Time
O(N L) worst
Space
O(1) extra
Where
L = the number of autocorrelation lags; N = the number of samples
Properties
data aideddeterministicfeedforward
Origin
Marco Luise, Ruggero Reggiannini, 1995

The Luise and Reggiannini (L and R) estimator finds a carrier frequency offset from NN samples whose data are known or have been removed. It computes the sample autocorrelations R(m)R(m) at the lags m=1,…,Lm = 1, \ldots, L, adds them, and divides the angle of the sum by π(L+1)\pi(L+1). The sum of the noise-free terms ej2πνme^{j2\pi\nu m} has the exact angle πν(L+1)\pi\nu(L+1) for ∣ν∣<1L+1|\nu| < \frac{1}{L+1}, so the parameter LL trades the range against the noise: with LL near N/2N/2, the variance stays close to the Cramer-Rao bound down to low SNR, which in synchronization with known data is the modified Cramer-Rao bound. It belongs to the estimators for frequency offset estimation. The Kay estimator uses only lag 1, so it has the full range but a higher threshold, and the Rife and Boorstyn estimator is the ML periodogram peak with the full range and the lowest threshold, at the cost of an FFT and a search. In OFDM, the Moose and Schmidl and Cox estimators use the same idea at one long lag between repeated symbols.

In plain words

A tone turns by a fixed angle per sample. Comparing each sample with the sample one step earlier shows that angle, but noisily. Comparing with the sample two steps earlier shows twice the angle, three steps earlier three times, and so on. The receiver averages all these comparisons up to some number of steps and reads one angle from the total. Using many steps averages more noise away, but if the tone turns too fast, the comparisons over many steps go more than half a turn round and the answer is wrong. So the number of steps sets both the accuracy and the largest offset that can be measured.

The problem

The input is zk=Aej(2πνk+ϕ)+wkz_k = A e^{j(2\pi\nu k + \phi)} + w_k, k=0,…,N−1k = 0, \ldots, N - 1, where ν\nu is the frequency offset in cycles per symbol, AA and ϕ\phi are unknown, and wk∼CN(0,N0)w_k \sim \mathcal{CN}(0, N_0) is white, SNR=A2/N0\mathrm{SNR} = A^2/N_0. In a burst modem, zk=rkck‾z_k = r_k \overline{c_k} for the received samples rkr_k and the known preamble symbols ckc_k of unit modulus. Choose 1≤L≤N−11 \le L \le N - 1 and output ν^\hat\nu.

The algorithm

  1. L-AND-R(z[0..N-1], L)
  2. 1N <- length of z
  3. 2S <- 0
  4. 3for m <- 1 to L do
  5. 4S <- S + (1 / (N - m)) * sum over k = m..N-1 of z[k] * conj(z[k - m]) ▷ R(m)
  6. 5return arg(S) / (pi * (L + 1))

Line L4 is the unbiased sample autocorrelation at lag mm. Line L5 divides by π(L+1)\pi(L+1), not by 2π2\pi, because the angle of the sum of the lags 11 to LL is the mean lag L+12\frac{L+1}{2} times 2πν2\pi\nu. The result is in cycles per symbol; multiply by 2π2\pi for radians per symbol, or divide by the symbol period for hertz.

Example

N=8N = 8, ν=0.05\nu = 0.05, ϕ=0.3\phi = 0.3, SNR=10\mathrm{SNR} = 10 dB (noise seed 10), L=4L = 4, so the range is ∣ν∣<0.2|\nu| < 0.2. Line L4 gives:

mm R(m)R(m) noise-free ej2πνme^{j2\pi\nu m}
1 0.8789+0.2741j0.8789 + 0.2741j 0.9511+0.3090j0.9511 + 0.3090j
2 0.7186+0.5334j0.7186 + 0.5334j 0.8090+0.5878j0.8090 + 0.5878j
3 0.4279+0.7508j0.4279 + 0.7508j 0.5878+0.8090j0.5878 + 0.8090j
4 0.1800+0.8422j0.1800 + 0.8422j 0.3090+0.9511j0.3090 + 0.9511j

S=2.2054+2.4006jS = 2.2054 + 2.4006j, with arg⁡S=0.8278\arg S = 0.8278. Line L5 gives ν^=0.8278/(5π)=0.05270\hat\nu = 0.8278/(5\pi) = 0.05270, an error of 0.00270.0027. The bound for N=8N = 8 at 10 dB is a standard deviation of 0.00550.0055 cycles.

With N=32N = 32, 300 random offsets per point, ν\nu uniform in [−0.02,0.02][-0.02, 0.02] (seed 3), the mean square error over the CRB 6(2π)2 SNR N(N2−1)\frac{6}{(2\pi)^2\,\mathrm{SNR}\,N(N^2-1)} was (measurements):

LL range −3-3 dB 0 dB 3 dB 5 dB 10 dB
4 0.20.2 12.212.2 5.945.94 3.763.76 3.063.06 2.302.30
8 0.1110.111 3.353.35 2.072.07 1.641.64 1.501.50 1.361.36
16 0.05880.0588 1.361.36 1.201.20 1.141.14 1.121.12 1.091.09
24 0.040.04 1.381.38 1.241.24 1.181.18 1.171.17 1.151.15

L=N/2=16L = N/2 = 16 is within about 20 percent of the bound down to 0 dB and within 36 percent at −3-3 dB, and a larger LL does not help. A small LL widens the range but costs accuracy at every SNR.

Correctness

Claim. Each R(m)R(m) is an unbiased estimate of A2ej2πνmA^2 e^{j2\pi\nu m}. Without noise, ν^=ν\hat\nu = \nu exactly for ∣ν∣<1L+1|\nu| < \frac{1}{L+1} (theorem). Outside the range the estimate aliases: for 1L+1<ν<1L\frac{1}{L+1} < \nu < \frac1L it returns ν−2L+1\nu - \frac{2}{L+1} (theorem). That the variance is close to the CRB for L≈N/2L \approx N/2 is a closed form under assumptions in the original paper and a measurement here.

Key steps. ∑m=1Lej2πνm=ejπν(L+1)sin⁡(πνL)sin⁡(πν)\sum_{m=1}^{L} e^{j2\pi\nu m} = e^{j\pi\nu(L+1)}\frac{\sin(\pi\nu L)}{\sin(\pi\nu)}. For ∣ν∣<1L+1|\nu| < \frac{1}{L+1} the real factor is positive and ∣πν(L+1)∣<π|\pi\nu(L+1)| < \pi, so the angle of the sum is exactly πν(L+1)\pi\nu(L+1). Beyond the range, the angle wraps or the real factor turns negative, which the proof works out.

Proof: Without noise the L and R estimate equals nu for |nu| < 1/(L+1), each R(m) is unbiased for a tone in white noise, and outside the range the estimate aliases in a known wayfull

The input is zk=Aej(2πνk+ϕ)+wkz_k = A e^{j(2\pi\nu k + \phi)} + w_k, k=0,…,N−1k = 0, \ldots, N - 1, with A>0A > 0, wkw_k independent with mean zero and variance N0N_0, and an integer 1≤L≤N−11 \le L \le N - 1. Line L4 adds the sample autocorrelations R(m)=1N−m∑k=mN−1zkzk−m‾R(m) = \frac{1}{N - m}\sum_{k=m}^{N-1} z_k \overline{z_{k-m}} for m=1,…,Lm = 1, \ldots, L, and line L5 returns ν^=arg⁡Sπ(L+1)\hat\nu = \frac{\arg S}{\pi(L+1)} with S=∑m=1LR(m)S = \sum_{m=1}^{L} R(m) and arg⁡\arg in (−π,π](-\pi, \pi].

Lemma 1 (each autocorrelation is unbiased). ER(m)=A2ej2πνmE R(m) = A^2 e^{j2\pi\nu m} for 1≤m≤N−11 \le m \le N - 1, and without noise R(m)=A2ej2πνmR(m) = A^2 e^{j2\pi\nu m} exactly.

Proof. Write sk=Aej(2πνk+ϕ)s_k = A e^{j(2\pi\nu k + \phi)}. Then zkzk−m‾=sksk−m‾+skwk−m‾+wksk−m‾+wkwk−m‾z_k\overline{z_{k-m}} = s_k\overline{s_{k-m}} + s_k\overline{w_{k-m}} + w_k\overline{s_{k-m}} + w_k\overline{w_{k-m}}. The first term is A2ej2πνmA^2 e^{j2\pi\nu m} for every kk. The other terms have mean zero, because wkw_k has mean zero and, for m≥1m \ge 1, wkw_k and wk−mw_{k-m} are independent. Averaging over the N−mN - m values of kk gives the claim. □\square

Lemma 2 (the sum of the noise-free terms). For ν∉Z\nu \notin \mathbb{Z}, ∑m=1Lej2πνm=ejπν(L+1) sin⁡(πνL)sin⁡(πν)\sum_{m=1}^{L} e^{j2\pi\nu m} = e^{j\pi\nu(L+1)}\,\frac{\sin(\pi\nu L)}{\sin(\pi\nu)}.

Proof. The geometric sum is ej2πνej2πνL−1ej2πν−1=ej2πνejπνLejπν⋅sin⁡(πνL)sin⁡(πν)e^{j2\pi\nu}\frac{e^{j2\pi\nu L} - 1}{e^{j2\pi\nu} - 1} = e^{j2\pi\nu}\frac{e^{j\pi\nu L}}{e^{j\pi\nu}}\cdot\frac{\sin(\pi\nu L)}{\sin(\pi\nu)}, and ej2πν+jπνL−jπν=ejπν(L+1)e^{j2\pi\nu + j\pi\nu L - j\pi\nu} = e^{j\pi\nu(L+1)}. □\square

Theorem 1 (exact without noise inside the range). If wk=0w_k = 0 for all kk and ∣ν∣<1L+1|\nu| < \frac{1}{L+1}, then ν^=ν\hat\nu = \nu.

Proof. By Lemma 1, S=A2∑m=1Lej2πνmS = A^2\sum_{m=1}^{L} e^{j2\pi\nu m}. If ν=0\nu = 0, S=LA2>0S = LA^2 > 0 and ν^=0\hat\nu = 0. Otherwise, by Lemma 2, S=A2ejπν(L+1)DS = A^2 e^{j\pi\nu(L+1)} D with D=sin⁡(πνL)sin⁡(πν)D = \frac{\sin(\pi\nu L)}{\sin(\pi\nu)}. Since 0<∣πνL∣<∣πν(L+1)∣<π0 < |\pi\nu L| < |\pi\nu (L+1)| < \pi, the numbers sin⁡(πνL)\sin(\pi\nu L) and sin⁡(πν)\sin(\pi\nu) have the sign of ν\nu, so D>0D > 0. Hence arg⁡S≡πν(L+1)(mod2π)\arg S \equiv \pi\nu(L+1) \pmod{2\pi}, and since ∣πν(L+1)∣<π|\pi\nu(L+1)| < \pi, arg⁡S=πν(L+1)\arg S = \pi\nu(L+1) exactly. Line L5 gives ν^=ν\hat\nu = \nu. □\square

Theorem 2 (aliasing outside the range). Without noise, if 1L+1<ν<1L\frac{1}{L+1} < \nu < \frac1L, then ν^=ν−2L+1\hat\nu = \nu - \frac{2}{L+1}. If 1L<ν<2L+1\frac1L < \nu < \frac{2}{L+1} (possible when L≥2L \ge 2), then ν^=ν−1L+1\hat\nu = \nu - \frac{1}{L+1}.

Proof. In the first case, D>0D > 0 still, since 0<πνL<π0 < \pi\nu L < \pi, and π<πν(L+1)<π+πL≤2π\pi < \pi\nu(L+1) < \pi + \frac{\pi}{L} \le 2\pi, so arg⁡S=πν(L+1)−2π\arg S = \pi\nu(L+1) - 2\pi. In the second case, π<πνL<2π\pi < \pi\nu L < 2\pi and 0<πν<π0 < \pi\nu < \pi, so D<0D < 0 and arg⁡S≡πν(L+1)+π(mod2π)\arg S \equiv \pi\nu(L+1) + \pi \pmod{2\pi}. As πν(L+1)∈(π+π/L,2π)\pi\nu(L+1) \in (\pi + \pi/L, 2\pi), the value πν(L+1)+π−2π=πν(L+1)−π\pi\nu(L+1) + \pi - 2\pi = \pi\nu(L+1) - \pi lies in (0,π)(0, \pi), so ν^=ν−1L+1\hat\nu = \nu - \frac{1}{L+1}. □\square

So the range of the estimator is ∣ν∣<1L+1|\nu| < \frac{1}{L+1}: a larger LL averages more lags but narrows the range. Without the noise, this is all exact.

With noise. By Lemma 1, SS is an unbiased estimate of A2ejπν(L+1)DA^2 e^{j\pi\nu(L+1)}D, and D≥1D \ge 1 inside the range (DD is the Dirichlet kernel, which decreases from LL at ν=0\nu = 0 to sin⁡(πL/(L+1))/sin⁡(π/(L+1))=1\sin(\pi L/(L+1))/\sin(\pi/(L+1)) = 1 at the edge). The angle of an unbiased estimate is not an unbiased estimate of the angle, so the statement that the estimate has a small bias and a variance close to the Cramer-Rao bound for L≈N/2L \approx N/2 is not a theorem here: it is a closed form under assumptions in the paper of Luise and Reggiannini (a high-SNR linearization) and a measurement in the tests. The noise terms wkwk−m‾w_k\overline{w_{k-m}} are products of two noise samples, which is why the estimator degrades at low SNR, and why the degradation is mild: the sum over kk and mm averages about NLNL such products.

Complexity. Line L4 computes LL sums of at most N−1N - 1 terms, O(NL)O(NL) time; for L=N/2L = N/2 this is O(N2)O(N^2), or O(Nlog⁡N)O(N\log N) if all autocorrelations are computed with a zero-padded FFT. The extra space is O(1)O(1) for the direct form.

Complexity

The direct form costs O(NL)O(NL) time, which is O(N2)O(N^2) for L=N/2L = N/2, and O(1)O(1) extra space. All autocorrelations can be computed with a zero-padded FFT in O(Nlog⁡N)O(N\log N). Only one angle is computed, at the end; the Kay estimator needs N−1N - 1 angles.

Properties

  • Range set by LL. ∣ν∣<1L+1|\nu| < \frac{1}{L+1} cycles per symbol. For L=N/2L = N/2 and N=32N = 32 this is 0.05880.0588, so the estimator is a fine estimator after a coarse one, or for small offsets.
  • Close to the bound down to low SNR. For L≈N/2L \approx N/2 the measured error is within about 20 percent of the CRB down to 0 dB. The angle is taken once, after averaging, so there are no wraps of single differences, which is what limits the Kay estimator.
  • Data-aided. The data must be removed. For M-PSK without known data, apply it to zkMz_k^M; the range is then divided by MM, and the noise grows.
  • Simple. One sum of products and one angle; no search, no FFT required, no unwrapping.
  • Biased near the range edge. As ∣ν∣|\nu| approaches 1L+1\frac{1}{L+1}, the noise pushes the angle over ±π\pm\pi more often, and the estimate aliases.

Variants and improvements

  • Fitz estimator. Takes the angle of each R(m)R(m) separately, unwraps them across mm and fits a line. It has a similar range and accuracy.
  • Mengali and Morelli estimator. Uses the phase differences arg⁡(R(m)R(m−1)‾)\arg(R(m)\overline{R(m-1)}) with optimal weights, which gives a range of ∣ν∣<12|\nu| < \frac12 independent of LL and an accuracy close to the bound.
  • Closed-loop form. Luise and Reggiannini also used Im⁡\operatorname{Im} of the estimate as a frequency error detector in a recursive loop for continuous transmission.
  • Coarse plus fine. Use a small LL, or the Kay estimator, for a coarse estimate, derotate, then use L=N/2L = N/2 for the fine estimate.
  • OFDM forms. With a repeated training symbol, the same angle-of-correlation idea at one long lag gives the Moose and Schmidl and Cox estimators.

When to use it

Use it in burst modems with a known preamble, when the residual offset is small compared with the symbol rate and the SNR is low, for example a few dB, so that the Kay estimator is below its threshold. Choose LL as large as the largest expected offset allows, up to about N/2N/2. For large offsets, use a coarse stage first, or the Rife and Boorstyn estimator.

Pitfalls

  • Offset larger than the range. An offset above 1L+1\frac{1}{L+1} gives a wrong estimate with no warning. In the tests, ν=0.135\nu = 0.135 with L=7L = 7 returned −0.115-0.115.
  • Leaving the data in. Unknown symbols randomize the products zkzk−m‾z_k\overline{z_{k-m}}. Divide out the preamble, or use a power for PSK.
  • Dividing by 2π2\pi. The angle of the sum is πν(L+1)\pi\nu(L+1); dividing it by 2π2\pi instead of π(L+1)\pi(L+1) gives a wrong scale.
  • Using biased autocorrelations. Dividing every R(m)R(m) by NN instead of N−mN - m gives the long lags less weight. The angle of the noise-free sum is then no longer exactly πν(L+1)\pi\nu(L+1), and the estimate has a bias even without noise.
  • Taking LL larger than N/2N/2. It narrows the range and, in the measurement, did not improve the variance.

Implementations

Each implementation follows the pseudocode above. A comment @line links a line of code to a line of the pseudocode. Point at a line of the pseudocode to see the matching code. The build runs the native tests of each language.

luise_reggiannini_estimator.pyI0RawGitHub
# SPDX-License-Identifier: MIT
# Part of https://algorithm.tamnd.com/luise-reggiannini-estimator/. The authors are listed in prov/6HGD52.jsonl.

"""The Luise and Reggiannini (L and R) frequency estimator.

For z[k] = A e^(j(2 pi nu k + phi)) + w[k], k = 0, ..., N-1 (the received
samples with the known data removed), compute the sample autocorrelations

  R(m) = 1/(N - m) sum_{k=m}^{N-1} z[k] conj(z[k-m]),  m = 1, ..., L,

and estimate the normalized frequency nu (cycles per sample) as

  nu_hat = arg(sum_{m=1}^{L} R(m)) / (pi (L + 1)).

Without noise this is exact for |nu| < 1/(L + 1), which is the range of the
estimator. L is the design parameter: L = N/2 gives a variance close to the
Cramer-Rao bound, and a smaller L gives a wider range.
"""

import cmath
import math
from typing import Sequence


def autocorrelation(z: Sequence[complex], m: int) -> complex:
    """R(m) = 1/(N - m) sum_{k=m}^{N-1} z[k] conj(z[k-m])."""
    n = len(z)
    return sum(z[k] * z[k - m].conjugate() for k in range(m, n)) / (n - m)


def lr_estimate(z: Sequence[complex], big_l: int) -> float:
    """The L and R estimate of nu, in cycles per sample, in (-1/(L+1), 1/(L+1)]."""
    n = len(z)  # @line L1
    if not 1 <= big_l <= n - 1:
        raise ValueError("need 1 <= L <= N - 1")
    s = 0j  # @line L2
    for m in range(1, big_l + 1):  # @line L3
        s += autocorrelation(z, m)  # @line L4
    return cmath.phase(s) / (math.pi * (big_l + 1))  # @line L5


def crb_nu(n: int, snr: float) -> float:
    """The Cramer-Rao bound on the variance of nu_hat: 6 / ((2 pi)^2 SNR N (N^2 - 1))."""
    return 6.0 / ((2.0 * math.pi) ** 2 * snr * n * (n * n - 1))
test_luise_reggiannini_estimator.py 70 lines
# SPDX-License-Identifier: MIT
# Part of https://algorithm.tamnd.com/luise-reggiannini-estimator/. The authors are listed in prov/6HGD52.jsonl.

import cmath
import math
import random

from luise_reggiannini_estimator import autocorrelation, crb_nu, lr_estimate


def tone(rng, n, nu, snr=None, phi=0.0):
    sd = math.sqrt(0.5 / snr) if snr else 0.0
    return [cmath.exp(1j * (2 * math.pi * nu * k + phi)) + (complex(rng.gauss(0, sd), rng.gauss(0, sd)) if sd else 0j) for k in range(n)]


def test_closed_form_of_the_sum() -> None:
    # sum_{m=1}^{L} e^(j 2 pi nu m) = e^(j pi nu (L+1)) sin(pi nu L) / sin(pi nu).
    for big_l in (1, 4, 16):
        for nu in (0.013, -0.04, 0.05):
            s = sum(cmath.exp(2j * math.pi * nu * m) for m in range(1, big_l + 1))
            c = cmath.exp(1j * math.pi * nu * (big_l + 1)) * math.sin(math.pi * nu * big_l) / math.sin(math.pi * nu)
            assert abs(s - c) < 1e-12


def test_exact_without_noise_inside_the_range() -> None:
    rng = random.Random(1)
    for _ in range(100):
        n = rng.randrange(4, 40)
        big_l = rng.randrange(1, n)
        nu = rng.uniform(-1, 1) * 0.999 / (big_l + 1)
        z = tone(rng, n, nu, phi=rng.uniform(-3, 3))
        assert abs(lr_estimate(z, big_l) - nu) < 1e-12


def test_aliasing_outside_the_range() -> None:
    # For 1/(L+1) < nu < 1/L the angle wraps: the estimate is nu - 2/(L+1).
    big_l = 7
    nu = 0.135
    z = tone(random.Random(2), 32, nu)
    assert abs(lr_estimate(z, big_l) - (nu - 2 / (big_l + 1))) < 1e-12
    # For 1/L < nu the Dirichlet factor sin(pi nu L)/sin(pi nu) is negative as well.
    nu = 1.2 / (big_l + 1)
    z = tone(random.Random(2), 32, nu)
    assert abs(lr_estimate(z, big_l) - (nu - 1 / (big_l + 1))) < 1e-12


def test_autocorrelation_is_unbiased_for_a_tone() -> None:
    z = tone(random.Random(3), 20, 0.03, phi=1.0)
    for m in (1, 5, 19):
        assert abs(autocorrelation(z, m) - cmath.exp(2j * math.pi * 0.03 * m)) < 1e-12


def test_mse_against_the_crb() -> None:
    # N = 32, 300 trials per point, nu uniform in [-0.02, 0.02]. L = N/2 is close
    # to the bound down to about 0 dB; L = 8 is clearly worse at 0 dB.
    n, trials = 32, 300
    ratio = {}
    for big_l in (8, 16):
        for snr_db in (0, 10):
            snr = 10 ** (snr_db / 10)
            rng = random.Random(3)
            se = 0.0
            for _ in range(trials):
                nu = rng.uniform(-0.02, 0.02)
                e = lr_estimate(tone(rng, n, nu, snr, rng.uniform(-3, 3)), big_l) - nu
                se += e * e
            ratio[big_l, snr_db] = se / trials / crb_nu(n, snr)
    assert 0.8 < ratio[16, 10] < 1.3
    assert 0.9 < ratio[16, 0] < 1.8
    assert ratio[8, 0] > 1.2 * ratio[16, 0]

History

Marco Luise and Ruggero Reggiannini, at the University of Pisa, published the estimator in the IEEE Transactions on Communications in 1995. They designed it for all-digital burst modems and tested it on a TDMA satellite link and on a mobile radio link with GSM-like signals. They also showed how to use it as a frequency error detector inside a loop. It followed the fast single-tone estimators of Kay (1989) and Fitz, and was followed by the estimator of Mengali and Morelli (1997), which removed the dependence of the range on LL. Mengali and D'Andrea's book of 1997 presents it among the data-aided frequency estimators.

References

  1. M. Luise and R. Reggiannini, Carrier frequency recovery in all-digital modems for burst-mode transmissions, IEEE Transactions on Communications 43(2/3/4), 1995, pages 1169 to 1178, the open-loop data-aided estimator from the angle of the sum of autocorrelations, its range and variance, and its use as a frequency error detector in a closed loop
  2. Umberto Mengali and Aldo N. D'Andrea, Synchronization Techniques for Digital Receivers, Plenum Press, 1997, Chapter 3 (carrier frequency recovery with linear modulations, data-aided feedforward estimators based on autocorrelations)

About this page

The build computes these levels from the evidence in the repository. Each row says what the next level needs. Read what the levels mean.

LadderLevelWhat the next level needs
Human proofH1 sketch
  • a full proof of time.worst
  • a full proof of space.extra
LeanL0 no Lean part
  • name a Lean module in the lean field (07)
Code (python)I0 not checked yet
  • the tests did not run in this build
VisualV0 none
  • add viz/scene.ts or a figure (10)
WritingW2 basic
  • at least three sources
  • a scene preset for the example