Keyboard shortcuts

Press ← or → to navigate between chapters

Press S or / to search in the book

Press ? to show this help

Press Esc to hide this help

Modulation: constellations, OFDM and FM

ProblemMap bits to complex baseband symbols and back, with hard or soft decisions; spread symbols over many orthogonal subcarriers; modulate an analogue message onto a carrier’s frequency
Devised byFrank Gray (1953), reflected binary labelling; Robert Chang (1966) and Saltzberg, then Stephen Weinstein and Paul Ebert (1971), OFDM by the DFT; Edwin Armstrong (1933), frequency modulation; John Carson (1922), FM bandwidth
AccuracySimulated bit error rates follow the theoretical curves; OFDM modulation and demodulation invert each other to ; the FM discriminator recovers the message to
CostMapping per symbol; soft demapping per bit for points; OFDM one FFT per symbol
Read firstSignal sources: oscillators, CORDIC and waveforms, The fast Fourier transform
APIConstellation (bpsk, qpsk, psk, qam, map_bits, slice, demap_hard, demap_soft), OfdmParams, Ofdm (modulate, demodulate, estimate_channel, demodulate_with_channel), FmModulator, FmDemodulator, fm_modulate, fm_demodulate, carson_bandwidth

Overview

A digital transmitter groups bits into symbols and maps each to a point of a constellation in the complex plane: two points for BPSK, four for QPSK, sixteen for 16-QAM. The receiver decides which point was sent, either outright (hard decisions) or as a likelihood for each bit (soft decisions, which error-correcting decoders use far better). More points carry more bits per symbol but sit closer together for the same power, so they need a higher signal-to-noise ratio. OFDM sends many symbols at once on orthogonal subcarriers generated by an inverse FFT, turning a frequency-selective channel into many flat ones. FM is the analogue counterpart: the message sets the carrier’s instantaneous frequency.

Where it is used

Modulation is how bits become something an antenna or cable can carry.

  • QAM and PSK constellations. Cable modems, Wi-Fi, LTE/5G, digital TV and satellite links all choose a constellation (QPSK, 16-QAM, 256-QAM, …) to match the signal-to-noise ratio they can count on.
  • OFDM. Wi-Fi, 4G/5G, DVB-T television and DSL send data on hundreds of narrow subcarriers computed with an FFT, which makes the multipath problem easy to handle.
  • FM. Broadcast radio, two-way radios and many telemetry links use frequency modulation, which trades bandwidth for noise immunity.

History

Phase and amplitude keying grew out of telegraphy and early data modems in the 1950s and 60s. Frank Gray patented the reflected binary code in 1953, and Gray labelling of constellations ensures that the likeliest error flips only one bit. Robert Chang (1966) at Bell Labs described orthogonal frequency-division multiplexing, and Stephen Weinstein and Paul Ebert (1971) showed that a DFT could generate it; the cyclic prefix (Abraham Peled and Antonio Ruiz, 1980) made it robust to multipath. OFDM now carries Wi-Fi, LTE, 5G and digital television. Edwin Armstrong demonstrated wideband FM in 1933, and John Carson’s bandwidth rule (1922, refined 1939) is still the engineering estimate.

The idea

Constellations and Gray labelling

A radio wave of a given frequency has two properties that can be varied to carry information: its amplitude and its phase. Both are captured by one complex number, whose magnitude is the amplitude and whose angle is the phase. Its real and imaginary parts are called the in-phase () and quadrature () components. Digital modulation sends a sequence of such complex numbers, called symbols, each chosen from a finite set, the constellation. With points in the set, each symbol carries bits.

  • Phase-shift keying (PSK) places points evenly on the unit circle, so the information is in the phase alone. BPSK has two points (, one bit per symbol) and QPSK four (two bits).
  • Quadrature amplitude modulation (QAM) places the points on a square grid, varying both amplitude and phase: 16-QAM carries four bits per symbol, 64-QAM six.

The library’s constellations are normalised to unit average energy, so that different constellations can be compared at the same transmitted power. Packing more points into the same energy puts them closer together, and so makes them easier to confuse when noise is added.

The assignment of bit patterns to points matters too. When noise causes an error, the receiver almost always mistakes a point for one of its nearest neighbours. Labels are therefore Gray-coded, arranged so that nearest neighbours differ in exactly one bit, and the commonest symbol errors cost only one bit error each:

Figure 16.2. Constellations.

constellationbits per symbolaverage powerminimum distancenearest neighbours differing in one bit
BPSK11.00002.00001 of 1
QPSK21.00001.41424 of 4
8-PSK31.00000.76548 of 8
16-QAM41.00000.632524 of 24
64-QAM61.00000.3086112 of 112

Decisions and bit error rates

The standard model of a channel adds white Gaussian noise to each symbol: an independent Gaussian random number of variance in each of the and components. The received point is the transmitted one displaced by a random amount. The best guess at what was sent is the constellation point nearest to the received point (slice); this is a hard decision.

An error occurs when the noise carries the received point closer to a wrong point. For BPSK, with points at , that means a noise component larger than the distance to the midpoint. The probability that a standard Gaussian variable exceeds is written , the upper tail of the normal distribution, which equals . Performance is expressed through the ratio of the energy spent per bit to the noise density, which allows fair comparison of schemes with different numbers of bits per symbol. For BPSK and Gray-coded QPSK the bit error rate is , and for square -QAM approximately :

Figure 16.3. Bit error rates.

The simulations (markers) follow the theory (lines). Each doubling of the bits per symbol costs several decibels of . QPSK matches BPSK per bit, because its two components are independent BPSK channels.

Soft demapping

A hard decision throws information away: a received point that lies almost midway between two constellation points is reported with the same assurance as one that lands squarely on a point. An error-correcting decoder can do much better if it is told how reliable each bit is. The standard measure is the log-likelihood ratio (LLR) of each bit, : positive if the bit is more probably 0, negative if more probably 1, and large in magnitude when the evidence is strong.

Computing it exactly requires a sum over all the constellation points. The library uses the max-log approximation, which keeps only the nearest point of each kind: the nearest point whose label has the bit equal to 0, and the nearest whose label has it equal to 1.

If the received point is much nearer to a “0” point than to any “1” point, the value is large and positive. Its sign is the hard decision, and its magnitude the confidence. Soft decisions gain about 2 dB in coded systems.

OFDM

The problem. A radio channel is rarely a single path. Reflections arrive later than the direct signal, so each symbol is smeared into the following ones (intersymbol interference), and in the frequency domain the channel’s gain varies across the band. Undoing this for a fast stream of short symbols needs a long, carefully adapted equaliser.

The idea. Orthogonal frequency-division multiplexing (OFDM) avoids the problem by sending many slow streams side by side instead of one fast one. The band is divided into narrow subcarriers, each carrying its own QAM symbol. A subcarrier is so narrow that the channel’s gain is practically constant across it, so each one sees the channel as a single complex number. The transmitter does not need oscillators: placing the symbols in the bins of an -point inverse FFT produces the sum of all the modulated subcarriers at once, and the receiver separates them again with an FFT.

The cyclic prefix. One detail makes this exact. The FFT’s property of turning convolution into multiplication holds for circular convolution, whereas a channel performs ordinary convolution, in which the echoes of one block spill into the next. The cyclic prefix fixes this: a copy of the last samples of each block is transmitted in front of it. Provided the channel’s echoes are shorter than the prefix, they affect only the prefix, which the receiver discards, and within the block the channel’s action looks exactly circular. Each subcarrier is then simply multiplied by the channel’s gain at its frequency, and is recovered by one division (one-tap equalisation).

OFDM places data symbols, plus known pilots, on subcarriers of an -point inverse FFT. OfdmParams::wifi_like() uses 64 subcarriers, a 16-sample prefix, 48 data and 4 pilot subcarriers, as IEEE 802.11a does. Back-to-back, modulation and demodulation agree to 9.6e-16.

The receiver must estimate . The library offers linear interpolation between the pilots of each symbol (demodulate), and a full estimate from a known training symbol (estimate_channel and demodulate_with_channel):

Figure 16.4. OFDM constellation.

channel estimate (25 dB SNR, 4-tap channel)error vector magnitudebit errors
linear interpolation between the 4 pilots27.0%321 of 7680
one known training symbol9.9%1 of 7488

Four pilots cannot follow a channel whose response changes several times across the band. That is why Wi-Fi uses training symbols for the channel estimate, and pilots only to track phase.

Frequency modulation

FM makes the instantaneous frequency : in complex baseband, with . The discriminator recovers the message from the phase difference between consecutive samples, , optionally followed by de-emphasis. Carson’s rule estimates the bandwidth as :

Figure 16.5. FM spectrum.

The discriminator recovers the two-tone message to 2.1e-15, and Carson’s rule gives a bandwidth of 20.0 kHz for the peak deviation of 7.5 kHz.

Algorithm

Mapping bits to symbols: take the bits at a time; read each group as the label of a constellation point; output the point.

Hard decision (slice): return the constellation point nearest to the received sample, and its label.

Soft demapping, for each received sample and each of the bit positions:

  1. find the smallest squared distance from to a point whose label has a 0 in that position, and the smallest to a point whose label has a 1;
  2. the LLR is the second minus the first, divided by the noise variance.

OFDM modulation of one symbol:

  1. place the data symbols and the known pilot values on their subcarriers, in the bins of an -point array; leave the unused bins zero;
  2. take the inverse FFT, scaled so that the time-domain signal has unit average power;
  3. copy the last samples in front of the block as the cyclic prefix.

OFDM demodulation of one symbol:

  1. discard the first samples and take the FFT of the remaining ;
  2. obtain the channel gain of each subcarrier: by interpolating linearly between the gains measured at the pilots (received value divided by known value), or from a previously received training symbol;
  3. divide each data subcarrier by its .

FM modulation: for each message sample, add to a running phase and output . Demodulation: multiply each sample by the conjugate of the previous one, take the argument of the product (the phase advance), and scale by .

Implementation

        let k = self.bits_per_symbol;
        let mut llr = Vec::with_capacity(samples.len() * k);
        for &s in samples {
            for b in 0..k {
                let shift = k - 1 - b;
                let (mut d0, mut d1) = (f64::INFINITY, f64::INFINITY);
                for (label, p) in self.points.iter().enumerate() {
                    let d = (s - p).norm_sqr();
                    if (label >> shift) & 1 == 0 {
                        d0 = d0.min(d);
                    } else {
                        d1 = d1.min(d);
                    }
                }
                llr.push((d1 - d0) / noise_variance);
            }
        }
        Ok(llr)
    fn modulate_symbol(&mut self, data: &[Complex<f64>]) -> Result<Vec<Complex<f64>>, ErrorsJSL> {
        let p = &self.params;
        let mut x = vec![Complex::new(0.0, 0.0); p.fft_size];
        for (&k, &v) in p.data.iter().zip(data) {
            x[p.bin(k)] = v;
        }
        for (&k, &v) in p.pilots.iter().zip(&p.pilot_values) {
            x[p.bin(k)] = v;
        }
        let scale = p.fft_size as f64 / (p.active_count() as f64).sqrt();
        let body: Vec<Complex<f64>> = self.inv.execute(&x)?.into_iter().map(|v| v * scale).collect();
        let mut out = Vec::with_capacity(p.symbol_len());
        out.extend_from_slice(&body[p.fft_size - p.cp_len..]);
        out.extend_from_slice(&body);
        Ok(out)
    }
    pub fn demodulate_sample(&mut self, y: Complex<f64>) -> f64 {
        let d = (y * self.previous.conj()).arg();
        self.previous = y;
        let m = d * self.scale;
        match self.deemphasis_alpha {
            Some(a) => {
                self.deemphasis_state += a * (m - self.deemphasis_state);
                self.deemphasis_state
            }
            None => m,
        }
    }
  • Subcarrier indices are signed, to , with negative indices in the upper half of the FFT; DC is never used.
  • demap_soft returns positive values for bit 0.

In practice

//! Digital modulation: mapping bits to constellations, soft demapping, OFDM and FM.

use lib_jsl_dsp::discrete::digital_communications::constellations::Constellation;
use lib_jsl_dsp::discrete::digital_communications::fm::{fm_demodulate, fm_modulate};
use lib_jsl_dsp::discrete::digital_communications::ofdm::{Ofdm, OfdmParams};
use num_complex::Complex;

fn main() {
    let qam = Constellation::qam(16).unwrap();
    let bits = [1, 0, 1, 1, 0, 0, 1, 0];
    let symbols = qam.map_bits(&bits).unwrap();
    println!("16-QAM symbols {}", symbols.iter().map(|c| format!("{c:.3}")).collect::<Vec<_>>().join(", "));
    let noisy: Vec<Complex<f64>> = symbols.iter().map(|s| s + Complex::new(0.05, -0.08)).collect();
    println!("hard decisions {:?}", qam.demap_hard(&noisy));
    let llr = qam.demap_soft(&noisy, 0.02).unwrap();
    println!("log-likelihood ratios (positive favours 0) {:.1?}", &llr[..4]);
    let params = OfdmParams::wifi_like();
    println!("OFDM: FFT {}, prefix {}, {} data subcarriers, {} samples per symbol", params.fft_size(), params.cp_len(), params.num_data(), params.symbol_len());
    let mut ofdm = Ofdm::new(params.clone()).unwrap();
    let data: Vec<Complex<f64>> = (0..params.num_data()).map(|k| qam.points()[k % 16]).collect();
    let tx = ofdm.modulate(&data).unwrap();
    let rx = ofdm.demodulate(&tx).unwrap();
    println!("OFDM round trip error {:.1e}", rx.data.iter().zip(&data).map(|(a, b)| (a - b).norm()).fold(0.0, f64::max));
    let message: Vec<f64> = (0..480).map(|n| (2.0 * std::f64::consts::PI * 300.0 * n as f64 / 48000.0).sin()).collect();
    let fm = fm_modulate(&message, 3000.0, 48000.0).unwrap();
    let back = fm_demodulate(&fm, 3000.0, 48000.0).unwrap();
    println!("FM: |baseband| = {:.3} everywhere; message error {:.1e}", fm[100].norm(), back.iter().zip(&message).skip(5).map(|(a, b)| (a - b).abs()).fold(0.0, f64::max));
}
16-QAM symbols 0.949+0.316i, -0.949+0.949i
hard decisions [1, 0, 1, 1, 0, 0, 1, 0]
log-likelihood ratios (positive favours 0) [-86.3, 23.2, -14.9, -25.1]
OFDM: FFT 64, prefix 16, 48 data subcarriers, 80 samples per symbol
OFDM round trip error 5.7e-16
FM: |baseband| = 1.000 everywhere; message error 2.6e-15

Strengths

  • Standard, normalised constellations with Gray labels and exact soft demapping; OFDM with flexible subcarrier layouts.
  • FM with constant envelope, robust to amplitude distortion.

Weaknesses

  • No pulse shaping, synchronisation or coding inside these functions; they are building blocks (see synchronisation, and the later chapter on error-correcting codes).
  • OFDM has a high peak-to-average power ratio and needs accurate frequency synchronisation.

Exercises

  1. Show that Gray-coded QPSK has the same bit error rate per as BPSK.
  2. Derive the max-log LLR from the exact LLR .
  3. Show that a cyclic prefix at least as long as the channel’s delay spread makes the channel a pointwise multiplication in the DFT domain.
  4. Compute the OFDM efficiency (data subcarriers and prefix overhead) of the Wi-Fi-like layout.
  5. Show that FM demodulation by is exact for .
Hints and answers
  1. Gray-coded QPSK is two independent BPSK streams on orthogonal carriers, each with energy per bit and noise density per dimension, so each has the same error probability as BPSK.
  2. The max-log approximation replaces each log-sum by its largest term: , giving .
  3. With a cyclic prefix at least as long as the channel’s memory, the received block is the circular convolution of the transmitted block with the channel, and the DFT turns circular convolution into pointwise multiplication.
  4. Efficiency ; insert the layout’s numbers (for 802.11a style: ).
  5. has argument equal to the phase increment (up to the principal value), which is recovered exactly if its magnitude is below .

Further reading

  • J. G. Proakis and M. Salehi, Digital Communications, 5th ed., McGraw-Hill, 2008.
  • S. B. Weinstein and P. M. Ebert, “Data transmission by frequency-division multiplexing using the discrete Fourier transform”, IEEE Transactions on Communication Technology 19 (1971) 628–634.
  • J. R. Carson, “Notes on the theory of modulation”, Proceedings of the IRE 10 (1922) 57–64.
  • M. Rice, Digital Communications: A Discrete-Time Approach, Pearson, 2009.