Exercises
ex-sp-ch21-01
EasyCompute the free-space path loss at 3.5 GHz for distances of 10, 100, and 1000 meters.
Implementation
import numpy as np
fc = 3.5e9
for d in [10, 100, 1000]:
pl = 20*np.log10(4*np.pi*d*fc/3e8)
print(f"d={d}m: PL={pl:.1f} dB")
ex-sp-ch21-02
EasyGenerate 100000 Rayleigh fading samples and verify that the mean power is 1.0 and the CDF matches the theoretical Rayleigh CDF.
Implementation
rng = np.random.default_rng(42)
h = (rng.standard_normal(100000) + 1j*rng.standard_normal(100000)) / np.sqrt(2)
print(f"Mean |h|^2 = {np.mean(np.abs(h)**2):.4f}")
ex-sp-ch21-03
EasyGenerate Ricean fading samples for dB and plot the envelope distributions.
Implementation
for K_dB in [0, 5, 10]:
K = 10**(K_dB/10)
h = np.sqrt(K/(K+1)) + np.sqrt(1/(K+1)) * (rng.standard_normal(N) + 1j*rng.standard_normal(N)) / np.sqrt(2)
ex-sp-ch21-04
EasyCompute the maximum Doppler frequency for a mobile at 120 km/h at carrier frequencies of 900 MHz, 2.1 GHz, and 28 GHz.
Implementation
v = 120 / 3.6 # m/s
for fc in [900e6, 2.1e9, 28e9]:
fd = v * fc / 3e8
Tc = 0.423 / fd
print(f"fc={fc/1e9:.1f} GHz: fd={fd:.1f} Hz, Tc={Tc*1e3:.2f} ms")
ex-sp-ch21-05
EasyBuild a exponential correlation matrix with
and verify it is positive definite using np.linalg.eigvalsh.
Implementation
rho = 0.8
R = rho ** np.abs(np.arange(4)[:,None] - np.arange(4)[None,:])
eigvals = np.linalg.eigvalsh(R)
print(f"Eigenvalues: {eigvals}")
print(f"All positive: {np.all(eigvals > 0)}")
ex-sp-ch21-06
MediumSimulate BPSK BER over Rayleigh fading for - dB and compare with the closed-form .
Implementation
# See code supplement ch21/python/fading_ber.py
ex-sp-ch21-07
MediumGenerate time-correlated Rayleigh fading using the spectral shaping method (filter white noise with Jakes spectrum). Verify the autocorrelation matches .
Implementation
# See code supplement ch21/python/jakes_model.py
ex-sp-ch21-08
MediumGenerate correlated MIMO channels using the Kronecker model with configuration and . Compute the ergodic capacity at SNR = 10 dB.
Implementation
Nr, Nt = 4, 4
snr = 10 # linear
N_ch = 1000
caps = []
for _ in range(N_ch):
H = kronecker_mimo(Nr, Nt, Rr, Rt)
C = np.log2(np.real(np.linalg.det(np.eye(Nr) + snr/Nt * H @ H.conj().T)))
caps.append(C)
print(f"Ergodic capacity: {np.mean(caps):.2f} bps/Hz")
ex-sp-ch21-09
MediumImplement the 3GPP UMa path loss model (LOS and NLOS) and plot coverage probability vs distance for a 43 dBm transmitter at 3.5 GHz.
Implementation
# See code supplement ch21/python/path_loss_models.py
ex-sp-ch21-10
MediumGenerate a spatially correlated shadow fading map using the FFT-based method with decorrelation distance 50 m. Plot the resulting heatmap.
Implementation
# See code supplement ch21/python/shadow_fading.py
ex-sp-ch21-11
HardImplement the Weichselberger (virtual channel) model as an alternative to Kronecker. Compare capacity distributions for the two models.
Approach
The Weichselberger model uses H = Ur @ (Omega .* Hw) @ Ut.H where
Ur, Ut are eigenvectors of Rr, Rt and Omega is a coupling matrix.
ex-sp-ch21-12
HardEstimate the Ricean -factor from 10000 channel samples using both the moment method and the MLE method. Compare accuracy.
Approach
The moment method uses .
MLE fits the Rice distribution via scipy.stats.rice.fit.
ex-sp-ch21-13
HardSimulate a wideband channel with 3GPP TDL-A model. Compute the frequency response and verify the coherence bandwidth matches .
Implementation
# Compute frequency response via FFT of the impulse response
ex-sp-ch21-14
HardImplement 2-branch MRC diversity over Rayleigh fading. Verify that the BER slope changes from to .
Approach
Generate two independent fading coefficients . MRC combining: , then decide based on .
ex-sp-ch21-15
ChallengeImplement a complete 3GPP CDL-A (Clustered Delay Line) channel model with proper angle-of-arrival generation, per-cluster Doppler shifts, and antenna array response.
Approach
See 3GPP TR 38.901 Section 7.5 for the full CDL generation procedure.
ex-sp-ch21-16
ChallengeBuild a geometry-based stochastic channel model (GBSM) for a vehicular scenario with scatterers placed around the TX and RX. Generate time-varying channels and compare statistics with the Clarke-Jakes model.
Approach
Place scatterers on rings around TX/RX, compute path delays and Doppler shifts from geometry, then sum contributions coherently.