Algorithm Search⌘K

Techniqueresearch

Orthogonal time frequency space modulation

Also called OTFS.

Places the symbols on a delay-Doppler grid and spreads each over the whole time-frequency frame. A channel of few paths becomes a sparse, nearly constant shift on that grid.

Orthogonal time frequency space (OTFS) modulation, proposed by Hadani and coauthors in 2017, places the data symbols on a grid of NN Doppler bins by MM delay bins, not on a grid of time and frequency as OFDM does. A two-dimensional transform, the inverse symplectic finite Fourier transform (ISFFT), spreads each symbol over the whole time-frequency frame of NN OFDM-like symbols of MM subcarriers. In the delay-Doppler domain a channel of PP paths, each with a delay and a Doppler shift, acts as a sum of PP two-dimensional circular shifts with phase factors. This channel is sparse and changes slowly compared with the time-frequency channel, which changes from symbol to symbol under high Doppler. Every symbol meets every path, so a good detector can collect the diversity of all the paths. The cost is a joint detection over the frame. The page uses jj for the imaginary unit and rectangular pulses with one cyclic prefix per frame.

In plain words

A fast-moving receiver sees each echo of the signal arrive with its own delay and its own small frequency shift. In OFDM these effects make each subcarrier fade and leak into its neighbors from one symbol to the next. OTFS puts the data on a grid whose two axes are delay and frequency shift. On this grid each echo only moves the data a fixed number of steps and turns it a little, the same for the whole frame. The receiver finds a few echoes, not a separate channel for each subcarrier and time, and every data symbol reaches it along every echo.

When it applies

  • The channel has a few dominant paths with large Doppler shifts, for example high-speed trains, vehicles, aircraft or satellites, where the channel changes within an OFDM frame.
  • The delay spread fits in one prefix, and the paths keep their delays and Doppler shifts over the frame of NN symbols.
  • The receiver can afford a detector that uses the whole frame, such as LMMSE with a sparse matrix or message passing.
  • An existing OFDM modem can be reused: OTFS adds the ISFFT before an OFDM transmitter and the SFFT after an OFDM receiver.

The template

  1. OTFS(x[0..N-1][0..M-1], paths, cp) ▷ x[k][l]: Doppler bin k, delay bin l
  2. 1X[n][m] ← (1/√(NM)) Σ_k Σ_l x[k][l] e^{j2π(nk/N - ml/M)} ▷ ISFFT
  3. 2s ← for n = 0..N-1, the unitary M-point inverse DFT of X[n], concatenated ▷ Heisenberg transform
  4. 3send (s[MN-cp..MN-1], s) ▷ one prefix for the frame
  5. 4Y[n] ← the unitary M-point DFT of segment n of the received frame ▷ Wigner transform
  6. 5y ← SFFT(Y), the inverse of line L1
  7. 6x̂ ← the solution of y = G x by LMMSE or message passing, with G built from the paths

The frame in one step. With rectangular pulses, lines L1 and L2 together are an inverse DFT along the Doppler axis alone: s[nM+l]=1N∑kx[k][l] ej2πnk/Ns[nM + l] = \frac{1}{\sqrt N}\sum_k x[k][l]\, e^{j2\pi nk/N}. The DFT along delay in line L1 and the inverse DFT in line L2 cancel.

The channel on the grid. Let path pp have gain hph_p, delay lpl_p samples and Doppler kp/(MN)k_p/(MN) cycles per sample, so that r[q]=∑phpej2πkp(q−lp)/(MN)s[q−lp]r[q] = \sum_p h_p e^{j2\pi k_p (q - l_p)/(MN)} s[q - l_p]. For integer lpl_p and kpk_p and a prefix of at least max⁡plp\max_p l_p samples, the symbol at (k,l)(k, l) arrives at ((k+kp) mod N,(l+lp) mod M)((k + k_p) \bmod N, (l + l_p) \bmod M) with the factor hpej2πkpl/(MN)h_p e^{j2\pi k_p l/(MN)}, and one more factor e−j2πk′/Ne^{-j2\pi k'/N} if l+lp≥Ml + l_p \ge M, where k′k' is the new Doppler index. So GG has exactly PP nonzero entries in each column. A Doppler shift that is not a multiple of 1/(MN)1/(MN) spreads each path over neighboring Doppler bins.

Peak power. Each sample of the frame is a sum of NN symbols with unit-size weights over N\sqrt N, so for constant-envelope symbols the peak-to-average power ratio is at most NN, against MNMN for OFDM with MNMN subcarriers. All NN symbols of one delay bin set to 1 reach the bound.

Cost. Lines L1, L2, L4 and L5 cost O(MNlog⁡(MN))O(MN \log(MN)) with FFTs. Line L6 with a dense LMMSE solve costs O((MN)3)O((MN)^3); detectors that use the sparsity of GG, such as message passing, have a cost per iteration that grows linearly with MNMN and with PP.

Classic examples

A single pilot. With N=8N = 8, M=16M = 16 and three paths (lp,kp)=(0,0),(1,2),(3,−1)(l_p, k_p) = (0, 0), (1, 2), (3, -1), a frame with one symbol 1 at (k,l)=(2,5)(k, l) = (2, 5) and zeros elsewhere arrives as exactly three nonzero values, at (2,5)(2, 5), (4,6)(4, 6) and (1,8)(1, 8), with sizes ∣hp∣|h_p|. Pilots of this kind, with a guard of zeros around them, are a common way to estimate the paths.

Diversity with LMMSE. N=4N = 4, M=8M = 8, QPSK, 1500 frames (48000 symbols), ideal channel knowledge. The path gains are independent complex Gaussian with total mean power 1. OTFS uses delays 0, 1, 2 and Dopplers 0, 1, −1-1 and the LMMSE detector of line L6. OFDM uses the same gains and delays with no Doppler at all, its best case, and a one-tap equalizer per subcarrier. The table lists the symbol error rates.

SNR paths OTFS with LMMSE OFDM, one tap
10 dB 1 0.0839 0.0833
10 dB 3 0.0621 0.0765
20 dB 1 0.0115 0.0119
20 dB 3 0.0021 0.0089

With one path both schemes see one flat fade. With three paths each OFDM subcarrier still sees one Rayleigh-faded gain, but each OTFS symbol meets all three paths, and the error rate at 20 dB falls by a factor of about 4.

Variations

  • Detectors. Message passing on the sparse factor graph of GG, as in Raviteja and coauthors, and iterative interference cancellation scale to large frames. Maximum likelihood is the reference for small frames.
  • Prefix per symbol. A prefix on each of the NN segments, in place of one per frame, makes each segment circular on its own and changes the phase factors at the delay wrap, at a higher overhead.
  • Pulse shapes. Pulses other than the rectangle reduce the leakage of fractional Doppler shifts.
  • Zak-transform form. The same frame can be written with the discrete Zak transform, which makes the delay-Doppler grid the primary domain and avoids the time-frequency step.
  • Embedded pilots. A pilot with a guard region in the delay-Doppler grid, as in the first example, estimates the paths in the same frame as the data.

Pitfalls

  • Wrong axis order. In line L1 the sign of the exponent is ++ for Doppler and −- for delay. Swapping them in line L1 but not in line L5 moves the data to the wrong bins.
  • Missing wrap phase. Building GG for line L6 without the factor e−j2πk′/Ne^{-j2\pi k'/N} for l+lp≥Ml + l_p \ge M gives a wrong model for the paths that cross the delay edge and an error floor. Add the factor, or use one prefix per segment.
  • Prefix too short. Line L3 with a prefix shorter than the largest delay breaks the circular model of line L6. Make the prefix at least max⁡plp\max_p l_p samples.
  • Fractional Doppler ignored. Line L6 with integer kpk_p only, when the true shift lies between bins, leaves interference from the spread. Model the spread or use a larger NN.
  • One-tap equalizer. Dividing yy by one gain per bin in line L6, as in OFDM, ignores the other paths. The delay-Doppler channel is a sum of shifts, not a diagonal matrix.

Code

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.

orthogonal_time_frequency_space_modulation.pyI0RawGitHub
# SPDX-License-Identifier: MIT
# Part of https://algorithm.tamnd.com/orthogonal-time-frequency-space-modulation/. The authors are listed in prov/6XP9EH.jsonl.

"""OTFS with rectangular pulses and one cyclic prefix per frame.

A frame carries an N by M grid of symbols x[k][l] in the delay-Doppler domain:
k is the Doppler index (0 <= k < N) and l the delay index (0 <= l < M). The
inverse symplectic finite Fourier transform (ISFFT) takes the grid to the
time-frequency grid X[n][m], and the Heisenberg transform with a rectangular
pulse sends each row n as an M-sample OFDM symbol without its own prefix.
The frame has M N samples and one cyclic prefix. The receiver reverses the
two steps: an M-point DFT of each segment (Wigner transform) and the SFFT.

A channel of P paths with integer delays l_p and Doppler shifts k_p,

    r[q] = sum_p h_p e^(j 2 pi k_p (q - l_p) / (M N)) s[q - l_p],

acts on the delay-Doppler grid as a sparse matrix with P entries per column
(dd_channel). The detector here is the linear MMSE solve with that matrix.
The transforms are unitary, and the FFT sizes must be powers of 2.
"""

import cmath
import math
from typing import Sequence


def fft(a: Sequence[complex], inverse: bool = False) -> list[complex]:
    """Radix-2 DFT with no factor; inverse uses e^(+j). The length must be a power of 2."""
    n = len(a)
    if n & (n - 1):
        raise ValueError("length must be a power of 2")
    a = [complex(v) for v in a]
    j = 0
    for i in range(1, n):
        bit = n >> 1
        while j & bit:
            j ^= bit
            bit >>= 1
        j |= bit
        if i < j:
            a[i], a[j] = a[j], a[i]
    size = 2
    s = 1 if inverse else -1
    while size <= n:
        w = cmath.exp(s * 2j * math.pi / size)
        for start in range(0, n, size):
            t = 1 + 0j
            for k in range(size // 2):
                u = a[start + k]
                v = a[start + k + size // 2] * t
                a[start + k] = u + v
                a[start + k + size // 2] = u - v
                t *= w
        size *= 2
    return a


def udft(a: Sequence[complex]) -> list[complex]:
    return [v / math.sqrt(len(a)) for v in fft(a)]


def uidft(a: Sequence[complex]) -> list[complex]:
    return [v / math.sqrt(len(a)) for v in fft(a, inverse=True)]


def columns(g: Sequence[Sequence[complex]]) -> list[list[complex]]:
    return [list(c) for c in zip(*g)]


def isfft(x: Sequence[Sequence[complex]]) -> list[list[complex]]:
    """X[n][m] = (1/sqrt(N M)) sum_k sum_l x[k][l] e^(j 2 pi (n k / N - m l / M))."""
    a = columns([uidft(c) for c in columns(x)])  # inverse DFT along Doppler k -> time n
    return [udft(row) for row in a]  # DFT along delay l -> frequency m


def sfft(X: Sequence[Sequence[complex]]) -> list[list[complex]]:
    """The inverse of isfft."""
    a = [uidft(row) for row in X]
    return columns([udft(c) for c in columns(a)])


def modulate(x: Sequence[Sequence[complex]], cp: int) -> list[complex]:
    """The frame of M N samples with a cyclic prefix of cp samples."""
    X = isfft(x)  # @line L1
    s = [v for row in X for v in uidft(row)]  # @line L2
    return s[len(s) - cp:] + s  # @line L3


def demodulate(r: Sequence[complex], n: int, m: int, cp: int) -> list[list[complex]]:
    """The received delay-Doppler grid from one frame with its prefix."""
    body = list(r[cp: cp + n * m])
    Y = [udft(body[i * m: (i + 1) * m]) for i in range(n)]  # @line L4
    return sfft(Y)  # @line L5


def channel(s: Sequence[complex], paths: Sequence[tuple[complex, int, int]], n: int, m: int, cp: int) -> list[complex]:
    """Paths (h, l, k): delay l samples (at most cp) and Doppler k / (M N) cycles per sample."""
    r = [0j] * len(s)
    for h, l, k in paths:
        if l > cp:
            raise ValueError("delay longer than the prefix")
        for q in range(l, len(s)):
            r[q] += h * cmath.exp(2j * math.pi * k * (q - cp - l) / (n * m)) * s[q - l]
    return r


def dd_channel(paths: Sequence[tuple[complex, int, int]], n: int, m: int) -> list[list[complex]]:
    """The M N by M N matrix G with vec(y) = G vec(x), index k M + l, from the path list."""
    size = n * m
    G = [[0j] * size for _ in range(size)]
    for k0 in range(n):
        for l0 in range(m):
            for h, l, k in paths:
                k1, l1 = (k0 + k) % n, (l0 + l) % m
                g = h * cmath.exp(2j * math.pi * k * l0 / size)
                if l0 + l >= m:
                    g *= cmath.exp(-2j * math.pi * k1 / n)
                G[k1 * m + l1][k0 * m + l0] += g
    return G


def solve(a: Sequence[Sequence[complex]], b: Sequence[complex]) -> list[complex]:
    """Gaussian elimination with partial pivoting."""
    size = len(a)
    t = [list(r) + [b[i]] for i, r in enumerate(a)]
    for c in range(size):
        p = max(range(c, size), key=lambda i: abs(t[i][c]))
        if t[p][c] == 0:
            raise ValueError("matrix is singular")
        t[c], t[p] = t[p], t[c]
        for i in range(c + 1, size):
            f = t[i][c] / t[c][c]
            if f:
                ri, rc = t[i], t[c]
                for j in range(c, size + 1):
                    ri[j] -= f * rc[j]
    x = [0j] * size
    for i in range(size - 1, -1, -1):
        x[i] = (t[i][size] - sum(t[i][j] * x[j] for j in range(i + 1, size))) / t[i][i]
    return x


def lmmse(G: Sequence[Sequence[complex]], y: Sequence[Sequence[complex]], noise_var: float) -> list[list[complex]]:
    """x = (G^H G + noise_var I)^-1 G^H y for unit-energy symbols, on the grid."""
    size = len(G)
    m = len(y[0])
    v = [c for row in y for c in row]
    Gh = [[G[i][j].conjugate() for i in range(size)] for j in range(size)]
    A = [[sum(Gh[i][t] * G[t][j] for t in range(size)) + (noise_var if i == j else 0) for j in range(size)] for i in range(size)]
    z = [sum(Gh[i][t] * v[t] for t in range(size)) for i in range(size)]
    x = solve(A, z)  # @line L6
    return [x[i * m: (i + 1) * m] for i in range(size // m)]
test_orthogonal_time_frequency_space_modulation.py 112 lines
# SPDX-License-Identifier: MIT
# Part of https://algorithm.tamnd.com/orthogonal-time-frequency-space-modulation/. The authors are listed in prov/6XP9EH.jsonl.

import cmath
import math
import random

from orthogonal_time_frequency_space_modulation import (
    channel,
    dd_channel,
    demodulate,
    fft,
    isfft,
    lmmse,
    modulate,
    sfft,
)

QPSK = [complex(a, b) / math.sqrt(2) for a in (-1, 1) for b in (-1, 1)]
PATHS = [(0.8 + 0.1j, 0, 0), (-0.3 + 0.4j, 1, 2), (0.2 - 0.35j, 3, -1)]


def grid(rng, n, m):
    return [[rng.choice(QPSK) for _ in range(m)] for _ in range(n)]


def test_fft_matches_direct_sum():
    rng = random.Random(1)
    a = [complex(rng.gauss(0, 1), rng.gauss(0, 1)) for _ in range(16)]
    A = fft(a)
    for k in range(16):
        assert abs(A[k] - sum(a[t] * cmath.exp(-2j * math.pi * k * t / 16) for t in range(16))) < 1e-12


def test_isfft_formula_and_inverse():
    rng = random.Random(2)
    n, m = 4, 8
    x = grid(rng, n, m)
    X = isfft(x)
    for a in range(n):
        for b in range(m):
            d = sum(x[k][l] * cmath.exp(2j * math.pi * (a * k / n - b * l / m)) for k in range(n) for l in range(m)) / math.sqrt(n * m)
            assert abs(X[a][b] - d) < 1e-12
    back = sfft(X)
    assert max(abs(back[k][l] - x[k][l]) for k in range(n) for l in range(m)) < 1e-12


def test_frame_is_an_inverse_dft_along_doppler():
    rng = random.Random(3)
    n, m = 8, 16
    x = grid(rng, n, m)
    s = modulate(x, 0)
    for a in range(n):
        for l in range(m):
            d = sum(x[k][l] * cmath.exp(2j * math.pi * a * k / n) for k in range(n)) / math.sqrt(n)
            assert abs(s[a * m + l] - d) < 1e-12


def test_peak_power_is_at_most_n_times_the_mean():
    rng = random.Random(7)
    n, m = 8, 16
    for _ in range(20):
        s = modulate(grid(rng, n, m), 0)
        mean = sum(abs(v) ** 2 for v in s) / len(s)
        assert abs(mean - 1) < 1e-9
        assert max(abs(v) ** 2 for v in s) <= n * mean + 1e-9
    s = modulate([[1] * m] + [[0] * m for _ in range(n - 1)], 0)
    assert max(abs(v) ** 2 for v in s) < 1 + 1e-9
    s = modulate([[1] * m for _ in range(n)], 0)
    assert abs(max(abs(v) ** 2 for v in s) - n) < 1e-9


def test_round_trip_without_channel():
    rng = random.Random(4)
    n, m, cp = 8, 16, 4
    x = grid(rng, n, m)
    s = modulate(x, cp)
    assert len(s) == n * m + cp
    y = demodulate(s, n, m, cp)
    assert max(abs(y[k][l] - x[k][l]) for k in range(n) for l in range(m)) < 1e-9


def test_delay_doppler_matrix_matches_the_channel():
    rng = random.Random(5)
    n, m, cp = 8, 16, 4
    x = grid(rng, n, m)
    y = demodulate(channel(modulate(x, cp), PATHS, n, m, cp), n, m, cp)
    G = dd_channel(PATHS, n, m)
    v = [c for row in x for c in row]
    for i in range(n * m):
        assert abs(y[i // m][i % m] - sum(G[i][j] * v[j] for j in range(n * m))) < 1e-9
    for j in range(n * m):
        assert sum(1 for i in range(n * m) if abs(G[i][j]) > 1e-12) == len(PATHS)


def test_a_single_pilot_shows_the_paths():
    n, m, cp = 8, 16, 4
    x = [[0j] * m for _ in range(n)]
    x[2][5] = 1
    y = demodulate(channel(modulate(x, cp), PATHS, n, m, cp), n, m, cp)
    for h, l, k in PATHS:
        assert abs(abs(y[(2 + k) % n][(5 + l) % m]) - abs(h)) < 1e-9
    assert sum(1 for row in y for v in row if abs(v) > 1e-9) == len(PATHS)


def test_equalizer_round_trip():
    rng = random.Random(6)
    n, m, cp = 4, 8, 4
    x = grid(rng, n, m)
    y = demodulate(channel(modulate(x, cp), PATHS, n, m, cp), n, m, cp)
    xh = lmmse(dd_channel(PATHS, n, m), y, 0.0)
    assert max(abs(xh[k][l] - x[k][l]) for k in range(n) for l in range(m)) < 1e-9

Exercises

  1. Show that with rectangular pulses lines L1 and L2 give s[nM+l]=1N∑kx[k][l]ej2πnk/Ns[nM + l] = \frac{1}{\sqrt N}\sum_k x[k][l] e^{j2\pi nk/N}.
  2. Derive the input-output relation for one path with delay lpl_p and Doppler kpk_p, including the extra phase when l+lp≥Ml + l_p \ge M.
  3. Show that the map x↦yx \mapsto y for one path is hph_p times a unitary map, and conclude that GG for one path with hp≠0h_p \ne 0 is invertible.
  4. Prove that the peak-to-average power ratio of the frame is at most NN for constant-envelope symbols.
  5. With N=M=8N = M = 8 and paths of delays at most 2 and Dopplers at most 1 in size, how large must the zero guard around one pilot be so that the pilot response does not overlap the data?

References

  1. R. Hadani, S. Rakib, M. Tsatsanis, A. Monk, A. J. Goldsmith, A. F. Molisch and R. Calderbank, Orthogonal time frequency space modulation, IEEE Wireless Communications and Networking Conference (WCNC), 2017, pages 1 to 6, the proposal of OTFS, the ISFFT and the Heisenberg transform at the transmitter, and the delay-Doppler view of the channel
  2. P. Raviteja, Khoa T. Phan, Yi Hong and Emanuele Viterbo, Interference cancellation and iterative detection for orthogonal time frequency space modulation, IEEE Transactions on Wireless Communications 17(10), 2018, pages 6501 to 6515, the delay-Doppler input-output relation for rectangular pulses and the message passing detector

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 proofH0 no proof
  • add a proof in proofs/ (06.5)
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
  • three classic examples