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?
| Item | What you do |
|---|---|
| Trials per condition | Start from the number used in published studies of the same component, and add a margin for trials that will be rejected |
| Event recording | Send a code for each event (stimulus and response) directly to the EEG system |
| Timing accuracy | Measure the delay between the event code and the stimulus appearing on screen with a photodiode |
| Comparison condition | Two conditions that differ in one factor only |
| Trial order | Randomize the conditions, and vary the gap between trials slightly |
| Eye channels | Record EOG channels above, below and beside the eyes |
| Recording environment | Keep screens and power sources away from the participant, and check electrode impedance before starting |