Algorithmadvanced
Oerder and Meyr timing estimation
Also called square-law timing recovery, Oerder-Meyr estimator.
A feedforward timing estimator. It squares the magnitude of a block of samples at four per symbol, takes the DFT bin at the symbol rate and reads the delay from the phase of that bin.
- Solves
- Symbol timing recovery
- Time
- O(N S) worst
- Space
- O(S) extra
- Where
- N = the number of symbols in the block; S = the samples per symbol
- Model
- Real RAM
- Properties
- carrier phase invariantdeterministicfeedforwardnon data aided
- Evidence
- Proof sketchCode in 1 languages
- Origin
- Martin Oerder, Heinrich Meyr, 1988
Oerder and Meyr timing estimation is a feedforward, non-data-aided method for symbol timing recovery. The power of the matched filter output of a linearly modulated signal is, on average, a constant plus a sinusoid at the symbol rate, whose phase is the delay . The estimator samples the output at samples per symbol, squares the magnitudes, computes the one bin of the discrete Fourier transform at the symbol rate, , and returns . There is no loop, so the estimate of a block is ready after the block, without acquisition time, which suits burst receivers. The squaring removes the data and the carrier phase. The estimate is then applied with an interpolator such as the Farrow interpolator. The sinusoid comes from the excess bandwidth: for a raised cosine pulse with roll-off its amplitude is , so the method needs . The feedback detectors with the same idea are the early-late gate and the Gardner detector.
In plain words
The strength of the received signal rises and falls once per symbol on average: it is strongest near the moments when the symbols should be read. The pattern of the data blurs this rhythm, but over many symbols the rhythm remains. The estimator measures the strength of the signal four times per symbol over a block. It then asks how well the measured strengths match a wave that repeats once per symbol, and at which shift of that wave the match is best. That shift is the timing. The method does not need the data or the phase of the carrier, and it gives an answer for the whole block at once instead of slowly moving toward it.
The problem
Times are in symbol periods, . The input is a block of samples of the matched filter output
taken by a free-running clock at samples per symbol. The pulse is a raised cosine with roll-off , the symbols are unknown, independent and zero-mean with , is an unknown carrier phase, is filtered noise with , and is constant over the block. The output is an estimate of modulo one symbol, so that the receiver can interpolate the strobes .
The algorithm
OERDER-MEYR(x[0..N-1], Ls)- 1
rot[i] <- exp(-j 2 pi i / Ls) for i <- 0 to Ls - 1 - 2
X <- 0 - 3
for n <- 0 to N - 1 do - 4
X <- X + |x[n]|^2 * rot[n mod Ls] ▷ symbol-rate DFT bin of |x|^2 - 5
tau <- -arg(X) / (2 pi) ▷ wrapped to [-1/2, 1/2) - 6
return tau
Line L1 builds a table of the rotations. For they are , so with for , line L4 reduces to and needs no multiplications. Line L4 is one bin of the DFT, which is what the Goertzel algorithm computes in general. Line L5 takes the argument with a two-argument arctangent. For a long stream, the receiver runs the estimator on consecutive blocks and unwraps the estimates, because each is known only modulo one symbol.
Example
Take QPSK data (seed 7), , , no noise, and a block of symbols in the middle of a longer stream, so . The four partial sums of line L4 are:
| rotation | ||
|---|---|---|
| 0 | ||
| 1 | ||
| 2 | ||
| 3 |
So . Its argument is rad, and line L5 gives , an error of symbol. The mean of is : the data pattern moved from its mean, which is self-noise. With alternating data the power is exactly , the sums are , and , which gives .
Over 20 random QPSK blocks without noise, the rms error was symbol and the largest (measurement). At dB, 30 blocks gave a mean square error of times the MCRB (measurement). With alternating data and a delay that grows by symbol per symbol, from to over 300 symbols, blocks of 20 symbols with unwrapping followed the delay at each block centre within (measurement).
Correctness
Claim. If and is a multiple of , then for every carrier phase and every stationary noise, so the phase of the mean gives exactly. For , is real and the method fails. As the estimate converges to modulo one.
Key steps. By Poisson summation, the mean power of a raised cosine signal is plus the noise power. Over whole periods, the DFT bin removes the constant and the term at twice the symbol rate, and keeps per sample. At the term at cycle per symbol aliases onto the one at . Also, , so is the that maximizes the match between the measured power and a sinusoid at the symbol rate, and the tests check this against a grid search. The full proof is in the proofs file.
The mean is a closed form under assumptions: raised cosine pulses, independent data that extend beyond the block, stationary noise and a constant delay. The variance is not given in closed form here; the numbers above are measurements.
Proof: The spectral line of the squared signal has the mean (beta/8) N e^(-j 2 pi tau), so the Oerder and Meyr estimate is unbiased in phase and needs at least three samples per symbolfull
Times are in symbol periods, . The input is for with , where . The pulse is a raised cosine with roll-off , the data are independent with and and extend beyond the window on both sides, and is stationary noise independent of the data with . Lines L1 to L4 compute
and line L5 returns .
Lemma 1 (mean power). , for every .
Proof. The factor drops out of . The cross terms between different symbols, and between data and noise, have mean zero. What remains is , and the folded energy formula , proved on the early-late gate proof page by Poisson summation, gives the result.
Theorem 1 (mean of the spectral line). If and is a multiple of , then
So modulo one symbol.
Proof. Write . By Lemma 1, with the constant . Over a whole number of periods, , so the constant drops out. Expand the cosine:
The first term sums to . The second sums to zero because runs over whole periods of a nontrivial root of unity when . Multiply by .
Theorem 2 (why fails). For , the rotations are , so is real and for every input. The estimate cannot show .
Proof. Immediate. In Theorem 1, the second term then does not cancel: , and , which is real. This is aliasing: has a band up to cycles per symbol, and sampling it at two per symbol folds the line at onto the line at .
Theorem 3 (exact for alternating data). If and there is no noise, then exactly, for every window, so .
Proof. By Poisson summation, , as in the early-late gate proof. So with no random part, and the computation of Theorem 1 with in place of gives itself, not only its mean.
Theorem 4 (consistency). As , in mean square, so modulo one.
Proof. The sequence is periodic in distribution with period and has a covariance that decays with the distance in symbols, because decays as and the data are independent. So the covariances are summable and . With Theorem 1 this gives convergence in mean square. The argument is a continuous function of away from , and the limit is not zero for .
Theorem 1 is a closed form under assumptions: raised cosine pulses, independent zero-mean data that fill the window and extend past it, stationary noise, and a constant delay. The variance of for a finite comes from two sources, the noise and the data pattern (self-noise). It is not given in closed form here; the page reports measurements against the MCRB. The tests check Theorem 3 to for , and check that equals the maximum of the grid search over to ; this holds because is largest at .
Complexity
Each sample costs two real multiplications and one addition for , and one multiply-add by a table entry, or only an addition when . So a block costs operations and one arctangent, in the real RAM, with extra space for the table. The work per symbol is , a little more than a feedback loop at two samples per symbol, but the estimate has no acquisition time. The sum can be split over parallel hardware, since it has no feedback.
Properties
- Feedforward. The estimate of a block depends only on that block. There is no hang-up and no acquisition time, which makes the method suitable for bursts.
- Non-data-aided and phase-free. The magnitude removes the carrier phase, and a frequency offset small enough not to distort the matched filter output does not matter.
- Needs excess bandwidth. The line amplitude is times the symbol power. For the line vanishes and the estimate becomes noise.
- Modulo one symbol. is in . Which symbol the strobe belongs to must come from frame synchronization or from unwrapping.
- Low-SNR maximum likelihood link. At low SNR, the non-data-aided log-likelihood of the delay is about proportional to , a periodic function of . The estimator maximizes its first Fourier component (heuristic justification of the method).
Variants and improvements
- Other nonlinearities. , or also produce a line at the symbol rate. They change the noise and the self-noise, but not the structure.
- Other sample rates. Any works by the same proof; is the cheapest. Variants at two samples per symbol interpolate a third sample or use a different nonlinearity to avoid the aliasing.
- Block-wise tracking. Running the estimator on consecutive blocks, with unwrapping, follows a slowly drifting delay, as in the example. A smoothing filter on the estimates reduces their variance.
- Feedback form. Using as an error signal turns the estimator into a timing error detector for a loop.
- Data-aided estimation. With known symbols, the delay can be found by correlating with the known waveform, which reaches the MCRB at lower SNR; see data-aided synchronization.
When to use it
Use the Oerder and Meyr estimator when the receiver samples at a fixed rate of four samples per symbol, the data arrive in bursts or the timing must be found fast, the roll-off is not small, and the carrier is not yet recovered. It is a standard first stage in digital burst modems: estimate the timing, interpolate, then recover the carrier. For continuous links with tight jitter requirements, a narrow feedback loop averages over more symbols. For small roll-off, use a data-aided or decision-directed method.
Pitfalls
- Two samples per symbol. At the rotations are , is real, and the phase carries no timing information. The implementation raises an error for .
- Block not a multiple of . Then the constant part of does not cancel in and biases the estimate. Use a whole number of symbols.
- Edges of a burst. If the block covers the ramp-up or the ramp-down of a burst, the power there does not follow the stationary model. Keep the block inside the data, or accept a larger error.
- Wrap-around. An estimate near can jump by one symbol from block to block. Unwrap before interpolating, and track which symbol each strobe belongs to.
- Small roll-off. With the line is five times weaker than with , and self-noise dominates unless the block is long.
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.
# SPDX-License-Identifier: MIT
# Part of https://algorithm.tamnd.com/oerder-meyr-timing-estimation/. The authors are listed in prov/WF9W5Z.jsonl.
"""Oerder and Meyr timing estimation (1988): square the matched filter output and take
the phase of its spectral line at the symbol rate.
The input is a block of matched filter output samples x[n] = y(n / L_s), at L_s
samples per symbol (L_s >= 3; Oerder and Meyr use 4), with times in symbol
periods. The symbols sit at t = k + tau. The estimator is
X = sum_n |x[n]|^2 e^(-j 2 pi n / L_s), tau_hat = -arg(X) / (2 pi),
which lies in [-1/2, 1/2). For raised cosine pulses with roll-off beta > 0 and
i.i.d. zero-mean data, E|y(t)|^2 = c0 + (beta/4) E|a|^2 cos(2 pi (t - tau)), so
E[X] = (beta/8) E|a|^2 N e^(-j 2 pi tau) for N samples: the phase of the mean
is exactly -2 pi tau. The estimate does not depend on the carrier phase.
"""
import cmath
import math
from typing import Sequence
def spectral_line(x: Sequence[complex], ls: int) -> complex:
"""X = sum_n |x[n]|^2 e^(-j 2 pi n / L_s), the symbol-rate DFT bin of |x|^2."""
if ls < 3:
raise ValueError("L_s must be at least 3")
rot = [cmath.exp(-2j * math.pi * i / ls) for i in range(ls)] # @line L1
acc = 0j # @line L2
for n, v in enumerate(x): # @line L3
acc += (v.real * v.real + v.imag * v.imag) * rot[n % ls] # @line L4
return acc
def oerder_meyr(x: Sequence[complex], ls: int = 4) -> float:
"""The timing estimate tau_hat in [-1/2, 1/2) symbol periods from one block of samples."""
xs = spectral_line(x, ls)
tau = -cmath.phase(xs) / (2.0 * math.pi) # @line L5
if tau >= 0.5:
tau -= 1.0
return tau # @line L6
def oerder_meyr_blocks(x: Sequence[complex], ls: int, block: int) -> list[float]:
"""One estimate per block of `block` symbols, unwrapped so that it is continuous."""
out: list[float] = []
step = block * ls
for start in range(0, len(x) - step + 1, step):
# Sample n of the block is sample start + n of the stream; start is a whole
# number of symbols, so the delay relative to the block start is the same.
tau = oerder_meyr(x[start:start + step], ls)
if out:
tau += round(out[-1] - tau)
out.append(tau)
return out
test_oerder_meyr_timing_estimation.py 167 lines
# SPDX-License-Identifier: MIT
# Part of https://algorithm.tamnd.com/oerder-meyr-timing-estimation/. The authors are listed in prov/WF9W5Z.jsonl.
import cmath
import math
import random
import pytest
from oerder_meyr_timing_estimation import oerder_meyr, oerder_meyr_blocks, spectral_line
BETA = 0.5
TAU = 0.3
LS = 4
QPSK = [cmath.exp(1j * (math.pi / 4 + m * math.pi / 2)) for m in range(4)]
def rc(t, b):
"""The raised cosine pulse with roll-off b and T = 1."""
if abs(t) < 1e-12:
return 1.0
if abs(abs(t) - 1 / (2 * b)) < 1e-9:
return math.pi / 4 * math.sin(math.pi / (2 * b)) / (math.pi / (2 * b))
return math.sin(math.pi * t) / (math.pi * t) * math.cos(math.pi * b * t) / (1 - (2 * b * t) ** 2)
def rrc(t, b):
"""The root raised cosine pulse with roll-off b and T = 1."""
if abs(t) < 1e-12:
return 1 - b + 4 * b / math.pi
if abs(abs(t) - 1 / (4 * b)) < 1e-9:
return b / math.sqrt(2) * ((1 + 2 / math.pi) * math.sin(math.pi / (4 * b)) + (1 - 2 / math.pi) * math.cos(math.pi / (4 * b)))
return (math.sin(math.pi * (1 - b) * t) + 4 * b * t * math.cos(math.pi * (1 + b) * t)) / (math.pi * t * (1 - (4 * b * t) ** 2))
def samples(a, tau, n_sym, ls=LS, n0=0.0, seed=0, theta=0.0, drift=0.0, start=0, span=4, reach=8):
"""x[n] = y(start + n / ls) for n < n_sym ls, where
y(t) = e^(j theta) sum a_k g(t - k - tau - drift k) + v(t), g raised cosine.
The noise is v(t) = sum_m w_m rrc(t - m h) with h = 1/2 and w_m i.i.d.
CN(0, h n0): a stationary process with autocorrelation n0 g(t - s).
"""
rot = cmath.exp(1j * theta)
h = 0.5
m_lo = int(-6 / h)
w = None
if n0 > 0:
rng = random.Random(seed)
sd = math.sqrt(h * n0 / 2)
w = [complex(rng.gauss(0, sd), rng.gauss(0, sd)) for _ in range(int((len(a) + 12) / h))]
reach_w = int(span / h)
out = []
for n in range(n_sym * ls):
t = start + n / ls
k0 = int(round((t - tau) / (1 + drift)))
acc = 0j
for k in range(max(0, k0 - reach), min(len(a), k0 + reach + 1)):
acc += a[k] * rc(t - k - tau - drift * k, BETA)
acc *= rot
if w is not None:
c = int(round(t / h))
for m in range(c - reach_w, c + reach_w + 1):
acc += w[m - m_lo] * rrc(t - m * h, BETA)
out.append(acc)
return out
def qpsk(n, seed):
rng = random.Random(seed)
return [rng.choice(QPSK) for _ in range(n)]
def brute_force(x, ls):
"""argmax over tau_c of J(tau_c) = sum_n |x[n]|^2 cos(2 pi (n / ls - tau_c)), by a grid then ternary search."""
p = [abs(v) ** 2 for v in x]
def j(tc):
return sum(pn * math.cos(2 * math.pi * (n / ls - tc)) for n, pn in enumerate(p))
grid = [-0.5 + i / 400 for i in range(400)]
best = max(grid, key=j)
lo, hi = best - 1 / 400, best + 1 / 400
for _ in range(80):
m1, m2 = lo + (hi - lo) / 3, hi - (hi - lo) / 3
if j(m1) < j(m2):
lo = m1
else:
hi = m2
tc = 0.5 * (lo + hi)
return (tc + 0.5) % 1.0 - 0.5
def wrap(d):
return (d + 0.5) % 1.0 - 0.5
def test_alternating_data_gives_exact_delay():
# a_k = (-1)^k gives |y|^2 = (1 + cos(2 pi (t - tau))) / 2: a pure symbol-rate line.
a = [(-1) ** k + 0j for k in range(140)]
for tau in (0.3, -0.45, 0.0, 0.12):
for ls in (3, 4, 5, 8):
x = samples(a, tau, 100, ls=ls, start=20, reach=24)
assert abs(wrap(oerder_meyr(x, ls) - tau)) < 1e-5
def test_matches_brute_force_search():
for seed in range(4):
a = qpsk(100, seed)
x = samples(a, TAU, 100, n0=0.1, seed=seed + 50)
assert abs(wrap(oerder_meyr(x, LS) - brute_force(x, LS))) < 1e-7
def test_carrier_phase_does_not_change_the_estimate():
a = qpsk(100, 9)
x0 = samples(a, TAU, 100)
x1 = samples(a, TAU, 100, theta=2.0)
assert abs(oerder_meyr(x0) - oerder_meyr(x1)) < 1e-12
def test_needs_three_samples_per_symbol():
# At L_s = 2 the rotations are +1 and -1, so X would be real and its phase could not show tau.
with pytest.raises(ValueError):
spectral_line([1 + 0j] * 8, 2)
def test_range_of_estimate():
rng = random.Random(3)
for _ in range(100):
x = [complex(rng.gauss(0, 1), rng.gauss(0, 1)) for _ in range(40)]
t = oerder_meyr(x)
assert -0.5 <= t < 0.5
def test_noiseless_random_data_is_close():
# The data run on for 10 symbols on each side of the 100-symbol window, as in a
# stream. What is left is self-noise: the data pattern moves the line a little.
errs = []
for seed in range(20):
x = samples(qpsk(120, seed), TAU, 100, start=10)
errs.append(wrap(oerder_meyr(x) - TAU))
rms = math.sqrt(sum(e * e for e in errs) / len(errs))
assert rms < 0.01
def test_noise_variance_against_mcrb():
snr = 10.0
l0 = 100
xi = 1.0 / 12.0 + BETA ** 2 * (0.25 - 2.0 / math.pi ** 2)
mcrb = 1.0 / (8 * math.pi ** 2 * xi * l0 * snr)
errs = []
for seed in range(30):
x = samples(qpsk(l0 + 20, 100 + seed), TAU, l0, start=10, n0=1.0 / snr, seed=200 + seed)
errs.append(wrap(oerder_meyr(x) - TAU))
mse = sum(e * e for e in errs) / len(errs)
assert 1.0 <= mse / mcrb <= 4.0
def test_blocks_follow_a_drifting_delay():
# The delay grows by 0.004 T per symbol, from 0.3 to 1.5 over 300 symbols.
a = [(-1) ** k + 0j for k in range(330)]
x = samples(a, TAU, 300, start=0, drift=0.004, reach=24)
est = oerder_meyr_blocks(x, LS, 20)
assert len(est) == 15
for i, e in enumerate(est):
mid = 20 * i + 10
assert abs(e - (TAU + 0.004 * mid)) < 0.01
assert est[-1] > 1.0
History
Clock recovery by squaring the signal and filtering out the tone at the symbol rate is an old analog technique. Martin Oerder and Heinrich Meyr, at the RWTH Aachen, published a digital form in the IEEE Transactions on Communications in 1988: sample at a fixed rate of four samples per symbol, square, and take one DFT coefficient, so the phase of the tone is computed directly instead of filtered by a loop. Their paper gave the variance of the estimate and showed its use in all-digital receivers with interpolation. Meyr, Moeneclaey and Fechtel later placed it among the feedforward synchronizers derived from the likelihood function.
References
- M. Oerder and H. Meyr, Digital filter and square timing recovery, IEEE Transactions on Communications 36(5), 1988, pages 605 to 612, the estimator from the spectral line at the symbol rate of the squared samples at four samples per symbol, and its variance
- Heinrich Meyr, Marc Moeneclaey and Stefan A. Fechtel, Digital Communication Receivers, Wiley, 1998, Section 5.4 (feedforward timing estimation from the spectral line)
- Umberto Mengali and Aldo N. D'Andrea, Synchronization Techniques for Digital Receivers, Plenum Press, 1997, Chapter 7 and Chapter 8 (feedforward non-data-aided timing estimation and its comparison with the modified Cramer-Rao bound)
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.
| Ladder | Level | What the next level needs |
|---|---|---|
| Human proof | H1 sketch |
|
| Lean | L0 no Lean part |
|
| Code (python) | I0 not checked yet |
|
| Visual | V0 none |
|
| Writing | W2 basic |
|
Tag WF9W5Z Edit this page History Report an error Markdown