Simply EEGLAB

Designing EEG experiments

Station 0 · Lesson 5 · EEGLAB 2026.1

Script

srate = 250;                                         % samples per second
t     = -0.2:1/srate:0.8;                            % epoch from -200 to 800 ms
erp   = 5 * exp(-((t - 0.35).^2) / (2*0.08^2));      % P3-like wave, 5 microvolts
rng(1);                                              % same noise on every run
nTrials = [10 40 160];
labels  = cell(1, numel(nTrials));
figure; hold on;
for k = 1:numel(nTrials)
    n      = nTrials(k);
    trials = erp + 20 * randn(n, numel(t));          % same wave + noise on each trial
    avg    = mean(trials, 1);                        % the average across trials
    noise  = std(avg(t < 0));                        % noise left in the pre-stimulus period
    fprintf('%4d trials: noise left = %.2f microvolts\n', n, noise);
    plot(t*1000, avg);
    labels{k} = sprintf('%d trials', n);
end
plot(t*1000, erp, 'k', 'LineWidth', 2);
xlabel('Time (ms)'); ylabel('Amplitude (\muV)');
legend([labels, {'True wave'}]);

Which value should I choose?

ItemWhat you do
Trials per conditionStart from the number used in published studies of the same component, and add a margin for trials that will be rejected
Event recordingSend a code for each event (stimulus and response) directly to the EEG system
Timing accuracyMeasure the delay between the event code and the stimulus appearing on screen with a photodiode
Comparison conditionTwo conditions that differ in one factor only
Trial orderRandomize the conditions, and vary the gap between trials slightly
Eye channelsRecord EOG channels above, below and beside the eyes
Recording environmentKeep screens and power sources away from the participant, and check electrode impedance before starting

Full lesson: https://simplyeeglab.pages.dev/en/lesson/experiment-design/

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

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