Simply EEGLAB
ERPs & averaging
Station 6 · Lesson 1 · EEGLAB 2026.1
In the GUI
- PlotChannel ERPsIn scalp/rect. array
- 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?
| Setting | Value |
|---|---|
| What goes into the average | Clean epochs from one condition only |
| Number of trials | As many as you can keep after rejection, and about the same number per condition |
| Peak search window | Set 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).