Bandpass Filtering EEG Data
7 Ansichten (letzte 30 Tage)
Ältere Kommentare anzeigen
Hi!
I'm trying to bandpass filter EEG data that has 64 channels. For some reason, the filter is replacing a large part of some channels with NaNs. Here is the code I'm using. Fs in this case is 240 Hz. I have attached the EEG data that I'm using. Thank you so much!
function [ppf] = pfilter(x, Fs)
%First apply a bandpass filter to get frequencies between 0.1 Hz and 40 Hz
Fn = Fs/2; %nyquist frequency
wp = [1 40]/Fn; %normalizing frequency range.
[b,a] = butter(1,wp);%1st order butterworth filter.
[sos,g] = tf2sos(b,a);
figure(1);
freqz(sos, 240, Fs);
ppf = x;
for i = 1:size(x,2);
tmp = ppf(:,i); tmp(tmp==0)=NaN;
tmp(isfinite(tmp)) = detrend(tmp(isfinite(tmp)));
ppf(:,i) = filter(b,a,tmp);
end
end
0 Kommentare
Antworten (1)
Siehe auch
Kategorien
Mehr zu EEG/MEG/ECoG finden Sie in Help Center und File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!