Techniqueresearch
Affine frequency-division multiplexing
Also called AFDM.
Multicarrier modulation on chirps given by the inverse discrete affine Fourier transform. A chirp rate matched to the largest Doppler puts each path of a doubly dispersive channel on its own bin.
Affine frequency-division multiplexing (AFDM), proposed by Bemani, Ksairi and Kountouris, sends symbols on chirps, signals whose frequency rises linearly in time. The chirps come from the inverse discrete affine Fourier transform (DAFT): an inverse DFT between two chirp multiplications with rates and . With AFDM is OFDM. In a channel with both delay spread and Doppler spread, a doubly dispersive channel, OFDM subcarriers leak into each other. In AFDM a path with delay and Doppler only moves each symbol to another bin of the receiver's transform, by , and multiplies it by a known phase. With chosen from the largest Doppler shift, different paths land on different bins, so the receiver can separate them and collect their diversity. The block uses a chirp-periodic prefix in place of the cyclic prefix. The page uses for the imaginary unit.
In plain words
OFDM sends each symbol on a steady tone. When the receiver moves, every echo shifts the tones a little and they start to disturb each other. AFDM sends each symbol on a tone that slides up in frequency during the block. The slide is chosen so that an echo with a delay moves the symbol to a different place than an echo with a frequency shift. Each echo then puts its copy of the data in its own place, and the receiver can sort the copies out and add them up.
When it applies
- The channel has a few paths with both delay and Doppler spread, for example high-mobility links, where OFDM suffers from interference between subcarriers.
- The largest delay and the largest Doppler shift are known well enough to choose the chirp rate .
- The product of the delay and Doppler ranges fits the block: for integer shifts.
- A one-dimensional block of samples is preferred to the two-dimensional frame of OTFS, and the receiver can afford a joint detector over the block.
The template
AFDM(x[0..N-1], c1, c2, cp, paths)- 1
s[n] ← (1/√N) Σ_m x[m] e^{j2π(c1 n² + c2 m² + nm/N)} for n = 0..N-1 ▷ inverse DAFT, with one inverse FFT - 2
s[n] ← s[N+n] e^{-j2π c1 (N² + 2Nn)} for n = -cp..-1 ▷ chirp-periodic prefix - 3
send s[-cp..N-1] - 4
y[q] ← (1/√N) Σ_n r[n] e^{-j2π(c1 n² + c2 q² + nq/N)} for q = 0..N-1 ▷ DAFT of the block after the prefix - 5
x̂ ← the solution of y = H x by LMMSE or message passing, with H built from the paths
The prefix. Line L2 makes the formula of line L1 hold for negative as well. When is an integer and is even, the factor is 1 and the prefix is an ordinary cyclic prefix.
The channel on the bins. Let path have gain , delay samples and Doppler cycles per sample: . When is an integer and the prefix is at least , symbol arrives at bin
with the factor . So has one entry per path in each column. With , paths with the same Doppler and different delays fall on the same bin and only add up, as in OFDM.
Choosing . With the largest Doppler size, take . Then : each delay step moves the bin by more than the whole Doppler range, so all pairs with and give different bins when . The second rate does not move the bins; it changes the phases, and the paper discusses its choice.
Cost. Lines L1 and L4 cost one FFT of size and two chirp multiplications, . Line L5 with a dense LMMSE solve costs ; detectors that use the sparsity of cost much less.
Classic examples
A single pilot. With , , so and , and three paths , a block with one symbol 1 on bin 10 and zeros elsewhere arrives as exactly three nonzero values: on bins , and , with sizes . All 9 pairs with and give different bins, since . With , two paths with the same Doppler 1 and delays 0 and 2 both put their copy of bin 10 on bin 11.
Round trip. With the same paths, and a prefix of 4 samples, 32 random QPSK symbols go through lines L1 to L5 with from the formula above and noise variance 0, and come back with an error below .
Variations
- Detectors. Message passing, as for OTFS, and other sparse detectors use the few entries per column of . Maximum likelihood is the reference for small blocks.
- Fractional Doppler. A Doppler shift between bins spreads each path over neighboring bins. A guard of extra bins in the choice of absorbs part of this spread.
- Embedded pilots. One pilot with zero guard bins around it, as in the first example, estimates the paths within the data block.
- Chirp multicarrier relatives. Orthogonal chirp-division multiplexing uses the discrete Fresnel transform, a fixed chirp choice, while AFDM tunes to the channel.
Pitfalls
- Chirp rate not matched to the channel. Line L1 with too small lets paths with different delays share a bin, and line L5 loses the diversity. Choose or larger, within the condition above.
- Plain cyclic prefix for any . Line L2 with the factor left out is only correct when is an integer and is even. Keep the factor .
- Non-integer . The formula for in line L5 needs to be an integer; otherwise each path spreads over many bins. Round to a multiple of .
- Conjugate chirps. Line L4 must use and , the conjugates of the chirps of line L1. The same sign on both sides leaves a chirp on the data.
- Delay longer than the prefix. Line L2 with a prefix shorter than the largest delay breaks the circular model of line L5. Make the prefix at least samples.
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.
# SPDX-License-Identifier: MIT
# Part of https://algorithm.tamnd.com/affine-frequency-division-multiplexing/. The authors are listed in prov/94W5XF.jsonl.
"""AFDM: N symbols on N chirps given by the inverse discrete affine Fourier transform.
The transmitted block is
s[n] = (1/sqrt(N)) sum_m x[m] e^(j 2 pi (c1 n^2 + c2 m^2 + n m / N)),
an inverse DFT between two chirp multiplications. The chirp-periodic prefix
s[n] = s[N + n] e^(-j 2 pi c1 (N^2 + 2 N n)), for -cp <= n < 0, makes this
formula hold for negative n too. A path with gain h, integer delay l and
integer Doppler a (in units of 1 / N cycles per sample),
r[n] = h e^(j 2 pi a n / N) s[n - l],
moves symbol m to bin q = (m + a - 2 N c1 l) mod N of the receiver's
forward transform when 2 N c1 is an integer. With c1 = (2 A + 1) / (2 N),
paths with |a| <= A and 0 <= l <= L land on distinct bins whenever
(L + 1)(2 A + 1) <= N. The FFT size must be a power 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 chirp(c: float, n: int) -> complex:
return cmath.exp(2j * math.pi * c * n * n)
def c1_for(max_doppler: int, n: int) -> float:
"""The chirp rate c1 = (2 A + 1) / (2 N) that separates Dopplers |a| <= A."""
return (2 * max_doppler + 1) / (2 * n)
def modulate(x: Sequence[complex], c1: float, c2: float, cp: int) -> list[complex]:
"""The block with its chirp-periodic prefix of cp samples."""
n = len(x)
u = [x[m] * chirp(c2, m) for m in range(n)]
v = fft(u, inverse=True)
s = [v[t] / math.sqrt(n) * chirp(c1, t) for t in range(n)] # @line L1
pre = [s[n + t] * cmath.exp(-2j * math.pi * c1 * (n * n + 2 * n * t)) for t in range(-cp, 0)] # @line L2
return pre + s # @line L3
def demodulate(r: Sequence[complex], n: int, c1: float, c2: float, cp: int) -> list[complex]:
"""The forward transform of one received block after its prefix."""
body = list(r[cp: cp + n])
v = [body[t] * chirp(-c1, t) for t in range(n)]
u = fft(v)
return [u[q] / math.sqrt(n) * chirp(-c2, q) for q in range(n)] # @line L4
def channel(s: Sequence[complex], paths: Sequence[tuple[complex, int, int]], n: int, cp: int) -> list[complex]:
"""Paths (h, l, a): delay l samples (at most cp) and Doppler a / N cycles per sample."""
r = [0j] * len(s)
for h, l, a in paths:
if l > cp:
raise ValueError("delay longer than the prefix")
for t in range(l, len(s)):
r[t] += h * cmath.exp(2j * math.pi * a * (t - cp) / n) * s[t - l]
return r
def effective_channel(paths: Sequence[tuple[complex, int, int]], n: int, c1: float, c2: float) -> list[list[complex]]:
"""The N by N matrix H with y = H x in the noiseless case. Needs 2 N c1 to be an integer."""
q2 = 2 * n * c1
if abs(q2 - round(q2)) > 1e-9:
raise ValueError("2 N c1 must be an integer")
q2 = round(q2)
H = [[0j] * n for _ in range(n)]
for h, l, a in paths:
for m in range(n):
q = (m + a - q2 * l) % n
H[q][m] += h * cmath.exp(2j * math.pi * (c1 * l * l - l * m / n + c2 * (m * m - q * q)))
return H
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(H: Sequence[Sequence[complex]], y: Sequence[complex], noise_var: float) -> list[complex]:
"""x = (H^H H + noise_var I)^-1 H^H y for unit-energy symbols."""
n = len(H)
Hh = [[H[i][j].conjugate() for i in range(n)] for j in range(n)]
A = [[sum(Hh[i][t] * H[t][j] for t in range(n)) + (noise_var if i == j else 0) for j in range(n)] for i in range(n)]
z = [sum(Hh[i][t] * y[t] for t in range(n)) for i in range(n)]
return solve(A, z) # @line L5
test_affine_frequency_division_multiplexing.py 102 lines
# SPDX-License-Identifier: MIT
# Part of https://algorithm.tamnd.com/affine-frequency-division-multiplexing/. The authors are listed in prov/94W5XF.jsonl.
import cmath
import math
import random
from affine_frequency_division_multiplexing import (
c1_for,
channel,
demodulate,
effective_channel,
fft,
lmmse,
modulate,
)
QPSK = [complex(a, b) / math.sqrt(2) for a in (-1, 1) for b in (-1, 1)]
N = 32
C1 = c1_for(1, N)
C2 = math.sqrt(2) / (8 * N)
PATHS = [(0.8 + 0.1j, 0, 0), (-0.3 + 0.4j, 1, 1), (0.2 - 0.35j, 2, -1)]
def symbols(rng, n):
return [rng.choice(QPSK) for _ in range(n)]
def formula(x, c1, c2, t):
n = len(x)
return sum(x[m] * cmath.exp(2j * math.pi * (c1 * t * t + c2 * m * m + t * m / n)) for m in range(n)) / math.sqrt(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_block_and_prefix_follow_the_chirp_formula():
rng = random.Random(2)
x = symbols(rng, N)
cp = 6
s = modulate(x, C1, C2, cp)
assert len(s) == N + cp
for t in range(-cp, N):
assert abs(s[cp + t] - formula(x, C1, C2, t)) < 1e-9
def test_zero_chirps_give_ofdm():
rng = random.Random(3)
x = symbols(rng, N)
s = modulate(x, 0.0, 0.0, 4)
v = [u / math.sqrt(N) for u in fft(x, inverse=True)]
assert max(abs(a - b) for a, b in zip(s, v[-4:] + v)) < 1e-12
def test_round_trip_without_channel():
rng = random.Random(4)
x = symbols(rng, N)
y = demodulate(modulate(x, C1, C2, 4), N, C1, C2, 4)
assert max(abs(a - b) for a, b in zip(y, x)) < 1e-9
def test_effective_channel_matches_the_channel():
rng = random.Random(5)
x = symbols(rng, N)
cp = 4
y = demodulate(channel(modulate(x, C1, C2, cp), PATHS, N, cp), N, C1, C2, cp)
H = effective_channel(PATHS, N, C1, C2)
for q in range(N):
assert abs(y[q] - sum(H[q][m] * x[m] for m in range(N))) < 1e-9
def test_paths_land_on_distinct_bins():
cp = 4
x = [0j] * N
x[10] = 1
y = demodulate(channel(modulate(x, C1, C2, cp), PATHS, N, cp), N, C1, C2, cp)
for h, l, a in PATHS:
assert abs(abs(y[(10 + a - 3 * l) % N]) - abs(h)) < 1e-9
assert sum(1 for v in y if abs(v) > 1e-9) == len(PATHS)
# every delay up to 2 and Doppler up to 1 in size gets its own bin when (2 + 1)(2 + 1) <= N
bins = {(a - round(2 * N * C1) * l) % N for l in range(3) for a in (-1, 0, 1)}
assert len(bins) == 9
def test_without_chirp_paths_with_one_doppler_share_a_bin():
paths = [(1, 0, 1), (0.5, 2, 1)]
H = effective_channel(paths, N, 0.0, 0.0)
assert sum(1 for q in range(N) if abs(H[q][10]) > 1e-9) == 1
def test_equalizer_round_trip():
rng = random.Random(6)
x = symbols(rng, N)
cp = 4
y = demodulate(channel(modulate(x, C1, C2, cp), PATHS, N, cp), N, C1, C2, cp)
xh = lmmse(effective_channel(PATHS, N, C1, C2), y, 0.0)
assert max(abs(a - b) for a, b in zip(xh, x)) < 1e-9
Exercises
- Show that the chirp-periodic prefix of line L2 makes the formula of line L1 hold for .
- Derive the bin and the phase factor for one path with delay and Doppler .
- Show that with and no two paths share a bin.
- Show that gives OFDM with a cyclic prefix and a channel matrix that is diagonal when all Dopplers are 0.
- For , find the largest that keeps all paths apart when .
References
- Ali Bemani, Nassar Ksairi and Marios Kountouris, Affine frequency division multiplexing for next generation wireless communications, IEEE Transactions on Wireless Communications 22(11), 2023, pages 8214 to 8229, the discrete affine Fourier transform, the chirp-periodic prefix, the input-output relation and the choice of c1 from the largest delay and Doppler
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 | H0 no proof |
|
| Lean | L0 no Lean part |
|
| Code (python) | I0 not checked yet |
|
| Visual | V0 none |
|
| Writing | W2 basic |
|
Tag 94W5XF Edit this page History Report an error Markdown