S15 · Lesson 18 · EEG, EMG and processing biopotentials
The amplitudes and bandwidths of the ECG, EEG and EMG, EEG rhythms, choosing sample rates and converter resolution, high-pass corners and baseline wander, notch filters, ensemble averaging of evoked potentials, and detecting QRS complexes
The brain's electrical activity reaches the scalp at tens of microvolts, filtered and smeared by the skull. Muscles produce millivolt bursts with energy up to several hundred hertz. A visual or auditory stimulus evokes a brain response of a microvolt or less, completely hidden in the ongoing EEG. Each signal sets different demands on the front end and on the processing after it, and the tools come straight from C9 and S7: anti-aliasing and sampling, high-pass and notch filters, and the averaging that pulls a repeatable response out of noise.
- A 2 µV evoked response buried in 20 µV of background EEG, after averaging N repetitions time-locked to the stimulus.
- The response adds coherently while the background, uncorrelated from sweep to sweep, grows only as √N, so the noise in the average falls as .
- Four times the sweeps halves the noise.
Predict
An evoked potential of 1 µV sits in 20 µV (RMS) of background EEG. How many stimulus repetitions must be averaged to reach a signal-to-noise ratio of 5?
Before averaging the ratio is 1/20 = 0.05. Averaging N sweeps raises it by √N, so reaching 5 needs √N = 100, or N = 10,000. At a few stimuli per second, that's about an hour, which is why evoked-potential tests use fast stimulus rates and the largest responses available.
Name it
The signals
| Signal | Typical amplitude | Bandwidth |
|---|---|---|
| ECG | 0.5 to 4 mV | 0.05 to 150 Hz (diagnostic) |
| EEG | 5 to 300 µV | 0.5 to about 100 Hz |
| Surface EMG | 0.1 to 5 mV | about 20 to 500 Hz |
| Evoked potentials | 0.1 to 10 µV | depends on the test |
EEG rhythms are named by band: delta below 4 Hz, theta 4 to 8, alpha 8 to 13 (eyes closed, relaxed), beta 13 to 30, gamma above.
Sampling and resolution
Sample at least twice the highest frequency kept, with an anti-aliasing filter below half the sample rate (C9): 500 samples/s is common for diagnostic ECG. Modern front ends use 24-bit delta-sigma converters, whose step over ±2.5 V is 0.3 µV, fine enough to skip most analog gain. A recorder's raw data rate is channels × sample rate × bits.
Filters
- High-pass filters remove electrode offset and the slow baseline wander from breathing and movement. A first-order corner has time constant and adds phase lead , which distorts the ST segment; diagnostic ECG therefore uses 0.05 Hz, or a linear-phase digital filter.
- Notch filters at 50 or 60 Hz remove residual line interference; a notch with quality factor Q removes a band about wide, and distorts any signal energy inside it.
Ensemble averaging
For a response that repeats identically after each stimulus, averaging N sweeps keeps the response and reduces uncorrelated noise by : .
QRS detection
Heart-rate monitors find each beat with algorithms like Pan and Tompkins': a 5 to 15 Hz band-pass that favors the QRS over P and T waves, a derivative for slope, squaring, a moving-window integral about 150 ms long, and an adaptive threshold.
Worked example
A 64-channel EEG system samples at 1000 per second with 24-bit converters spanning ±2.5 V. What's its step size and its raw data rate?
Show the solution
- Step size. The ±2.5 V span is 5 V: about a hundredth of the smallest EEG.
- Raw data rate. about 0.7 GB per hour.
Answer the step is 0.298 µV, and the raw data rate is 1.536 Mbit/s, about 0.7 GB an hour.
Worked example
What time constant does a 0.05 Hz high-pass have, and how much phase lead does it give a 1 Hz component? How wide is a 60 Hz notch with Q = 30?
Show the solution
- Time constant.
- Phase lead at 1 Hz. small enough to keep slow ECG features intact.
- Notch width. removed around 60 Hz.
Answer the high-pass has τ = 3.18 s and gives 2.9° of lead at 1 Hz, and the notch is about 2 Hz wide.
Worked example
Neural spikes are detected by a threshold at 4 standard deviations of the noise, which is flat from 0 to 5 kHz. How often does noise alone cross the threshold?
Show the solution
- Rice's formula. For band-limited Gaussian noise flat from 0 to B, upward crossings of a level a come at the rate
- At 4σ. With B = 5 kHz, the exponent is −16/2 = −8:
- Against real spikes. A real neuron firing at 10 spikes a second would see about one false spike in ten.
- At 5σ. False crossings fall to 0.011 per second, but small spikes are missed.
- The trade-off. The threshold trades misses against false alarms, as in any detector.
Answer noise alone crosses a 4σ threshold about 0.97 times a second.
Check
A 1 µV evoked response sits in 10 µV RMS of background. How many sweeps must be averaged for a signal-to-noise ratio of 10?
Check
A 16-bit converter spans 2 V. What's its step size?
Write units the way you normally would: 1.5 µV, 1500 nV and 0.0015 mV are the same answer.
Check
A recorder has 64 channels sampled at 250 per second with 24-bit samples. What's its raw data rate?
Write units the way you normally would: 1.5 Mb/s, 1500 kb/s and 0.0015 Gb/s are the same answer.
Check
What's the time constant of a first-order high-pass filter with a 0.5 Hz corner?
Write units the way you normally would: 1.5 s and 1500 ms are the same answer.
Check
A first-order high-pass has its corner at 0.05 Hz. How much phase lead does it give a 1 Hz component?
Check
About how wide a band does a 50 Hz notch with Q = 10 remove?
Write units the way you normally would: 1.5 Hz, 1500 mHz and 0.0015 kHz are the same answer.
Check
A spike detector's noise is Gaussian and flat from 0 to 5000 Hz; its threshold sits at 3 standard deviations.
(a)
How often does noise alone cross the threshold upward?
Write units the way you normally would: 1.5 Hz, 1500 mHz and 0.0015 kHz are the same answer.
(b)
How often does the noise cross zero?
Check
An evoked response of s µV sits in n µV RMS of background, uncorrelated from sweep to sweep.
Step 1
What signal-to-noise ratio do N averaged sweeps give?
Type it the way you would write it, like 3sin(2πft) or 3*sin(2*pi*f*t). Angles can be in radians or carry a degree sign, like 45°.
Step 2
How many sweeps reach a ratio of t?
Explain why
Why does averaging many stimulus-locked sweeps reveal an evoked potential that's invisible in any single sweep?
An evoked potential has the same shape and timing after every stimulus, while the background EEG and other noise are unrelated to the stimulus and differ from sweep to sweep. When N sweeps aligned to the stimulus are added, the evoked response adds coherently and grows N times, but the noise adds like a random walk and grows only √N times, as its variance adds. Dividing by N, the response keeps its size while the noise shrinks by √N, so the signal-to-noise ratio improves by √N. The method fails if the response varies in latency from sweep to sweep, which smears it, or if the noise is itself locked to the stimulus, like a stimulus artifact.
Practice
Keep practicing
10 kinds of problem on this topic, dealt one at a time with new numbers every time, for as long as you like.