Signals and digital signal processing
Sampling, the Nyquist limit, Fourier spectra, convolution and IIR filtering — the toolkit that turns raw sensor waveforms into clean evidence.
Everything in the previous chapters — pixels, video frames, heartbeats — is ultimately a signal: a quantity measured at a sequence of instants. The theory of those measurements is digital signal processing, and it answers questions that come up the moment you touch real sensor data. How fast must I sample? What does "50 Hz noise" mean in the samples? How do I remove the drift without destroying the spike I care about?
The answers are elegant, and the widget lets you apply them to a noisy ECG-like trace immediately.
Time and frequency are two views of one thing
A signal can be described by its value at each time, or by how much of each frequency it contains. They are Fourier transforms of each other and carry the same information. Noise, drift and signal live in different frequency bands, so filtering is the act of hiding the bands you do not want — visible as subtraction in the frequency view.
A noisy ECG-like trace (baseline wander + 50 Hz hum + noise). Move the cutoffs and watch the time trace and its spectrum change.
time domain
grey: raw · accent: filtered
magnitude spectrum (0–125 Hz)
Genuine one-pole IIR filters and an IIR notch, with a direct DFT for the spectrum. The high-pass removes the slow baseline drift, the low-pass removes wideband noise, the notch removes mains hum — the standard ECG/EEG preprocessing chain.
Sampling and the Nyquist limit
Sampling a continuous signal at rate produces . The sampling theorem says you can reconstruct exactly only if it contains no frequency above the Nyquist frequency . Higher frequencies do not disappear; they alias — fold down to a lower apparent frequency that is impossible to distinguish from a genuine one. This is why every acquisition chain places an analogue anti-aliasing filter before the ADC.
The DFT, the FFT and the convolution theorem
For samples, the discrete Fourier transform is
with bin corresponding to frequency . The fast Fourier transform computes all of them in instead of . The convolution theorem then says that convolving in time is multiplying in frequency:
Filtering, therefore, is either a convolution in time (FIR) or, equivalently, a mask on the spectrum.
FIR and IIR filters
- FIR filters compute a weighted moving average of past inputs; they are inherently stable and can have exactly linear phase, which preserves waveform shape — important for ECG.
- IIR filters feed back previous outputs, achieving sharp frequency selectivity at low order. A one-pole high-pass with time constant uses coefficient and update ; a one-pole low-pass uses and .
The standard biosignal chain is exactly what the widget applies: a high-pass to remove baseline wander (below ~0.5 Hz), a low-pass to remove wideband noise above the band of interest, and a narrow notch at 50 or 60 Hz to remove mains hum.
Filtering can destroy the evidence
An over-aggressive high-pass will flatten the ST segment of an ECG and fake a diagnosis; a low-pass set too low will smear the QRS complex. Filter settings are part of the measurement, not neutral plumbing — in clinical devices they are specified, validated and reported. Always check that the feature you care about survives the filter.
Illustrative vs real
The widget runs genuine one-pole IIR high/low-pass filters and a biquad notch, with a direct DFT for the spectra, on a synthetic ECG-like waveform. Real devices use higher-order Butterworth/Chebyshev designs, careful fixed-point arithmetic, and often zero-phase forward–backward filtering offline. The sampling, spectral and filtering reasoning above is exactly standard DSP.
Check yourself
Eduspheria wiki · Applied AI, Signals and images
0 / 5 answered
From the assignment paper
Modeled on NITJ AI-604, Assignment/Quiz
0 / 5 answered
Where next: with DSP understood, the last lesson learns the filters — 1-D convolutional networks that classify waveforms end to end.