15 minutes · Simulations and one public recording in the browser
Signals 101: sampling, frequency and referencing
Four exercises on what happens between the electrode and the plot: sample a signal, read a spectrum, follow a rhythm over time and change the reference.
These exercises complement the filtering lab. A filter removes some frequencies. Here you first see what a frequency is in a digital signal and how to measure it. Unless a panel says otherwise, the signals are simulated.
1. Sampling and aliasing
Simulated signalAn analog-to-digital converter measures the signal at regular intervals. The number of measurements per second is the sampling rate. Half of that value is the Nyquist frequency: the highest frequency that can be represented without ambiguity.
- Keep 10 Hz and 100 Hz. The dots follow the sine wave.
- Raise the signal frequency to 60 Hz. At what frequency does the dashed curve oscillate?
- Find a sampling rate that represents 60 Hz correctly.
- Signal frequency
- 10 Hz
- Nyquist frequency
- 50 Hz
- Apparent frequency after sampling
- 10 Hz
Below the Nyquist frequency: the samples keep the signal frequency.
About this simulation
The signal is a pure 1 µV sine wave shown over half a second. An EEG amplifier applies an analog low-pass filter before conversion to limit aliasing. That filter is not simulated here. Once the data are digital, an aliased frequency cannot be told apart from a real one.
2. Frequency content
Simulated signalA power spectrum shows how much of the signal’s variance sits at each frequency. Build a signal from known components and check where they appear.
- Find the peaks for alpha (10 Hz), beta (20 Hz) and mains noise. Mains power is 60 Hz in North America and 50 Hz in Europe.
- Add an 11 Hz component. With a 1 s window, do you see two peaks or one?
- Lengthen the window to 4 s. Do the two peaks separate? What happens to the noise curve?
- Window length
- 1 s
- Frequency resolution (1 / window)
- 1 Hz
- Segments averaged
- 15
About this simulation
Simulated 8 s signal sampled at 256 Hz. Amplitudes are peak amplitudes. The spectrum is a Welch estimate: the signal is cut into segments of the chosen length with 50% overlap. Each segment is centered, multiplied by a Hann window and transformed with an FFT. The segment spectra are then averaged. A longer window gives finer frequency steps but fewer segments to average, so the noise estimate is more irregular. The computation follows the defaults of scipy.signal.welch. Real EEG also has more power at low frequencies than this white noise.
3. Time and frequency
Simulated signalA spectrogram computes a spectrum over a short window that slides through time. Each column summarizes the whole duration of its window. A short window places an event more precisely in time. A long window separates frequencies better. You cannot have both at once.
- In the simulation, the eyes close from 4 to 8 s. Find the 10 Hz band that appears and then fades.
- Look for the brief 25 Hz burst near 2 s. Compare a 0.25 s window with a 2 s window.
- Switch to the real recording. Is the occipital alpha rhythm stronger during the last four seconds?
Color: power in dB, from 30 dB below the maximum (dark) to the maximum (light), between 3 and 40 Hz.
- Duration summarized by each column
- 0.5 s
- Frequency step
- 2 Hz
- Time between columns
- 0.0625 s
About this simulation
Simulated 12 s signal at 256 Hz: a weak alpha rhythm with eyes open and a stronger one from 4 to 8 s, a quarter-second 25 Hz burst centered at 2 s, and random noise. Columns are computed every 1/16 s with a Hann window.
4. Referencing
Simulated signalEach EEG channel is a potential difference between one electrode and a reference. Whatever is present at the reference is subtracted from every channel. The same data can therefore look different depending on the reference.
- Start with the ideal view. The 60 Hz mains noise is identical on every electrode. Pick any reference: what happens to it?
- Pick Cz. What happens to the Cz channel? Compare Fz and Oz with the ideal view.
- Pick the left mastoid (M1), then linked mastoids. Where does the muscle activity from the left temporal area go?
- Pick the common average. Compare Oz near 1.2 s with the ideal view. Does a smaller, inverted copy of the frontal blink appear there?
About this simulation
Simulation of eight electrodes over 2 s at 250 Hz. Each electrode receives a mix of four sources with different weights: a mostly posterior 10 Hz alpha rhythm, a mostly frontal blink near 1.2 s, random muscle activity near T7 and M1, and 60 Hz mains noise that is identical everywhere. The ideal view shows the potential relative to a point infinitely far away. No device measures that. The common average subtracts the mean of the eight electrodes. With so few electrodes, that mean still contains a lot of brain activity. Mastoids also pick up brain activity, as the MNE tutorial notes.
What you can conclude
A digital signal only holds frequencies below half its sampling rate. A spectrum depends on the window length you choose, and a spectrogram trades time precision for frequency precision. An EEG trace also depends on its reference. Report these choices when you describe an analysis.