How to filter out the noise and then get the frequency characteristics?

1 view (last 30 days)
I want to extract frequency information between 6Hz and 15Hz from an EEG signal (sampling rate: 128Hz). I first used a bandpass filter on the signal, and then did a FFT on the filtered signal. The strange thing is that after FFT, the frequency peak is always around 10Hz. It is supposed that the frequency peak is different for different signals. The code is as follows:
Hd =filterdesign;
NFFT = 2^nextpow2(L); % Next power of 2 from length of y
z = filter(Hd,y); % y is signal
Z = fft(z,NFFT);
**************************************************
function Hd = filterdesign % Equiripple Bandpass filter designed using the FIRPM function.
% All frequency values are in Hz. Fs = 128; % Sampling Frequency
N = 10; % Order
Fstop1 = 6; % First Stopband Frequency
Fpass1 = 6.5; % First Passband Frequency
Fpass2 = 15; % Second Passband Frequency
Fstop2 = 15.5; % Second Stopband Frequency
Wstop1 = 1; % First Stopband Weight
Wpass = 1; % Passband Weight
Wstop2 = 1; % Second Stopband Weight
dens = 2000; % Density Factor
% Calculate the coefficients using the FIRPM function.
b = firpm(N, [0 Fstop1 Fpass1 Fpass2 Fstop2 Fs/2]/(Fs/2), [0 0 1 1 0 ... 0], [Wstop1 Wpass Wstop2], {dens});
Hd = dfilt.dffir(b);
*************************************
What is the standard way to do such signal processing? What I need is to filter out some band of noise and then find out the frequency peaks.
Thanks a lot.
Jun
  5 Comments
jun
jun on 8 Jan 2013
NFFT is 1024, so the resolution is 1/8 Hz. Is the procedure correct, i.e, filtering and then doing FFT?
mausam
mausam on 27 Mar 2014
i am in similar situation, if you have made through it, please help me out.
% code
W=fastica([EEGdata(2,:);EEGdata(3,:);EEGdata(4,:);EEGdata(5,:);]);
% amplitudeestimation
Fs = 256;
x=W(1,186:6330);
freqres = Fs/length(x);
xdft = fft(x);
xdft = xdft(1:length(x)/2+1);
xdft = 1/length(x).*xdft;
xdft(2:end-1) = 2*xdft(2:end-1);
freq = 0:Fs/length(x):Fs/2;
plot(freq,abs(xdft));
xlabel('Hz'); ylabel('Amplitude');
h = line(freq,ones(length(x)/2+1,1));
set(h,'color',[1 0 0],'linewidth',2);
end
%%%%%%%%%%%%%%%%
i should be getting at least one peak at 8 Hz but its all flat. thanks

Sign in to comment.

Answers (0)

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!