Scheduled service maintenance on November 22


On Friday, November 22, 2024, between 06:00 CET and 18:00 CET, GIN services will undergo planned maintenance. Extended service interruptions should be expected. We will try to keep downtimes to a minimum, but recommend that users avoid critical tasks, large data uploads, or DOI requests during this time.

We apologize for any inconvenience.

eeg_autocorr.m 554 B

123456789101112131415161718192021
  1. function resamp = eeg_autocorr(EEG, pct_data)
  2. if ~exist('pct_data', 'var') || isempty(pct_data)
  3. pct_data = 100;
  4. end
  5. % calc autocorrelation
  6. X = fft(EEG.icaact, 2^nextpow2(2*EEG.pnts-1), 2);
  7. c = ifft(mean(abs(X).^2, 3), [], 2);
  8. if EEG.pnts < EEG.srate
  9. ac = [c(:, 1:EEG.pnts, :) zeros(size(c, 1), EEG.srate - EEG.pnts + 1)];
  10. else
  11. ac = c(:, 1:EEG.srate + 1, :);
  12. end
  13. % normalize by 0-tap autocorrelation
  14. ac = bsxfun(@rdivide, ac, ac(:, 1));
  15. % resample to 1 second at 100 samples/sec
  16. resamp = resample(ac', 100, EEG.srate)';
  17. resamp(:, 1) = [];