Bandpass Filtering EEG Data
7 ビュー (過去 30 日間)
古いコメントを表示
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 件のコメント
回答 (1 件)
参考
カテゴリ
Help Center および File Exchange で EEG/MEG/ECoG についてさらに検索
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!