Signal Processing Methods
Fourier, wavelets, and time-frequency analysis
Every quantitative EEG metric rests on a transform that takes a signal expressed in time and re-expresses it in frequency. Understanding the assumptions and limits of these transforms is what separates a clinician who can interrogate a spectrogram from one who merely trusts it - and trusting a spectrogram you cannot interrogate is how artifacts become diagnoses. This module develops the Fourier transform and the sampling that precedes it, exposes the assumption of stationarity that the brain routinely violates, explains why finite recordings leak energy across frequencies and how windowing and the multitaper method tame that leakage, and then introduces the wavelet transform and time-frequency analysis as the principled responses to non-stationary, transient EEG phenomena. Throughout, one law governs everything, and it cannot be repealed by cleverness or computing power: you cannot know precisely when something happened and precisely what frequency it was at the same time.
Sampling, aliasing, and the Nyquist limit
Before any transform can be applied, the continuous voltage at the scalp must be sampled - measured at discrete instants - and digitized. The rate of sampling determines, absolutely, the highest frequency the recording can faithfully represent. The Nyquist-Shannon sampling theorem states that a signal can be perfectly reconstructed only if it is sampled at more than twice the highest frequency it contains; half the sampling rate is the Nyquist frequency, the ceiling above which frequency information is irretrievably lost. If components above the Nyquist frequency reach the digitizer, they do not simply vanish - they alias, folding back into the recorded band and masquerading as lower frequencies that were never present. A 70 Hz muscle or line-related component sampled too slowly can reappear as a spurious slow rhythm, contaminating exactly the bands a clinician cares about. The defense is an anti-aliasing filter, an analog low-pass filter applied before digitization that removes energy above the Nyquist frequency. Because aliasing happens at the moment of sampling, it cannot be undone afterward by any digital filter; this is why the anti-aliasing filter and an adequate sampling rate are foundational, non-negotiable requirements of any EEG system, and why a spectrum is only trustworthy up to well below its Nyquist frequency.
The Fourier transform and the assumption of stationarity
With a properly sampled signal in hand, the Fourier transform expresses it as a sum of sinusoids of all frequencies, each with an amplitude and a phase. For digitized EEG the discrete version, computed by the FFT, returns one complex coefficient per frequency bin; the squared magnitudes form the power spectrum and the angles carry the phase. The construction is exact and invertible - no information is lost in transforming from time to frequency and back - but its interpretation carries a hidden assumption that trips up the unwary. The Fourier basis functions are sinusoids that extend over the entire analysis window with constant amplitude. Consequently the transform describes the average spectral content of the whole segment and implicitly treats the signal as stationary: it assumes the statistical properties, and in particular the rhythmic content, do not change across the window. The frequency resolution of the result is fixed by the window length alone - finer resolution requires a longer window - so there is an immediate and unavoidable tension between resolving frequency and respecting the brevity of real events.
Clinical EEG is emphatically non-stationary, and this is not a minor caveat but a defining property of the signal. A posterior alpha rhythm attenuates the instant the eyes open; a spike rises and falls in under a hundred milliseconds; a sleep spindle waxes and wanes over a second; a seizure evolves from low-voltage fast activity through rhythmic spiking to post-ictal suppression. If you apply a single Fourier transform to a thirty-second epoch containing a five-second burst of theta, the theta power is diluted across the whole window and its timing is erased - the spectrum reports that some theta was present somewhere in the epoch, and nothing more. This averaging is acceptable for genuinely steady states, such as relaxed eyes-closed alpha or sustained stage N3 slow waves, but it is actively misleading for transients and evolving patterns, which is to say for most of what makes EEG clinically interesting. The reactivity of alpha makes the point concretely.
Windowing, spectral leakage, and the multitaper method
A second consequence of finite data is spectral leakage. The Fourier transform mathematically assumes the analysis window repeats periodically forever. If the signal does not complete an integer number of cycles within the window, the periodic extension has a discontinuity at the join, and that artificial step injects energy into many frequency bins. A pure 10.3 Hz sinusoid analyzed in a window sized for whole-number frequencies will therefore not appear as a single clean line at 10.3 Hz but as a peak smeared into neighboring bins, with skirts of spurious power spreading outward. Leakage can bury a small adjacent peak beneath the skirts of a large one and can corrupt band-power estimates by spilling energy across band boundaries - a particular hazard for connectivity and for relative-power measures that depend on clean band separation.
The first remedy is windowing: before transforming, multiply the segment by a taper that falls smoothly to near zero at both ends - Hann, Hamming, and Blackman windows are common choices. Tapering removes the edge discontinuity and dramatically suppresses the distant leakage skirts. The price, paid universally, is a widening of the central peak: every window trades main-lobe width, which is frequency resolution, against side-lobe height, which is leakage suppression. A rectangular window (no taper) has the narrowest main lobe but the worst side lobes; a Blackman window has excellent side-lobe rejection but a broad main lobe. There is no free lunch, only an explicit engineering choice about which error you can tolerate. The filtering widget below lets you watch how shaping the signal in one domain reshapes it in the other - the same duality that governs windowing.
The shaded −3 dB line marks each cutoff. Watch how the over-filtered band removes real slow and fast activity, while turning filters fully off lets drift and mains noise swamp the trace.
The multitaper method generalizes windowing in a mathematically optimal way and deserves emphasis because it is the estimator of choice when rigor matters. Rather than applying a single taper, it multiplies the same segment by a family of orthogonal tapers - the discrete prolate spheroidal (Slepian) sequences - each of which is designed to concentrate as much energy as possible within a chosen frequency bandwidth while leaking as little as possible outside it. The periodograms from the several tapers are then averaged. Because the tapers are orthogonal, they sample the segment in statistically near-independent ways, so averaging them reduces the variance of the spectral estimate without the crude data loss of simply shortening the window. The analyst sets a single intuitive parameter - the time-bandwidth product - that trades frequency resolution against variance reduction, and the method yields explicit confidence intervals and even formal tests for sinusoidal lines. Multitaper estimation is especially valuable for short, noisy, or precious records where a single-taper periodogram would be too variable to interpret, and it makes the bias-variance trade-off, which is implicit in every spectral estimate, an explicit and controllable choice.
A persistent misconception deserves direct correction here because it leads readers to overstate what a spectrum can resolve. The number of points handed to the FFT is often increased by zero-padding - appending zeros to the segment before transforming - which produces a spectrum sampled at more, and more finely spaced, frequency bins. The smoother, denser curve looks like higher resolution, but it is not: zero-padding only interpolates the spectrum that the original data already determined, drawing extra points along the same underlying shape without adding any new information. The true frequency resolution - the ability to separate two genuinely distinct nearby frequencies - is set by the duration of the actual recorded data and by nothing else, just as the stationarity discussion implied. Padding a one-second segment to look like a four-second one does not let you distinguish 10.0 Hz from 10.25 Hz; only collecting four seconds of real data can do that. The distinction matters clinically because a finely sampled, smooth-looking spectrogram can create false confidence that two peaks are resolved when the underlying record was far too short to separate them, and the only honest cures for inadequate resolution are a longer analysis window, with its attendant stationarity cost, or a method like multitaper that spends the available resolution budget wisely.
Time-frequency analysis and the uncertainty principle
If a single Fourier transform erases timing, the obvious fix is to chop the recording into short consecutive windows and transform each one, producing a sequence of spectra over time. This is the short-time Fourier transform (STFT), and its squared magnitude displayed as a color image of frequency versus time is the spectrogram. The spectrogram is the workhorse display of continuous EEG monitoring: a seizure appears as a rising arch of power climbing through the frequencies, burst suppression as alternating vertical stripes of power and silence, and a shift toward slowing as a sinking of the bright band toward the bottom of the image. But the STFT inherits a single fixed window length, and that one choice is irrevocably fraught, because it must be applied identically to every frequency and every moment in the recording.
Here the fundamental limit appears. The Gabor limit, the signal-processing form of the Heisenberg uncertainty principle, states that the product of a signal's effective duration and its effective bandwidth cannot fall below a fixed bound. A short window localizes events sharply in time but, containing few cycles, resolves frequency poorly; a long window resolves frequency finely but smears events in time and re-assumes stationarity within the window. With the STFT this trade-off is frozen across the whole image: one window length is applied to every frequency, so you are forced to favor either the slow rhythms or the fast transients but never both at once. A window long enough to separate 3 Hz from 4 Hz delta is far too long to localize a 100 millisecond spike, and a window short enough to catch the spike cannot distinguish neighboring low frequencies at all. The spectrogram you see is therefore one particular allocation of a fixed resolution budget, and reading it intelligently means knowing which window length produced it and therefore what it could and could not have shown.
No transform - Fourier, wavelet, multitaper, or otherwise - can simultaneously achieve arbitrary precision in time and frequency. Every method only chooses how to spend a fixed time-frequency resolution budget. The art of EEG signal processing is allocating that budget sensibly: fine frequency resolution where rhythms matter, fine time resolution where transients matter. A method that appears to give both at once is hiding an assumption, an interpolation, or a prior, not repealing the laws of physics.
The wavelet transform
The wavelet transform spends the budget more intelligently than the STFT by abandoning the fixed window. Instead of correlating the signal against infinite sinusoids, it correlates against scaled and shifted copies of a localized prototype waveform - the mother wavelet, often a Morlet wavelet, which is a sinusoid multiplied by a Gaussian envelope and is therefore a little packet of oscillation that exists only for a brief stretch of time. The defining trick is multiresolution: the wavelet is stretched for low frequencies and compressed for high frequencies. Low-frequency wavelets are therefore long and give fine frequency resolution but coarse timing - exactly what slow rhythms need, since a slow rhythm is by definition spread out in time - while high-frequency wavelets are short and give sharp timing at the cost of frequency precision - exactly what fast transients need. The resolution adapts to the frequency being analyzed rather than being frozen across the image, which is precisely the flexibility the STFT lacks.
This adaptive tiling of the time-frequency plane makes the wavelet transform especially well suited to EEG, whose interesting events span an enormous range of timescales - from sub-second spikes and sleep spindles to multi-second slow oscillations and minutes-long ictal evolutions. Wavelet decomposition underlies many spike and seizure detectors, spindle counters, and time-frequency representations of event-related responses, and the continuous wavelet transform is a standard tool for visualizing how the power at each frequency changes moment to moment around an event. It does not, and cannot, escape the uncertainty bound; it simply allocates resolution proportionally to frequency, which matches the structure of brain signals far better than a single fixed window. One should also remember that the choice of mother wavelet and its parameters - the number of cycles in a Morlet wavelet, for instance - is itself a resolution decision that shapes the result, so wavelet analyses, like Fourier analyses, must report their parameters to be reproducible. The number of cycles in a Morlet wavelet directly sets where on the time-frequency trade-off that wavelet sits: a wavelet with few cycles is short and gives sharp timing but coarse frequency resolution, while a wavelet with many cycles is long and gives fine frequency resolution but blurs timing, and typical analyses use values ranging from roughly two to fifteen cycles across the frequencies of interest, sometimes increasing the cycle count with frequency to balance the two demands. Two studies of the same data with different cycle counts can therefore produce visibly different time-frequency pictures even though neither is wrong, which is precisely why the parameter must be stated rather than left implicit. The rhythms widget makes vivid why this matters: a delta wave and a gamma burst demand entirely different analysis windows, and only a multiresolution method gives each what it needs.
For a steady state you want to characterize spectrally - resting alpha, N3 slow-wave power - a windowed Fourier estimate is appropriate and efficient, and a multitaper estimate is preferable when the segment is short or noisy or when you want error bars. For evolving or transient phenomena - seizure onset, spikes, spindles, event-related dynamics - reach for a spectrogram or, better, a wavelet time-frequency representation. Always report the sampling rate, the window length or wavelet parameters, and the taper or time-bandwidth product, because together they determine what your analysis could and could not have resolved.
1. An EEG is sampled too slowly and a 70 Hz muscle component reaches the digitizer. What happens, and why can it not be fixed afterward?
2. Why can a single Fourier transform over a long epoch be misleading for a brief burst of theta within that epoch?
3. What is the key advantage of the wavelet transform over a fixed-window short-time Fourier transform for EEG?