Simply EEGLAB

ERPs & averaging

Station 6 · Lesson 1 · EEGLAB 2026.1

In the GUI

  1. PlotChannel ERPsIn scalp/rect. array
  2. Topographic ERP plot - pop_plottopo()Channels to plotPlot single trialsPlot in rect. arrayOk 1:32

Script

erp = mean(EEG.data, 3);
fprintf('Averaged %d epochs\n', EEG.trials);
pz = find(strcmp({EEG.chanlocs.labels}, 'Pz'));
figure;
plot(EEG.times, erp(pz, :), 'k', 'LineWidth', 1.5);
xlim([-200 800]); grid on;
xline(0, '--'); yline(0);
xlabel('Time (ms)'); ylabel('Amplitude (\muV)');
title(sprintf('ERP at Pz, %d epochs', EEG.trials));
win = EEG.times >= 250 & EEG.times <= 600;
winTimes = EEG.times(win);
[peakAmp, iPeak] = max(erp(pz, win));
fprintf('Positive peak at Pz: %.1f uV at %.0f ms\n', peakAmp, winTimes(iPeak));
figure; pop_plottopo(EEG, 1:EEG.nbchan, EEG.setname, 0, 'ydir', 1);

Which value should I choose?

SettingValue
What goes into the averageClean epochs from one condition only
Number of trialsAs many as you can keep after rejection, and about the same number per condition
Peak search windowSet before you look at the data, from the literature

For your Methods

ERPs were computed by averaging the [N] artifact-free epochs time-locked to the square stimulus (EEGLAB 2026.1).

Full lesson: https://simplyeeglab.pages.dev/en/lesson/erp-average/

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

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