Signals, Systems and DSP: Introduction
A vibration sensor on a pump produces a voltage. Somewhere in that voltage is the answer to "is the bearing failing?", mixed with mains hum, electrical noise, the pump's own rotation and the sensor's resonance. An engineer turns the voltage into a decision in a few steps: model the sensor and the electronics as systems, sample the signal without corrupting it, look at its spectrum, design a filter that keeps what matters and rejects the rest, and run it in real time on a small processor. This course teaches those steps the way a practising engineer uses them, with Python (NumPy and scipy.signal) in every lesson.
By the end you should reach the milestone of the roadmap stage this course follows: analyse a measured signal and design a filter to meet explicit performance requirements, then verify that it does.
Where this course starts
The mathematics of Fourier series and transforms, convolution, sampling and the DFT is taught in the Mathematics course Signals and Fourier Analysis. This course links to it for the theory and spends its time on engineering: units, specifications, design trade-offs, implementation and measurement. From Circuit Theory you need phasors, frequency response and Bode plots and Laplace-domain analysis. Analog filters built with op-amps are in Analog Electronics, and the instrument side of sampling (DAQ cards, ENOB, scope FFTs) is in Measurements. Where a topic is covered there, this course links instead of repeating it.
The course map
| Section | You will be able to | Labs and tools |
|---|---|---|
| Getting started | classify signals, compute energy, power and rms, decompose and transform elementary signals | NumPy, figures |
| Systems and convolution | test linearity, time invariance, causality and stability; convolve; run difference equations; read frequency response and group delay | ee-op-amp, ee-netlist, ee-rc-rl-transient, lfilter, freqz |
| Transforms for systems | use and , poles and zeros, stability in both planes; design a notch by placing poles and zeros | ee-bode-plot, scipy.signal, python-control |
| Sampling and conversion | choose a sampling rate, specify an anti-alias filter, understand reconstruction, sinc droop and quantisation | ee-sampling-aliasing, NumPy |
| DFT and spectral analysis | scale an FFT to volts, choose windows, separate resolution from bin spacing, estimate noise spectra and spectrograms | fft, welch, spectrogram |
| FIR and IIR filters | write a filter specification and meet it with windowed, equiripple and IIR designs in second-order sections | firwin, remez, butter/cheby1/ellip, ee-bode-plot |
| Implementation | pick a filter structure, handle fixed point and limit cycles, budget latency and processor load | sosfilt, NumPy fixed-point models |
| Multirate and advanced filtering | decimate and interpolate, use polyphase and CIC filters, correlate, detect with matched filters, adapt with LMS | resample_poly, correlate, NumPy |
| Applications | modulate and demodulate, build audio, sensor and data-link chains against requirements | everything above |
Conventions used throughout
| Symbol | Meaning | Unit |
|---|---|---|
| frequency | Hz | |
| angular frequency (continuous time) | rad/s | |
| , | sampling rate, sampling period | Sa/s (Hz), s |
| discrete-time frequency | rad/sample | |
| , | continuous- and discrete-time signals | V (or the sensor's unit) |
| , | impulse response | 1/s, dimensionless |
| , , | transfer functions, frequency response | — |
| dB | of an amplitude ratio, of a power ratio | — |
SciPy's filter functions accept fs= so you can work in hertz; the lessons always pass it. Coefficient arrays follow SciPy: b (numerator, feed-forward) and a (denominator, feedback, a[0] = 1).
A first look: the whole chain in twenty lines
Given: a vibration of amplitude, plus hum of and white noise of rms, sampled at for .
Find: the components in the spectrum, then their amplitudes after a band-pass filter from to .
Solve: an FFT of a 2-second record has bins every , so both tones fall exactly on bins; a 4th-order Butterworth band-pass passes almost untouched and attenuates strongly. The program does both and prints the amplitudes:
import numpy as np
from scipy.signal import butter, sosfiltfilt, sosfreqz
fs, T = 2000.0, 2.0
t = np.arange(int(fs * T)) / fs
rng = np.random.default_rng(0)
x = 0.5 * np.sin(2 * np.pi * 120 * t) + 0.2 * np.sin(2 * np.pi * 50 * t) + 0.3 * rng.standard_normal(len(t))
def amplitude(sig, f): # single-sided amplitude at one bin (whole periods, no window)
X = np.fft.rfft(sig) / len(sig) * 2
return abs(X[int(round(f * T))])
sos = butter(4, [100, 140], btype="bandpass", fs=fs, output="sos")
y = sosfiltfilt(sos, x) # zero-phase, offline
_, H = sosfreqz(sos, worN=[50.0, 120.0], fs=fs)
print(f"bin spacing {1 / T:.1f} Hz")
print(f"before: 50 Hz {amplitude(x, 50):.3f} V, 120 Hz {amplitude(x, 120):.3f} V, noise rms {0.3:.2f} V")
print(f"filter gain: 50 Hz {20 * np.log10(abs(H[0])):.1f} dB, 120 Hz {20 * np.log10(abs(H[1])):.2f} dB (single pass)")
print(f"after : 50 Hz {amplitude(y, 50):.4f} V, 120 Hz {amplitude(y, 120):.3f} V, residual rms {np.std(y - 0.5 * np.sin(2 * np.pi * 120 * t)):.3f} V")bin spacing 0.5 Hz
before: 50 Hz 0.207 V, 120 Hz 0.500 V, noise rms 0.30 V
filter gain: 50 Hz -60.5 dB, 120 Hz -0.00 dB (single pass)
after : 50 Hz 0.0010 V, 120 Hz 0.498 V, residual rms 0.063 V
Check: the noise left after filtering should be the part inside the passband: a wide band out of keeps about of the rms, , as printed. Each line of that program is a lesson of this course: sampling, the FFT and its scaling, filter design in second-order sections, zero-phase filtering, and checking the result against a requirement.
Simulations and labs
Interactive labs appear next to the text that explains them. The sampling lab, for instance, shows a sine sampled at reappearing at ; slide past and watch the alias fold:
Every lesson's guided lab follows the same pattern: a hand calculation, a simulation you can run here, and "what you would measure" on a real bench, with expected readings and their uncertainty.
Safety
Hands-on work in this course uses only low-voltage, current-limited or battery- and USB-powered equipment: function generators, oscilloscopes, USB audio interfaces, microcontroller boards and bench supplies set to at most DC with a current limit. Never connect a circuit, an ADC or a computer input to the mains to "measure real hum": use a generator to simulate it. Each lab lists its own hazards and the safe setup.
How to use this course
Read a lesson, run its examples (change the numbers: every example runs in your browser in a few seconds), try the practice problems before opening the answers, and take the quizzes. The Exercises lesson covers the whole course, and the Mini Project asks you to analyse a measured signal and design, verify and document a filter that meets a written specification.
Test yourself
The discrete-time frequency of a 1 kHz tone sampled at 8 kSa/s is
- rad/sample
- rad/sample
- rad/sample
- rad/s
An amplitude ratio of 0.01 is
- dB
- dB
- dB
- dB
A 2-second record sampled at 2 kSa/s gives FFT bins spaced by
- 2000 Hz
- 1 Hz
- 0.5 Hz
- 4000 Hz
To check a filter against hum in the lab, you should
- connect the board to the mains
- simulate the hum with a function generator
- touch the input with a finger
- use a mains transformer secondary