Symbol Timing against the MCRB¶
No unbiased estimate of the symbol timing from L symbols has a variance
below the modified Cramér-Rao bound, 1 / (8 π² ξ L Es/N0). ξ is the
pulse's normalized mean-square bandwidth as the receiver samples it, and
estimation.timing_mcrb gives the bound
for either pulse. The design page
derives both closed forms, and a C test checks each from the pulse itself.
The points are estimation.SymbolTimingEstimator
from one block of 128 symbols: the spread of its estimate about its mean
over 200 independent blocks, at each Es/N0. The lines are the bound.
- The rectangle is averaged over each sample's own interval at 4.3
samples a symbol, the condition the estimator and the matched bank are
designed for. Its
ξis finite because the sampling sets the bandwidth, and the estimator settles at about 1.5 times the bound in rms from 6 dB up. - The root-raised cosine (roll-off 0.35) has 0.4 of the
rectangle's
ξhere, so a bound 1.6 times higher. The estimator sits at 1.7 times it by 8 dB and rises toward 1.9 at 16 dB, where the term of its variance that does not fall with Es/N0 begins to show.
The estimator is not efficient, by design: it reads one line of the
stream's power, at the symbol rate, and needs no carrier and no decisions.
A tracking loop of noise bandwidth B_L T sees the same bound with
L = 1 / (2 B_L T).
The script checks every point at or above the bound, since a point below it would be a measurement defect, and checks the estimator within 2.2 times the bound from 8 dB up. It exits non-zero if either fails.
import numpy as np
from doppler.estimation import SymbolTimingEstimator, timing_mcrb
from doppler.filter import MovingAverage
from doppler.resample import MatchedRateConverter
from doppler.wfm import Synth
L = 128 # symbols in a block
ESN0_DB = np.arange(0.0, 17.0, 2.0)
TRIALS = 200
LEAD = 8 # symbols the matched filter settles over, not estimated on
# The rectangle: generated at U samples a symbol and averaged over D, so
# each kept sample is the waveform's average over its own interval.
U, D = 43, 10
N_RECT = U / D # 4.3 samples a symbol at the receiver
# The root-raised cosine, generated at the receiver's rate.
N_RRC, BETA, SPAN = 4, 0.35, 8
PULSE = {"rect": 0, "rrc": 1} # RC_PULSE_IANDD, RC_PULSE_RRC
def block(pulse, esn0_db, seed):
"""One matched-filtered block of L symbols at Es/N0 ``esn0_db``.
The generator draws the symbols, shapes them and adds the noise for
``esn0_db`` on its own grid. The rectangle is then averaged over D
generator samples and kept one in D, which keeps the noise white and
Es/N0 unchanged.
"""
rng = np.random.default_rng(seed)
nsym = L + 2 * LEAD
syms = np.where(rng.integers(0, 2, nsym) > 0, 1.0, -1.0)
if pulse == "rect":
gen = Synth(
type="symbols",
symbols=syms.astype(np.complex64),
pulse="rect",
sps=U,
fs=1.0,
snr=esn0_db,
snr_mode="esno",
seed=seed,
)
x = np.asarray(gen.steps(nsym * U)).astype(np.complex64)
x = np.asarray(MovingAverage(D).steps(x))[D - 1 :: D]
sps = N_RECT
mf = MatchedRateConverter(rate=1.0, pulse="iandd", pulse_sps=sps)
else:
gen = Synth(
type="symbols",
symbols=syms.astype(np.complex64),
pulse="rrc",
rrc_beta=BETA,
rrc_span=SPAN,
sps=N_RRC,
fs=1.0,
snr=esn0_db,
snr_mode="esno",
seed=seed,
)
x = np.asarray(gen.steps(nsym * N_RRC)).astype(np.complex64)
sps = N_RRC
mf = MatchedRateConverter(
rate=1.0, pulse="rrc", beta=BETA, span=SPAN, pulse_sps=sps
)
y = np.asarray(mf.execute(x.astype(np.complex64)))
first = round(LEAD * sps)
return y[first : first + round(L * sps)], sps
def spread(pulse, esn0_db):
"""The estimate's rms about its mean, in symbols, over TRIALS blocks."""
tau = np.empty(TRIALS)
for k in range(TRIALS):
y, sps = block(pulse, esn0_db, seed=1000 * int(esn0_db) + k + 1)
tau[k] = SymbolTimingEstimator(sps=sps).estimate(y).tau
# the timing is a phase of the symbol: its mean is a circular mean
mean = np.angle(np.mean(np.exp(2j * np.pi * tau))) / (2 * np.pi)
err = (tau - mean + 0.5) % 1.0 - 0.5
return float(np.sqrt(np.mean(err**2)))
def bound(pulse, esn0_db):
"""The MCRB's rms, in symbols, for this pulse as the receiver sees it."""
return timing_mcrb(PULSE[pulse], BETA, N_RECT, float(esn0_db), L) ** 0.5
