Exercises
ex-sp-ch22-01
EasyGenerate a single OFDM symbol with 64 subcarriers using QPSK data and plot the time-domain signal.
Implementation
N_fft = 64
data = np.exp(1j * np.pi * np.random.choice([1,3,5,7], N_fft) / 4)
x = np.fft.ifft(data) * np.sqrt(N_fft)
ex-sp-ch22-02
EasyAdd a cyclic prefix of length 16 to an OFDM symbol and verify that the last 16 samples equal the first 16 of the CP-extended signal.
Implementation
N_cp = 16
x_cp = np.concatenate([x[-N_cp:], x])
assert np.allclose(x_cp[:N_cp], x[-N_cp:])
ex-sp-ch22-03
EasyCompute the PAPR of 1000 OFDM symbols with 256 subcarriers and QPSK modulation. What is the 99th percentile PAPR?
Implementation
paprs = []
for _ in range(1000):
data = np.exp(1j*np.pi*np.random.choice([1,3,5,7],256)/4)
x = np.fft.ifft(data)*np.sqrt(256)
paprs.append(np.max(np.abs(x)**2)/np.mean(np.abs(x)**2))
print(f"99th percentile PAPR: {10*np.log10(np.percentile(paprs, 99)):.2f} dB")
ex-sp-ch22-04
EasyVerify that the OFDM subcarriers are orthogonal by computing the inner product of any two different subcarriers.
Implementation
N = 64
n = np.arange(N)
for k1, k2 in [(0,1), (3,7), (10,20)]:
ip = np.sum(np.exp(1j*2*np.pi*k1*n/N) * np.conj(np.exp(1j*2*np.pi*k2*n/N)))
print(f"<e_{k1}, e_{k2}> = {ip:.6f}") # should be ~0
ex-sp-ch22-05
EasyCompute the spectral efficiency of an OFDM system with , , 900 data subcarriers, and 64-QAM.
Calculation
N, Ncp, Ndata, M = 1024, 72, 900, 64
eta = (N/(N+Ncp)) * (Ndata/N) * np.log2(M)
print(f"Spectral efficiency: {eta:.2f} bps/Hz")
ex-sp-ch22-06
MediumBuild a complete OFDM transceiver with 256 subcarriers, 16-QAM, and a 5-tap Rayleigh channel. Implement pilot-based channel estimation with linear interpolation. Plot BER vs SNR.
Implementation
# See code supplement ch22/python/ofdm_system.py
ex-sp-ch22-07
MediumCompare ZF and MMSE equalization for OFDM with 16-QAM over a frequency-selective channel. Plot the BER difference.
Implementation
# See code supplement ch22/python/ofdm_system.py
ex-sp-ch22-08
MediumImplement DFT-based channel estimation: estimate at pilot positions, transform to time domain (IFFT), zero out taps beyond the CP length (noise suppression), and transform back (FFT). Compare MSE with linear interpolation.
Approach
DFT-based estimation exploits the channel's finite delay spread.
ex-sp-ch22-09
MediumSimulate the effect of carrier frequency offset (CFO) on OFDM. Show how a fractional CFO of (normalized to subcarrier spacing) causes inter-carrier interference (ICI).
Implementation
# Phase rotation: y[n] = x[n] * exp(j*2*pi*epsilon*n/N)
epsilon = 0.1
y_cfo = x * np.exp(1j * 2 * np.pi * epsilon * np.arange(len(x)) / N_fft)
ex-sp-ch22-10
MediumImplement PAPR reduction using clipping-and-filtering. Show the trade-off between PAPR reduction and BER degradation.
Approach
Clip the time-domain signal to a threshold, then filter to remove out-of-band emissions. Measure both PAPR CCDF and BER.
ex-sp-ch22-11
HardImplement a complete OFDM radar processor: generate OFDM frames, add target returns with range and Doppler, and form the range-Doppler map. Detect targets using a 2D CFAR algorithm.
Implementation
# See code supplement ch22/python/ofdm_radar.py
ex-sp-ch22-12
HardImplement OFDM with adaptive modulation: assign different QAM orders to different subcarriers based on their individual SNR. Show the throughput improvement over fixed modulation.
Approach
Water-filling or SNR thresholds determine the modulation per subcarrier.
ex-sp-ch22-13
HardSimulate OFDMA (multi-user OFDM) where different users are assigned different subcarrier blocks. Show how frequency diversity through distributed subcarrier allocation improves cell-edge performance.
Approach
Assign subcarriers in an interleaved pattern (IFDMA) vs localized blocks (LFDMA) and compare BER for cell-edge users.
ex-sp-ch22-14
HardImplement SC-FDMA (DFT-spread OFDM) used in LTE uplink. Show that it has lower PAPR than OFDM while maintaining the same spectral efficiency.
Approach
SC-FDMA adds a DFT precoding step before the IFFT: the time-domain signal is a single-carrier waveform, reducing PAPR.
ex-sp-ch22-15
ChallengeImplement a complete OFDM system with LDPC coding (using a rate-1/2 LDPC code). Show the coding gain over uncoded OFDM across different channel models.
Approach
Use a sparse parity-check matrix and iterative belief propagation decoding.
ex-sp-ch22-16
ChallengeImplement MIMO-OFDM with spatial multiplexing: 2x2 MIMO with separate OFDM processing per antenna, ZF detection per subcarrier, and joint BER evaluation.
Approach
At each subcarrier, the MIMO channel is a 2x2 matrix. Apply ZF/MMSE detection independently per subcarrier.