Why Biopotentials Are So Hard to Clean Up: sEMG Conduction Velocity, EEG Alpha & Z-Plane ECG Filters
Breaking through integer-sample delay quantization to track 4.1 m/s muscle action potentials, measuring the 45 ms electromechanical delay between EMG and torque, taming EEG periodogram variance with Welch windows, and placing Z-plane poles and zeros by hand.
Ahmed Ahmed
MEng Molecular Bioengineering, Imperial College London
Why Biopotentials Are the Hardest Signals to Clean Up
When you first study digital signal processing on textbook synthetic sine waves, filtering feels almost trivial: take an FFT, pick a cutoff frequency, and multiply. The moment you connect actual electrodes to a human being, however, every assumption of stationary linear time-invariant (LTI) signal processing gets tested at once.
Across four biomedical signal processing modules at Imperial College London, I worked through the full hierarchy of clinical surface recordings in MATLAB: high-density surface electromyography (sEMG) on contracting skeletal muscle, occipital electroencephalography (EEG) during visual cortex Alpha blocking, and electrocardiography (ECG) corrupted by respiration baseline wander and power-line interference. This article brings together the story of how I built each signal processing pipeline, why naive textbook estimators failed on the raw recordings, and how those lessons later fed directly into the DSP engine I wrote for MYOWAVE.
1. Tracking an Action Potential Moving at 4 Metres per Second (sEMG Delay & MFCV)
Our first problem looked deceptively simple: given two bipolar surface EMG channels and spaced a known distance apart along a muscle belly (moving away from the neuromuscular innervation zone toward the tendon), how fast is the depolarisation wave travelling along the muscle fibres?
Clinically, Muscle Fibre Conduction Velocity () is a sensitive biomarker for peripheral neuropathy, muscular dystrophy, and localised muscle fatigue (where lactic acid accumulation slows sarcolemmal sodium-channel kinetics). If signal is simply a delayed, noisy copy of shifted by propagation time :
then in discrete time we want to find the sample shift that minimises the Mean Squared Error () between the two waveforms:
Writing out that algebraic expansion in MATLAB was a neat "aha" moment: minimising the squared amplitude difference is mathematically identical to maximising the discrete cross-correlation when the channel powers are stationary.
The Sub-Sample Quantisation Trap
Here is the catch we ran into when we actually plugged in physical distances: if two electrodes sit apart and action potentials travel along skeletal muscle at roughly , the true propagation delay is only . At a sampling rate (), an integer lag search can only return () or (), which is a huge velocity quantization error!
To break through the integer-sample ceiling without upsampling the entire recording by , we can either fit a three-point vertex parabola across the discrete minimum () or move into the Fourier domain using the phase-shift property , where is the continuous linear slope of the cross-spectral phase angle .
2. Why Your Muscle Lags Behind Your Nervous System (EMG Envelopes vs Isometric Torque)
In prosthetic control and biomechanics, you want to predict how much mechanical force a muscle is generating simply by reading its surface EMG voltage. However, a raw sEMG trace is a zero-mean bipolar interference pattern, if you average the raw voltage over a window, positive and negative phases cancel out to zero regardless of how hard the subject is contracting!
To extract an amplitude envelope proportional to motor-unit recruitment and rate coding, we full-wave rectified the signal () and passed it through zero-phase low-pass Butterworth filters across progressively tighter cutoff frequencies ():
Overlaying our rectified sEMG envelope against the physical load-cell torque curve revealed two fascinating physiological facts:
- The Bandwidth-Latency Trade-off in Myoelectric Prosthetics: A envelope reacts rapidly when the subject starts contracting, but leaves spiky motor-unit firing ripples that would make a prosthetic hand jitter. Dropping the cutoff to produces a silky-smooth force estimate, but if you use a causal single-pass filter in real time, the filter group delay makes the prosthetic feel sluggish.
- Electromechanical Delay (): Even when using a zero-phase (
filtfilt) envelope, the electrical sEMG spike consistently rises roughly before the mechanical torque transducer registers tension! That gap is the real physical time required for action potentials to travel down T-tubules, trigger dihydropyridine/ryanodine release from the sarcoplasmic reticulum, cycle acto-myosin cross-bridges, and pull the slack out of the series elastic tendon.
3. Taming Spectral Variance in Cortical EEG Alpha Rhythms (Welch PSD)
In our third study, we examined occipital EEG recordings captured while a subject sat quietly with their eyes closed versus eyes open. When visual input is removed, thalamocortical feedback loops synchronise millions of pyramidal neurons in the primary visual cortex into a coherent Alpha oscillation (the Berger effect).
When I first computed a standard raw FFT periodogram across the recording, the spectrum looked like a forest of jagged noise spikes. The reason is a classic statistical pitfall: the raw periodogram is an inconsistent estimator. Because each frequency bin is the sum of squared Gaussian random variables (a distribution), the standard deviation of the periodogram at every frequency is equal to of the mean power itself, and taking a longer recording only packs more noisy frequency bins closer together without reducing the vertical variance!
Switching to Welch's averaged modified periodogram, slicing the EEG trace into overlapping segments of length , tapering each segment with a smooth Hann window to suppress sidelobe spectral leakage, and averaging their periodograms, cuts the estimator variance by roughly :
With the variance suppressed, the occipital Alpha peak stood out unmistakably above the cortical background noise.
4. Placing Poles and Zeros by Hand on the Complex Z-Plane (ECG Filtering)
In our final study, we were handed a clinical ECG trace that was almost unreadable: heavy mains hum blurred the baseline into a thick ribbon, while slow respiratory motion swung the trace up and down across several millivolts.
Rather than calling a black-box filter wizard, we designed a custom Infinite Impulse Response (IIR) pole-zero filter directly on the complex -plane. The intuition behind pole-zero placement is wonderfully geometric when you view the frequency response as the ratio of distances from a point moving around the unit circle to the zeros and poles :
- To completely extinguish interference (and DC drift at ), you drop conjugate transmission zeros directly onto the unit circle at angle (and ), forcing the numerator of to vanish to zero.
- If you only place zeros, however, the trench around is wide and dull, chewing away legitimate QRS complex energy. To make the notch razor-sharp while keeping the system causally BIBO-stable, you place conjugate poles just inside the unit circle along the same radial angle at radius (, with ):
Limitations and Real-World Clinical Considerations
Working across all four biosignal modalities highlighted why naive digital filters can actually cause misdiagnoses if applied carelessly:
- Causal IIR Phase Distortion vs ST-Segment Elevation: Near a high-Q pole-zero notch or a steep high-pass cutoff (), the phase response of a causal single-pass IIR filter becomes strongly non-linear. On an ECG, non-linear phase delay shifts the low-frequency T wave relative to the high-frequency QRS complex, creating artificial ST-segment depression or elevation that mimics myocardial ischaemia! In offline analysis (and buffered sliding windows), running zero-phase forward-backward filtering (
filtfilt) cancels the phase angle identically (), preserving clinical ST morphology. - Non-Stationarity During Muscle Fatigue and Seizures: Welch's PSD assumes the signal is wide-sense stationary over the averaging window. When a muscle fatigues during a sustained contraction (shifting median sEMG power toward lower frequencies) or when a cortical EEG transitions suddenly into a transient spike-and-wave burst, time-averaging smears the transition. Extending these pipelines with Continuous Wavelet Transforms (CWT, Morlet wavelets) or Short-Time Fourier Transform (STFT) spectrograms captures joint time-frequency evolution without sacrificing transient localisation.