Algorithm Search⌘K

Algorithmcore

Viterbi and Viterbi phase estimation

Also called Viterbi-Viterbi algorithm, Mth-power phase estimator.

Estimates the carrier phase of M-PSK in feedforward form by raising samples to the Mth power and averaging over a block.

Time
O(N) worst
Space
O(1) extra
Where
N = the number of symbols in the block
Properties
deterministicfeedforwardnon data aided
Origin
Andrew J. Viterbi, Audrey M. Viterbi, 1983

Viterbi and Viterbi (VV) phase estimation finds the carrier phase of an M-PSK signal from one block of NN samples, with no feedback and no knowledge of the data. It writes each sample as rk=ρkejψkr_k = \rho_k e^{j\psi_k}, removes the data by multiplying the angle by MM, weights each sample by a power ρkp\rho_k^p of its modulus, sums, and divides the angle of the sum by MM. It is the block, or feedforward, member of the carrier recovery family. The Costas loop and the squaring loop remove the data in the same way but in a feedback loop that runs symbol by symbol, and decision-directed carrier recovery uses decisions instead of a power. The estimate has an MM-fold ambiguity, and at high SNR its variance approaches the modified Cramer-Rao bound 1/(2N SNR)1/(2N\,\mathrm{SNR}). Because it needs no acquisition time, it suits burst transmission, and at low SNR the unwrapping of successive block estimates can fail, which is the block form of a cycle slip.

In plain words

In QPSK each symbol turns the carrier by one of four angles. If you multiply every angle by four, the four data angles all fall on the same angle, and only four times the carrier phase is left. So the receiver takes each sample, multiplies its angle by four, adds all of them up as arrows, and reads the angle of the total. Dividing by four gives the carrier phase, but only up to a quarter turn, because a quarter turn of the carrier also looks the same after the multiplication. Long arrows count more than short ones, but not too much, because the strong samples are not always the reliable ones.

The problem

The input is a block rk=akejθ+wkr_k = a_k e^{j\theta} + w_k, k=0,…,N−1k = 0, \ldots, N - 1, one sample per symbol after matched filtering and correct timing. The data ak=ej(2πik/M+φ0)a_k = e^{j(2\pi i_k/M + \varphi_0)} are unknown and uniform on M-PSK with a known offset φ0\varphi_0 (for example φ0=π/4\varphi_0 = \pi/4 for QPSK with points on the diagonals), and wk∼CN(0,N0)w_k \sim \mathcal{CN}(0, N_0) is white, SNR=Es/N0=1/N0\mathrm{SNR} = E_s/N_0 = 1/N_0. The phase θ\theta is constant over the block. Output an estimate θ^\hat\theta of θ\theta modulo 2π/M2\pi/M, in [−π/M,π/M)[-\pi/M, \pi/M).

The algorithm

  1. VV(r[0..N-1], M, p, phase0)
  2. 1S <- 0
  3. 2for k <- 0 to N - 1 do
  4. 3rho <- |r[k]|; psi <- arg r[k]
  5. 4S <- S + rho^p * exp(j * M * psi) ▷ the data angle is removed
  6. 5theta <- (arg S - M * phase0) / M
  7. 6return theta reduced to [-pi/M, pi/M)

Line L4 is the nonlinearity F(ρ)ejMψF(\rho) e^{jM\psi} with F(ρ)=ρpF(\rho) = \rho^p. With p=Mp = M it is rkMr_k^M, the plain Mth power, and the estimator is 1Marg⁡∑krkM\frac1M \arg \sum_k r_k^M up to the offset; with p=0p = 0 only the angles are used. Line L5 removes the angle Mφ0M\varphi_0 that the offset adds; for QPSK on the diagonals Mφ0=πM\varphi_0 = \pi, and the estimate is 14arg⁡(−∑krk4)\frac14 \arg\bigl(-\sum_k r_k^4\bigr). For a long signal, the receiver runs VV on successive blocks, or on a sliding window, and unwraps: it moves each new estimate by a multiple of 2π/M2\pi/M to the value nearest to the previous one.

Example

QPSK on the diagonals, θ=0.3\theta = 0.3 rad, SNR=10\mathrm{SNR} = 10 dB, N=4N = 4, p=2p = 2 (random data and noise, seed 6):

kk rkr_k ρk\rho_k ψk\psi_k ρk2ej4ψk\rho_k^2 e^{j4\psi_k}
0 0.293+0.901j0.293 + 0.901j 0.9470.947 1.25621.2562 0.276−0.854j0.276 - 0.854j
1 0.648+1.120j0.648 + 1.120j 1.2941.294 1.04641.0464 −0.842−1.447j-0.842 - 1.447j
2 −0.486−0.842j-0.486 - 0.842j 0.9720.972 −2.0947-2.0947 −0.474−0.818j-0.474 - 0.818j
3 1.000−0.809j1.000 - 0.809j 1.2871.287 −0.6802-0.6802 −1.511−0.677j-1.511 - 0.677j

The sum is S=−2.5510−3.7957jS = -2.5510 - 3.7957j, with arg⁡S=−2.1625\arg S = -2.1625. Line L5 gives (−2.1625−π)/4=−1.3260(-2.1625 - \pi)/4 = -1.3260, and line L6 adds π/2\pi/2 to reach 0.24480.2448 in [−π/4,π/4)[-\pi/4, \pi/4). The error is −0.055-0.055 rad. The four sample angles differ by about π/2\pi/2 multiples plus noise, but after multiplication by 4 the terms point in roughly the same direction.

With N=32N = 32 and 600 random blocks per point (seed 4), the mean square error over the MCRB 1/(2N SNR)1/(2N\,\mathrm{SNR}) was (measurements):

Es/N0E_s/N_0 p=0p = 0 p=1p = 1 p=2p = 2 p=4p = 4
0 dB 8.428.42 7.517.51 7.317.31 7.637.63
5 dB 3.373.37 2.652.65 2.702.70 3.973.97
10 dB 1.171.17 1.131.13 1.161.16 1.421.42

At 10 dB the error is close to the bound. At lower SNR the nonlinearity enhances the noise, and the powers p=1p = 1 and p=2p = 2 do better than the plain fourth power.

Correctness

Claim. θ^\hat\theta maximizes J(ϕ)=∑kρkpcos⁡(M(ψk−ϕ−φ0))J(\phi) = \sum_k \rho_k^p \cos\bigl(M(\psi_k - \phi - \varphi_0)\bigr), and its maximizers are θ^+2πMZ\hat\theta + \frac{2\pi}{M}\mathbb{Z}. Without noise θ^≡θ\hat\theta \equiv \theta modulo 2π/M2\pi/M. In circular Gaussian noise, the error modulo 2π/M2\pi/M is symmetric about zero, so the estimator is unbiased. At high SNR its variance is 12N SNR(1+o(1))\frac{1}{2N\,\mathrm{SNR}}(1 + o(1)), the MCRB.

Key steps. M(2πi/M+φ0)=2πi+Mφ0M(2\pi i/M + \varphi_0) = 2\pi i + M\varphi_0, so the data drops out of ejMψe^{jM\psi}. Then J(ϕ)=∣S∣cos⁡(arg⁡S−M(ϕ+φ0))J(\phi) = |S|\cos(\arg S - M(\phi + \varphi_0)), which is largest where line L5 puts ϕ\phi. Complex conjugation maps M-PSK and circular noise onto themselves, which gives the symmetry. A first-order expansion of the angle in the noise gives θ^−θ≈1N∑kyk\hat\theta - \theta \approx \frac1N \sum_k y_k with yk∼N(0,N0/2)y_k \sim \mathcal{N}(0, N_0/2). The first three claims are theorems; the high-SNR variance is a closed form under assumptions, and the table above is a measurement.

Proof: The VV estimate maximizes sum rho^p cos(M(psi - phi - phase0)), is exact modulo 2 pi/M without noise, is unbiased modulo 2 pi/M in circular noise, and reaches the MCRB at high SNRfull

The input is rk=akejθ+wkr_k = a_k e^{j\theta} + w_k, k=0,…,N−1k = 0, \ldots, N - 1, where ak=ej(2πik/M+φ0)a_k = e^{j(2\pi i_k/M + \varphi_0)} with iki_k independent and uniform on {0,…,M−1}\{0, \ldots, M - 1\}, the offset φ0\varphi_0 is known, and wk∼CN(0,N0)w_k \sim \mathcal{CN}(0, N_0) is white, SNR=1/N0\mathrm{SNR} = 1/N_0. Lines L2 to L4 form S=∑kρkpejMψkS = \sum_k \rho_k^p e^{jM\psi_k}, where rk=ρkejψkr_k = \rho_k e^{j\psi_k}. Line L5 sets θ^=(arg⁡S−Mφ0)/M\hat\theta = (\arg S - M\varphi_0)/M, and line L6 reduces it to [−π/M,π/M)[-\pi/M, \pi/M). Write ≡\equiv for equality modulo 2π/M2\pi/M.

Lemma 1 (the data is removed). For every data symbol, Marg⁡ak≡Mφ0(mod2π)M \arg a_k \equiv M\varphi_0 \pmod{2\pi}.

Proof. M(2πik/M+φ0)=2πik+Mφ0M(2\pi i_k/M + \varphi_0) = 2\pi i_k + M\varphi_0. □\square

Theorem 1 (what the estimate maximizes). For every ϕ\phi, let J(ϕ)=∑kρkpcos⁡(M(ψk−ϕ−φ0))J(\phi) = \sum_k \rho_k^p \cos(M(\psi_k - \phi - \varphi_0)). Then θ^\hat\theta is a maximizer of JJ, and the set of maximizers is θ^+2πMZ\hat\theta + \frac{2\pi}{M}\mathbb{Z} when S≠0S \ne 0.

Proof. J(ϕ)=Re⁡(Se−jM(ϕ+φ0))=∣S∣cos⁡(arg⁡S−M(ϕ+φ0))J(\phi) = \operatorname{Re}\bigl(S e^{-jM(\phi + \varphi_0)}\bigr) = |S| \cos\bigl(\arg S - M(\phi + \varphi_0)\bigr). This is at most ∣S∣|S|, with equality exactly when M(ϕ+φ0)≡arg⁡S(mod2π)M(\phi + \varphi_0) \equiv \arg S \pmod{2\pi}, that is ϕ≡(arg⁡S−Mφ0)/M\phi \equiv (\arg S - M\varphi_0)/M. Line L6 picks the representative in [−π/M,π/M)[-\pi/M, \pi/M). □\square

For p=Mp = M, J(ϕ)=Re⁡(e−jM(ϕ+φ0)∑krkM)J(\phi) = \operatorname{Re}\bigl(e^{-jM(\phi+\varphi_0)} \sum_k r_k^M\bigr), which is the first nonconstant term of the low-SNR expansion of the non-data-aided log-likelihood of M-PSK. Other pp trade that low-SNR form against a smaller noise enhancement at moderate SNR.

Theorem 2 (exact without noise). If wk=0w_k = 0 for all kk and N≥1N \ge 1, then θ^≡θ\hat\theta \equiv \theta, for every pp.

Proof. ρk=1\rho_k = 1 and ψk≡arg⁡ak+θ(mod2π)\psi_k \equiv \arg a_k + \theta \pmod{2\pi}, so by Lemma 1 ejMψk=ej(Mφ0+Mθ)e^{jM\psi_k} = e^{j(M\varphi_0 + M\theta)} for every kk and S=NejM(θ+φ0)≠0S = N e^{jM(\theta + \varphi_0)} \neq 0. Line L5 gives θ^≡θ\hat\theta \equiv \theta. □\square

So the estimate can only find θ\theta modulo 2π/M2\pi/M; this is the phase ambiguity of M-PSK, and an unwrapping step or differential encoding resolves it.

Theorem 3 (unbiased modulo 2π/M2\pi/M). Let ϵ\epsilon be the representative of θ^−θ\hat\theta - \theta in [−π/M,π/M)[-\pi/M, \pi/M). Then ϵ\epsilon has a distribution symmetric about 00, so Eϵ=0E\epsilon = 0.

Proof. Let uk=ake−jφ0u_k = a_k e^{-j\varphi_0}, an MMth root of unity, and vk=wke−j(θ+φ0)v_k = w_k e^{-j(\theta + \varphi_0)}, again CN(0,N0)\mathcal{CN}(0, N_0) and independent of the data. Then rk=(uk+vk)ej(θ+φ0)r_k = (u_k + v_k) e^{j(\theta + \varphi_0)}, and Se−jM(θ+φ0)=∑k∣uk+vk∣pejMarg⁡(uk+vk)=:S′S e^{-jM(\theta + \varphi_0)} = \sum_k |u_k + v_k|^p e^{jM\arg(u_k + v_k)} =: S', so Mϵ≡arg⁡S′(mod2π)M\epsilon \equiv \arg S' \pmod{2\pi}. Complex conjugation maps the set of MMth roots of unity onto itself and preserves the uniform law, and it preserves the law of circular Gaussian noise. So (uˉk,vˉk)(\bar u_k, \bar v_k) has the same joint law as (uk,vk)(u_k, v_k), and S′‾\overline{S'} has the same law as S′S'. Hence arg⁡S′\arg S' and −arg⁡S′-\arg S' have the same law on (−π,π](-\pi, \pi], up to the null event arg⁡S′=π\arg S' = \pi, and so do ϵ\epsilon and −ϵ-\epsilon. □\square

Theorem 4 (high-SNR variance). As N0→0N_0 \to 0, var⁡ϵ=N02N(1+o(1))=12N SNR(1+o(1))\operatorname{var}\epsilon = \frac{N_0}{2N}(1 + o(1)) = \frac{1}{2N\,\mathrm{SNR}}(1 + o(1)), the modified Cramer-Rao bound, for every fixed pp.

Proof. Write uk+vk=uk(1+uˉkvk)u_k + v_k = u_k(1 + \bar u_k v_k), and uˉkvk=xk+jyk\bar u_k v_k = x_k + j y_k with xk,ykx_k, y_k independent N(0,N0/2)\mathcal{N}(0, N_0/2). To first order in the noise, arg⁡(uk+vk)=arg⁡uk+yk+O(N0)\arg(u_k + v_k) = \arg u_k + y_k + O(N_0) and ∣uk+vk∣p=1+O(N0)|u_k + v_k|^p = 1 + O(\sqrt{N_0}). With ejMarg⁡uk=1e^{jM\arg u_k} = 1, S′=∑k(1+O(N0))(1+jMyk+O(N0))=N+jM∑kyk+O(N0)S' = \sum_k (1 + O(\sqrt{N_0}))(1 + jMy_k + O(N_0)) = N + jM\sum_k y_k + O(N_0) in mean square, so Mϵ=arg⁡S′=MN∑kyk+O(N0)M\epsilon = \arg S' = \frac{M}{N}\sum_k y_k + O(N_0) and ϵ=1N∑kyk+O(N0)\epsilon = \frac1N \sum_k y_k + O(N_0). Its variance is 1N2⋅N⋅N02+o(N0)\frac{1}{N^2} \cdot N \cdot \frac{N_0}{2} + o(N_0). Outliers, where the noise moves arg⁡S′\arg S' by more than π/2\pi/2, need a noise sample of size of order 11; for fixed NN their probability is bounded by a Gaussian tail e−c/N0e^{-c/N_0}, which is o(N0)o(N_0), and ∣ϵ∣≤π/M|\epsilon| \le \pi/M is bounded, so they do not change the leading term. □\square

This is a closed form under assumptions (high SNR). At moderate SNR the noise terms of higher order, enhanced by the power MM, raise the variance above the bound; the tests measure this, for QPSK with N=32N = 32, at 5 and 10 dB.

Complexity. Lines L2 to L4 run NN times with O(1)O(1) work each; lines L1, L5 and L6 are O(1)O(1). The total is O(N)O(N) time and O(1)O(1) extra space.

Complexity

Each sample costs one modulus, one angle, one power and one complex exponential, so the block costs O(N)O(N) time in the real RAM, with O(1)O(1) extra space. For p=Mp = M, rkMr_k^M needs only log⁡2M\log_2 M complex squarings and no trigonometric function. A sliding window of length NN updates SS in O(1)O(1) per sample by adding the new term and subtracting the old one.

Properties

  • Feedforward. There is no loop, so there is no acquisition time and no hang-up. Every block gives an estimate of the same quality.
  • Non-data-aided. The data need not be known or decided. The estimator works at SNRs where decisions are poor.
  • Ambiguity 2π/M2\pi/M. The estimate is modulo 2π/M2\pi/M: π\pi for BPSK, π/2\pi/2 for QPSK. A known word or differential encoding must resolve it.
  • Self noise and noise enhancement. At low SNR, the power multiplies the noise: terms of the type noise times noise appear in SS. The variance is then several times the MCRB, as the table shows.
  • Choice of pp. Viterbi and Viterbi studied the nonlinearity F(ρ)F(\rho); low powers (p=1p = 1 or 22) are a good choice for QPSK at moderate SNR, and p=Mp = M is the low-SNR maximum likelihood form.
  • Only for constant phase. The block length is a tradeoff: longer blocks lower the noise, but the phase must stay constant over the block, and a residual frequency offset ν\nu adds a phase change 2πνN2\pi\nu N over it.

Variants and improvements

  • Sliding window with unwrapping. A running sum of the last NN terms gives an estimate per symbol, and unwrapping follows a phase that moves beyond ±π/M\pm\pi/M.
  • Plain Mth power. p=Mp = M: θ^=1Marg⁡∑krkM\hat\theta = \frac1M \arg \sum_k r_k^M, the low-SNR approximation of the non-data-aided ML estimator for M-PSK.
  • QAM. For square QAM, the fourth power still keeps a nonzero mean, Ea4≠0E a^4 \neq 0, so 14arg⁡(−∑rk4)\frac14 \arg(-\sum r_k^4) works, with much more self noise. Selecting only the corner points or the points of a given ring reduces it.
  • Decision-directed refinement. Use the VV estimate to start a decision-directed loop, or recompute the block estimate with decisions.
  • Joint frequency and phase. With a residual frequency offset, apply a frequency estimator to rkMr_k^M first, for example the Kay estimator, then VV on the derotated block.

When to use it

Use VV for M-PSK in burst mode, in satellite modems, or after a coarse frequency correction in coherent optical receivers, where a block estimate is wanted at once and the SNR is moderate. For QPSK at a few dB SNR, choose p=1p = 1 or 22. For QAM, or at high SNR with a continuous signal, a decision-directed loop is simpler and has no self noise.

Pitfalls

  • Forgetting the offset. For QPSK on the diagonals, arg⁡∑r4\arg \sum r^4 is off by π\pi before the division. Omitting Mφ0M\varphi_0 shifts every estimate by π/4\pi/4.
  • Not unwrapping. Block estimates are in [−π/M,π/M)[-\pi/M, \pi/M). A phase that drifts past π/M\pi/M jumps by 2π/M2\pi/M unless the blocks are unwrapped.
  • Wrong unwrapping at low SNR. If two consecutive estimates differ by more than π/M\pi/M because of noise, the unwrapping adds a wrong multiple of 2π/M2\pi/M, and all later symbols are rotated. This is a cycle slip of the block estimator.
  • Too long a block with a frequency offset. The term ejM2πνke^{jM 2\pi\nu k} turns inside the sum. If MνNM\nu N is not small, the sum cancels and the estimate is meaningless.
  • Using p=Mp = M at low SNR. The plain Mth power enhances the noise most. At 5 dB for QPSK it had about 50 percent more error than p=2p = 2 in the table.

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.

viterbi_viterbi_phase_estimation.pyI0RawGitHub
# SPDX-License-Identifier: MIT
# Part of https://algorithm.tamnd.com/viterbi-viterbi-phase-estimation/. The authors are listed in prov/VA0M3B.jsonl.

"""Viterbi and Viterbi (VV) feedforward carrier phase estimation for M-PSK.

Write each sample in polar form, r[k] = rho e^(j psi). Multiplying the angle
by M removes the M-PSK data, because M times a data angle 2 pi i / M + phase0
is M phase0 modulo 2 pi. The modulus is replaced by a nonlinearity F(rho) =
rho^p. The estimate is

  theta_hat = (arg(sum_k rho_k^p e^(j M psi_k)) - M phase0) / M,

wrapped to [-pi/M, pi/M). It has the M-fold ambiguity of the constellation:
it estimates theta modulo 2 pi / M. With p = M it is the plain Mth power
estimator arg(sum r^M) / M.
"""

import cmath
import math
from typing import Sequence


def wrap(x: float, period: float) -> float:
    """x reduced to [-period/2, period/2)."""
    return (x + period / 2.0) % period - period / 2.0


def vv_estimate(r: Sequence[complex], m: int, p: float = 2.0, phase0: float = 0.0) -> float:
    """The VV phase estimate for M-PSK with first point at angle phase0, F(rho) = rho^p."""
    s = 0j  # @line L1
    for x in r:  # @line L2
        rho, psi = abs(x), cmath.phase(x)  # @line L3
        s += rho**p * cmath.exp(1j * m * psi)  # @line L4
    theta = (cmath.phase(s) - m * phase0) / m  # @line L5
    return wrap(theta, 2.0 * math.pi / m)  # @line L6


def objective(r: Sequence[complex], m: int, phi: float, p: float = 2.0, phase0: float = 0.0) -> float:
    """sum_k rho_k^p cos(M (psi_k - phi - phase0)), the function that the VV estimate maximizes."""
    return sum(abs(x) ** p * math.cos(m * (cmath.phase(x) - phi - phase0)) for x in r)


def unwrap(estimates: Sequence[float], m: int) -> list[float]:
    """Unwrap block estimates: move each by a multiple of 2 pi / M to the one nearest the previous."""
    period = 2.0 * math.pi / m
    out: list[float] = []
    for t in estimates:
        if out:
            t = out[-1] + wrap(t - out[-1], period)
        out.append(t)
    return out
test_viterbi_viterbi_phase_estimation.py 89 lines
# SPDX-License-Identifier: MIT
# Part of https://algorithm.tamnd.com/viterbi-viterbi-phase-estimation/. The authors are listed in prov/VA0M3B.jsonl.

import cmath
import math
import random

from viterbi_viterbi_phase_estimation import objective, unwrap, vv_estimate, wrap

Q0 = math.pi / 4  # QPSK points at pi/4 + i pi/2


def psk_block(rng, m, n, theta, snr=None, phase0=0.0):
    sd = math.sqrt(0.5 / snr) if snr else 0.0
    out = []
    for _ in range(n):
        a = cmath.exp(1j * (2 * math.pi * rng.randrange(m) / m + phase0))
        w = complex(rng.gauss(0, sd), rng.gauss(0, sd)) if sd else 0j
        out.append(a * cmath.exp(1j * theta) + w)
    return out


def test_exact_without_noise() -> None:
    rng = random.Random(1)
    for m, phase0 in ((2, 0.0), (4, Q0), (4, 0.0), (8, 0.0)):
        for _ in range(50):
            th = rng.uniform(-math.pi / m, math.pi / m) * 0.999
            r = psk_block(rng, m, 16, th, phase0=phase0)
            for p in (0, 1, 2, m):
                assert abs(vv_estimate(r, m, p, phase0) - th) < 1e-9


def test_ambiguity_modulo_two_pi_over_m() -> None:
    rng = random.Random(2)
    r = psk_block(rng, 4, 16, 1.0, phase0=Q0)
    assert abs(vv_estimate(r, 4, 2, Q0) - (1.0 - math.pi / 2)) < 1e-9
    r = psk_block(rng, 2, 16, 2.0)
    assert abs(vv_estimate(r, 2, 2) - (2.0 - math.pi)) < 1e-9


def test_maximizes_the_objective_against_a_grid() -> None:
    # Brute force: the best of 4000 grid points in one period cannot beat the closed form.
    rng = random.Random(3)
    for m, phase0, p in ((4, Q0, 2), (4, Q0, 0), (8, 0.0, 1), (2, 0.0, 2)):
        r = psk_block(rng, m, 24, 0.1, snr=10 ** 0.3, phase0=phase0)
        t = vv_estimate(r, m, p, phase0)
        period = 2 * math.pi / m
        grid = [-period / 2 + period * i / 4000 for i in range(4000)]
        g = max(grid, key=lambda x: objective(r, m, x, p, phase0))
        best = objective(r, m, t, p, phase0)
        assert best >= objective(r, m, g, p, phase0) - 1e-12
        assert abs(wrap(g - t, period)) <= period / 4000


def test_mse_against_the_mcrb() -> None:
    # QPSK, N = 32, MCRB = 1/(2 N SNR). At 10 dB all nonlinearities are close to it;
    # at 5 dB, p = 1 or 2 is clearly better than the plain fourth power p = 4.
    n, trials = 32, 600
    ratio = {}
    for snr_db in (5, 10):
        snr = 10 ** (snr_db / 10)
        mcrb = 1 / (2 * n * snr)
        for p in (1, 2, 4):
            rng = random.Random(4)
            se = 0.0
            for _ in range(trials):
                th = rng.uniform(-0.3, 0.3)
                e = wrap(vv_estimate(psk_block(rng, 4, n, th, snr, Q0), 4, p, Q0) - th, math.pi / 2)
                se += e * e
            ratio[snr_db, p] = se / trials / mcrb
    for p in (1, 2, 4):
        assert 0.9 < ratio[10, p] < 1.8
    assert ratio[10, 2] < 1.35
    assert ratio[5, 2] < 0.8 * ratio[5, 4]
    assert ratio[5, 1] < 0.8 * ratio[5, 4]
    assert ratio[5, 2] > 1.5


def test_unwrap_tracks_a_drifting_phase() -> None:
    # Blocks of 32 QPSK symbols with a phase ramp over 3 rad, beyond the range pi/4.
    rng = random.Random(5)
    ests, truth = [], []
    for b in range(60):
        th = 0.05 * b
        truth.append(th)
        ests.append(vv_estimate(psk_block(rng, 4, 32, th, 10.0, Q0), 4, 2, Q0))
    assert max(ests) < math.pi / 4
    u = unwrap(ests, 4)
    assert max(abs(a - b) for a, b in zip(u, truth)) < 0.2

History

Andrew J. Viterbi and Audrey M. Viterbi published the estimator in the IEEE Transactions on Information Theory in 1983. They designed it for burst digital transmission, such as time-division multiple access satellite links, where a carrier loop has no time to acquire at the start of each burst. Their paper considered a general nonlinearity of the modulus and computed the variance for several choices. The Mth power idea itself is older: the squaring and Mth power loops of the 1960s and 1970s used it in feedback form. The VV estimator later became the standard feedforward phase recovery for QPSK in digital coherent optical receivers.

References

  1. A. J. Viterbi and A. M. Viterbi, Nonlinear estimation of PSK-modulated carrier phase with application to burst digital transmission, IEEE Transactions on Information Theory 29(4), 1983, pages 543 to 551, the feedforward estimator with the nonlinearity F(rho) e^(j M psi) of each sample, and its variance against the nonlinearity
  2. Umberto Mengali and Aldo N. D'Andrea, Synchronization Techniques for Digital Receivers, Plenum Press, 1997, Chapter 5 (carrier phase recovery with linear modulations, the non-data-aided feedforward estimator for M-PSK)
  3. Heinrich Meyr, Marc Moeneclaey and Stefan A. Fechtel, Digital Communication Receivers, Wiley, 1998, Chapter 5 (feedforward carrier phase estimation for M-PSK, the Viterbi and Viterbi algorithm)

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
  • a scene preset for the example