Simply EEGLAB

Signals & frequencies

Station 0 · Lesson 4 · EEGLAB 2026.1

Script

srate = 128;                          % samples per second
t     = (0:10*srate-1) / srate;       % 10 s of time, first sample at 0
rng(0);                               % same random noise on every run
alpha = 20 * sin(2*pi*10*t);          % 10 Hz, 20 microvolts
theta =  8 * sin(2*pi*6*t);           % 6 Hz, 8 microvolts
noise =  5 * randn(size(t));          % broadband noise
sig   = alpha + theta + noise;
n     = numel(sig);
amp   = abs(fft(sig)) / n * 2;        % amplitude at each frequency
freqs = (0:n-1) * srate / n;          % frequency of each FFT bin in Hz
keep  = freqs <= srate/2;             % keep frequencies up to Nyquist
figure;
subplot(2,1,1); plot(t, sig); xlim([0 2]);
xlabel('Time (s)'); ylabel('Amplitude (\muV)');
subplot(2,1,2); plot(freqs(keep), amp(keep));
xlabel('Frequency (Hz)'); ylabel('Amplitude (\muV)');
band = freqs >= 8 & freqs <= 12;
[~, iPeak] = max(amp .* band);
fprintf('Alpha peak at %.1f Hz, amplitude %.1f\n', freqs(iPeak), amp(iPeak));
fprintf('Nyquist frequency: %d Hz\n', srate/2);
fast = sin(2*pi*70*t);
[~, iAlias] = max(abs(fft(fast)) .* keep);
fprintf('A 70 Hz wave appears at %.1f Hz\n', freqs(iAlias));

Which value should I choose?

BandApproximate frequencyWhere it usually appears
DeltaBelow 4 HzDeep sleep
Theta4 to 8 HzMemory and attention tasks, at frontal midline electrodes
Alpha8 to 12 HzRelaxed with eyes closed, at posterior electrodes
Beta13 to 30 HzOver the motor area
GammaAbove 30 HzHard to measure from the scalp because muscle activity covers it
DatasetSampling rateNyquist frequency
eeglab_data.set (main path)128 Hz64 Hz
PhysioNet file in station 2160 Hz80 Hz
A recording at 1000 Hz1000 Hz500 Hz

Full lesson: https://simplyeeglab.pages.dev/en/lesson/signal-basics/

Content license: CC BY-NC-SA 4.0 · MIT (code)

An independent learning site, not affiliated with EEGLAB or SCCN.