Exercises

ex-sp-ch15-01

Easy

Create a simple sinusoid plot using the OO API. Plot y=sin⁑(2Ο€β‹…5t)y = \sin(2\pi \cdot 5t) for t∈[0,1]t \in [0, 1] with a blue line, labeled axes, and a title. Save as PDF.

ex-sp-ch15-02

Easy

Plot a scatter diagram of 500 complex Gaussian samples z∼CN(0,1)z \sim \mathcal{CN}(0, 1) in the I-Q plane with equal aspect ratio.

ex-sp-ch15-03

Easy

Display a 10Γ—1010 \times 10 random matrix as a heatmap using imshow with the viridis colormap and a colorbar.

ex-sp-ch15-04

Easy

Create a 2Γ—22 \times 2 grid of subplots with sharex=True and plot a different frequency sinusoid in each panel.

ex-sp-ch15-05

Easy

Plot a magnitude/phase Bode plot for the transfer function H(z)=1βˆ’0.9zβˆ’11βˆ’0.5zβˆ’1H(z) = \frac{1 - 0.9z^{-1}}{1 - 0.5z^{-1}} using scipy.signal.freqz.

ex-sp-ch15-06

Medium

Create a BER curve comparison for BPSK, QPSK, 16-QAM, and 64-QAM with theoretical curves, simulated points with error bars, and a legend. Use IEEE single-column formatting (3.5 in wide, 8pt font).

ex-sp-ch15-07

Medium

Build a GridSpec figure with three panels: (a) a wide spectrogram on top, (b) time-domain signal on the bottom-left, and (c) power spectral density on the bottom-right. Add (a), (b), (c) labels.

ex-sp-ch15-08

Medium

Write a reusable function plot_constellation(symbols, ax=None, **kwargs) that plots a constellation diagram with decision boundaries for QPSK (lines at I=0 and Q=0).

ex-sp-ch15-09

Medium

Implement HSV phase coloring for the complex function f(z)=z3βˆ’1z2+1f(z) = \frac{z^3 - 1}{z^2 + 1} on the domain [βˆ’3,3]Γ—[βˆ’3,3][-3, 3] \times [-3, 3]. Zeros should appear as spots where all hues meet; poles as dark regions.

ex-sp-ch15-10

Medium

Plot a channel impulse response using ax.stem() with proper formatting: sample indices on x-axis, magnitude on y-axis, with an inset zoom on the main tap cluster.

ex-sp-ch15-11

Hard

Create a 4-panel figure showing QPSK transmission through a multipath channel: (a) transmitted constellation, (b) channel impulse response, (c) received constellation (before equalization), (d) received constellation (after ZF equalization).

ex-sp-ch15-12

Hard

Build a custom Matplotlib style file (.mplstyle) for your research group with specific colors, fonts, line widths, and grid settings. Demonstrate loading it with plt.style.use().

ex-sp-ch15-13

Hard

Create a figure with a main BER plot and two inset panels: one showing the constellation at low SNR and another at high SNR. Connect each inset to the corresponding SNR point on the main curve.

ex-sp-ch15-14

Challenge

Build a complete "figure factory" class that generates IEEE-formatted figures from simulation result dictionaries. It should support BER curves, constellation diagrams, spectrograms, and multi-panel layouts with a consistent style.

ex-sp-ch15-15

Challenge

Reproduce Figure 1 from a published IEEE paper of your choice using only Matplotlib. Match fonts, colors, line styles, and annotations as closely as possible. Document the rcParams you used.