S8 · Lesson 53 · Project
Building an OFDM transmitter and receiver with a cyclic prefix, passing it through a multipath channel, equalizing with one tap per subcarrier, and predicting its error rate from the channel's frequency response
This project builds the core of every Wi-Fi and LTE modem. You'll write the OFDM modulator that turns blocks of QPSK symbols into a time signal with a cyclic prefix, the demodulator that recovers them with an FFT, and the one-tap equalizer that undoes a multipath channel subcarrier by subcarrier. The final test sends 51,200 bits through a three-path channel with noise and checks the bit error rate against a prediction made from nothing but the channel's frequency response: each subcarrier behaves as its own QPSK link at its own SNR.
Predict
A three-path channel is normalized to unit energy and the link runs at 10 dB Eb/N0. Compared with a flat channel at the same Eb/N0, what happens to the OFDM link's error rate?
It rises. Equalization divides out each subcarrier's gain , restoring the symbols but scaling the noise by , so subcarrier k sees SNR . The channel's average power gain is 1, but the error rate is dominated by the subcarriers in its spectral dips. That's why OFDM systems code across subcarriers: the strong ones can carry the weak ones' bits.
Name it
The transmitter
For each OFDM symbol, N subcarrier symbols go through an orthonormal inverse FFT, , which in NumPy is np.fft.ifft(X)*np.sqrt(N). The last samples are copied to the front, and the symbols are sent one after another.
The channel
: a short multipath impulse response (fewer taps than the prefix) and complex white noise. With unit-energy QPSK on each subcarrier, the noise variance per complex sample is (ignoring the prefix's energy).
The receiver
Drop each prefix and take the orthonormal FFT, np.fft.fft(body)/np.sqrt(N). Because the prefix makes the channel's convolution circular, with .
Equalization and performance
, then QPSK decisions. Subcarrier k has multiplied by , so the predicted bit error rate is the average over subcarriers:
Worked example
A 64-subcarrier system uses a 16-sample prefix at 20 MHz. How long a channel can it handle, and what does the prefix cost?
Show the solution
- Prefix length. the Wi-Fi guard interval.
- Longest echo. It handles echoes up to 240 m longer than the direct path:
- Cost. The prefix uses of the time, 0.97 dB of SNR, as lesson 26 computed.
Answer echoes up to 0.8 µs (240 m of extra path), at a cost of 20% of the time, or 0.97 dB.
Worked example
The project's channel, normalized, has taps proportional to 0.8, 0.5j and −0.3. Where are its weakest subcarriers?
Show the solution
- Range of the gain. ranges from 0.19 to 2.61 across the band, averaging 1.
- The deepest dip. It runs below average, so at 10 dB average those subcarriers see only about 2.8 dB and make most of the errors.
- Predicted error rate. The average is 5.9 × 10⁻³, about 1,500 times the flat-channel value of 3.9 × 10⁻⁶.
Answer the weakest subcarriers sit at the deepest dip, 7.2 dB below average (about 2.8 dB at 10 dB average SNR), and they make most of the errors.
Check
Step 1. Write ofdm_mod(X, ncp): orthonormal IFFT of each symbol plus a cyclic prefix.
Python 3.14 with numpy and matplotlib, running in your browser. Tab indents; press Esc and then Tab to move on.
Check
Step 2. Write ofdm_demod(y, N, ncp, nsym): drop the prefixes and FFT each symbol.
Python 3.14 with numpy and matplotlib, running in your browser. Tab indents; press Esc and then Tab to move on.
Check
Step 3. Write equalize(Y, h, N): the one-tap zero-forcing equalizer.
Python 3.14 with numpy and matplotlib, running in your browser. Tab indents; press Esc and then Tab to move on.
Explain why
Why does OFDM need only one complex multiplication per subcarrier to equalize a multipath channel?
A multipath channel convolves the transmitted signal with its impulse response, which in general mixes every sample with its neighbors. The cyclic prefix makes that linear convolution indistinguishable, over each symbol's body, from a circular convolution of the body with the channel, as long as the channel is shorter than the prefix. The DFT turns circular convolution into multiplication, so after the receiver's FFT each subcarrier's symbol has simply been multiplied by one complex number, the channel's frequency response at that subcarrier. Undoing a single complex gain takes a single division, which is why OFDM receivers can handle long echoes that would need a long time-domain equalizer.
Practice
Keep practicing
3 kinds of problem on this topic, dealt one at a time with new numbers every time, for as long as you like.