TExcelTAD
Home › Signals, Systems & Digital Filters for Engineers › Signals, Systems and DSP: Introduction

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 H(s)H(s) and H(z)H(z), 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
ff frequency Hz
ω=2πf\omega = 2\pi f angular frequency (continuous time) rad/s
fsf_s, Ts=1/fsT_s = 1/f_s sampling rate, sampling period Sa/s (Hz), s
Ω=2πf/fs\Omega = 2\pi f/f_s discrete-time frequency rad/sample
x(t)x(t), x[n]x[n] continuous- and discrete-time signals V (or the sensor's unit)
h(t)h(t), h[n]h[n] impulse response 1/s, dimensionless
H(s)H(s), H(z)H(z), H(ejΩ)H(e^{j\Omega}) transfer functions, frequency response —
dB 20log⁡1020\log_{10} of an amplitude ratio, 10log⁡1010\log_{10} 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 120 Hz120\ \text{Hz} vibration of 0.5 V0.5\ \text{V} amplitude, plus 50 Hz50\ \text{Hz} hum of 0.2 V0.2\ \text{V} and white noise of 0.3 V0.3\ \text{V} rms, sampled at fs=2 kSa/sf_s = 2\ \text{kSa/s} for 2 s2\ \text{s}.

Find: the components in the spectrum, then their amplitudes after a band-pass filter from 100100 to 140 Hz140\ \text{Hz}.

Solve: an FFT of a 2-second record has bins every 0.5 Hz0.5\ \text{Hz}, so both tones fall exactly on bins; a 4th-order Butterworth band-pass passes 120 Hz120\ \text{Hz} almost untouched and attenuates 50 Hz50\ \text{Hz} strongly. The program does both and prints the amplitudes:

python · try it yourself
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 40 Hz40\ \text{Hz} wide band out of 1000 Hz1000\ \text{Hz} keeps about 40/1000=0.2\sqrt{40/1000} = 0.2 of the rms, 0.06 V0.06\ \text{V}, 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 7 Hz7\ \text{Hz} sine sampled at 10 Hz10\ \text{Hz} reappearing at 3 Hz3\ \text{Hz}; slide ff past fs/2f_s/2 and watch the alias fold:

-A0+A0.0 s0.2 s0.4 s0.6 s0.8 s1.0 sx (V)input 7.0 Hzreconstructed 3.00 Hzsamples, fs = 10.0 Hz0A0102030405060708090100f (Hz)fs/2faliasaliased: f > fs/2 = 5.00 Hz

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 24 V24\ \text{V} 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 Ω\Omega of a 1 kHz tone sampled at 8 kSa/s is

  1. π/8\pi/8 rad/sample
  2. π/4\pi/4 rad/sample
  3. 10001000 rad/sample
  4. 2π⋅10002\pi \cdot 1000 rad/s

An amplitude ratio of 0.01 is

  1. −20-20 dB
  2. −40-40 dB
  3. −10-10 dB
  4. −100-100 dB

A 2-second record sampled at 2 kSa/s gives FFT bins spaced by

  1. 2000 Hz
  2. 1 Hz
  3. 0.5 Hz
  4. 4000 Hz

To check a filter against hum in the lab, you should

  1. connect the board to the mains
  2. simulate the hum with a function generator
  3. touch the input with a finger
  4. use a mains transformer secondary