Signals and DSP Exercises
These exercises cover the whole course in its order. Work each one by hand first, with units on every number, then check it with a few lines of Python (the program at the end checks several answers at once). Each answer links back to the lesson to revisit.
Signals and systems
1. Power and rms. A sensor output is . What is its rms value, and what power does it deliver into ?
Answer
, ; into : . Review: Signal Classes.
2. Discrete periodicity. A tone is sampled at . After how many samples do the samples repeat?
Answer
: every 16 samples (3 cycles). Review: Signal Classes.
3. Properties. Classify .
Answer
Non-linear (doubling quadruples ), time invariant, causal, stable (bounded inputs give bounded products), with memory. Review: System Properties.
4. Convolution. Convolve with and check with the sum rule.
Answer
; sums: . Review: Discrete Convolution.
5. A pulse through an RC. A pulse lasting drives an RC low-pass with . What is the peak output?
Answer
at the end of the pulse. Review: Continuous-Time Convolution.
6. Discretising an RC. An RC with is imitated at . Give the exact (zero-order-hold) and forward-Euler poles.
Answer
and . Review: Difference Equations.
7. Moving average. A 10-sample average runs at . Where are its nulls and what is its delay?
Answer
At multiples of ; samples . Review: Frequency Response.
Transforms
8. Second-order system. . Find , , the DC gain, the step overshoot and .
Answer
, so ; DC gain ; overshoot ; . Review: Laplace for Systems.
9. A DC blocker. . What are its DC and Nyquist gains? What kind of filter is it?
Answer
, : a high-pass (DC blocker) with its pole at . Review: The z-Transform.
10. Notch design. Design a notch at with poles at . Give the denominator and the approximate notch width.
Answer
; ; width . Review: Poles and Zeros in z.
Sampling and conversion
11. Where does it land? A interferer reaches an ADC sampling at whose band of interest is to . Where does it appear?
Answer
, inside the band: it must be removed before sampling. Review: The Sampling Theorem.
12. Anti-alias attenuation. A 4th-order Butterworth low-pass at precedes an ADC. Estimate its attenuation at .
Answer
( asymptotically): a interferer becomes about . Review: Anti-Alias Filters.
13. Sinc droop. A zero-order-hold DAC runs at . What is its droop at ?
Answer
. Review: Reconstruction and DACs.
14. Quantisation. A 16-bit converter digitises a sine at . What is its signal-to-quantisation-noise ratio?
Answer
. Review: Quantisation.
DFT and spectral analysis
15. Bins. samples at . What is the bin spacing, and which bin holds ? How do you scale rfft to get the amplitude of a sine?
Answer
; bin 50; multiply by (not for DC or Nyquist). Review: The DFT and FFT.
16. Windows. Which window would you choose to measure the amplitude of a tone between bins to , and which to find a weak tone close to a strong one?
Answer
Flat-top (scalloping about ); a low-sidelobe window such as Hann or Blackman–Harris for the weak neighbour (the rectangular window's skirts hide it). Review: Leakage and Windows.
17. Resolution. Two tones are apart. Does zero padding a record help separate them? What record length is needed with a Hann window?
Answer
No: padding interpolates the same blurred spectrum. Resolution needs of roughly for Hann; the lesson's tones are resolved from . Review: Resolution and Zero Padding.
18. Noise density. White noise of rms is sampled at . What is its one-sided density, and the noise in a band?
Answer
; . Review: Spectral Estimation.
19. STFT frame. Why can't one frame length show both the exact frequency of a chirp and the exact time of a short burst?
Answer
A frame of length gives frequency resolution of order and time resolution of order : long frames sharpen frequency and smear time, short frames the reverse. Review: Spectrograms.
Filter design
20. Specification. Convert and into and .
Answer
, . Review: Filter Specifications.
21. FIR methods. For the mask , pass to (1 dB), stop from (60 dB), the Kaiser window needs 60 taps and Parks–McClellan 36. Why the difference, and what is the delay of each?
Answer
The window method's ripple is set by the stopband and is wasted in the passband; equiripple spreads the error evenly to the limits. Delays : samples and samples . Review: FIR Window Design, Equiripple FIR.
22. IIR orders. For the same mask, Butterworth needs order 16, Chebyshev 8 and elliptic 6. Name one reason to choose each anyway.
Answer
Butterworth: maximally flat, gentle phase; Chebyshev I: fewer poles with a flat stopband; elliptic: the lowest order (cost), when ripple in both bands is acceptable. Review: Analog Prototypes.
23. Pre-warping. A bilinear-transform design needs a cutoff at . What analog cutoff must the prototype have?
Answer
. Review: The Bilinear Transform.
24. Why biquads? An 8th-order elliptic low-pass at , , has its largest pole at radius . What happens if its single 8th-order denominator is rounded to 16 fractional bits, and how do second-order sections avoid it?
Answer
The poles of a high-order polynomial are very sensitive to coefficient errors: the rounded polynomial has a pole at radius (unstable). Each biquad's poles depend only on its own two coefficients, so rounding moves them slightly and they stay inside. Review: Biquads and SOS.
Implementation and multirate
25. Fixed point. A Q15 accumulator receives . What does it hold with wrap-around, and with saturation?
Answer
with wrap-around; with saturation. Review: Filter Structures and Fixed Point.
26. Latency budget. Audio at is processed in 64-sample blocks with ping-pong buffers. Which part of the latency does the block size set, and how do you reduce it?
Answer
Ping-pong buffering costs at least two blocks, ; the converters' delays and the filter's own group delay come on top ( in total for the lesson's example with a 129-tap FIR). Smaller blocks cut the buffering at the price of more interrupts per second. Review: Real-Time DSP.
27. Decimation. Why must a signal be low-pass filtered before keeping every third sample at , and what does a polyphase decimator save?
Answer
Anything above the new Nyquist frequency () aliases (a tone lands at ). A polyphase structure computes only the outputs that are kept, a factor of 3 fewer multiplications. Review: Multirate.
28. CIC word length. A CIC decimator with , stages takes 12-bit input. What is its DC gain and the register width it needs?
Answer
; registers of bits, and two's-complement wrap-around in the integrators is then harmless. Review: CIC Filters.
Advanced filtering and applications
29. Delay estimation. Two microphone channels at correlate best at a lag of 12 samples. What path difference is that at ?
Answer
. Review: Correlation and Matched Filtering.
30. LMS step. A 16-tap LMS filter sees white input with . Give the stability bound and the weights' time constant for .
Answer
; time constant samples. Review: Adaptive Filters.
31. FM bandwidth. A tone frequency-modulates a carrier with deviation. What is and the Carson bandwidth?
Answer
; . Review: Modulation.
32. Requirements. A design meets its mask in floating point with to spare and will run with 16-bit coefficients. What should you check before signing it off?
Answer
Re-check the mask with quantised coefficients (the mini project's designs lose up to about of stopband attenuation), the pole radii, internal overflow and scaling, limit cycles, the processor load and the latency. Review: Applications, Mini Project.
Check several answers in Python
import numpy as np
from scipy.signal import freqz, butter
print(f"1. rms {np.sqrt(2**2 + 3**2 / 2):.3f} V, power {1e3 * 8.5 / 600:.2f} mW")
print(f"5. peak {4 * (1 - np.exp(-0.5)):.3f} V")
print(f"8. overshoot {100 * np.exp(-np.pi * 0.1 / np.sqrt(1 - 0.01)):.1f} %")
_, H = freqz([1, -1], [1, -0.9], worN=[0.0, 0.5], fs=1.0)
print(f"9. |H| at DC {abs(H[0]):.3f}, at Nyquist {abs(H[1]):.4f}")
W0 = 2 * np.pi * 60 / 1000
print(f"10. a = [1, {-2 * 0.99 * np.cos(W0):.4f}, {0.99**2:.4f}], width {(1 - 0.99) * 1000 / np.pi:.2f} Hz")
print(f"12. attenuation {10 * np.log10(1 + (7.3 / 2) ** 8):.1f} dB")
print(f"13. droop {20 * np.log10(np.sinc(20 / 48)):.2f} dB")
print(f"23. pre-warped cutoff {8000 / np.pi * np.tan(np.pi * 1000 / 8000):.1f} Hz")
b, a = butter(1, 1000, fs=8000)
_, H = freqz(b, a, worN=[1000.0], fs=8000)
print(f" check: butter(1, 1000, fs=8000) gives {20 * np.log10(abs(H[0])):.2f} dB at 1 kHz")
print(f"28. CIC gain {16**4}, register bits {12 + int(np.log2(16**4))}")
print(f"29. path difference {100 * 12 / 48000 * 343:.2f} cm")1. rms 2.915 V, power 14.17 mW
5. peak 1.574 V
8. overshoot 72.9 %
9. |H| at DC 0.000, at Nyquist 1.0526
10. a = [1, -1.8410, 0.9801], width 3.18 Hz
12. attenuation 45.0 dB
13. droop -2.64 dB
23. pre-warped cutoff 1054.8 Hz
check: butter(1, 1000, fs=8000) gives -3.01 dB at 1 kHz
28. CIC gain 65536, register bits 28
29. path difference 8.58 cm
Test yourself
Which change improves the frequency resolution of an FFT analysis?
- zero padding
- a longer record
- a higher sampling rate with the same N
- a flat-top window
A filter must keep pulse shapes intact. Which design fits?
- elliptic IIR
- symmetric FIR (linear phase)
- Chebyshev I IIR
- a single-pole smoother
The best order of operations for an ADC channel with out-of-band interference is
- sample, then filter digitally
- analog anti-alias filter, then sample, then digital filtering and decimation
- decimate, then anti-alias filter
- quantise, then filter in analog
Why are high-order IIR filters implemented as cascades of biquads?
- fewer coefficients
- their poles are far less sensitive to coefficient rounding
- they have linear phase
- they need no state