thomas_oelund
Newbie level 2
Hey guys
I have a problem with filtering a biological EEG signal. The frequency band
of interest is 2-7 Hz, so
I've created a passband filter using the FDA toolbox, it looks like this:
The input (data) is my signal.
function DataFilt = bandpass(data)
%UNTITLED Returns a discrete-time filter object.
%
% M-File generated by MATLAB(R) 7.6 and the Signal Processing Toolbox 6.9.1.
%
% Generated on: 31-Mar-2011 17:04:23
%
% Equiripple Bandpass filter designed using the FIRPM function.
% All frequency values are in Hz.
Fs = 200; % Sampling Frequency
N = 1000; % Order
Fstop1 = 1.5; % First Stopband Frequency
Fpass1 = 2; % First Passband Frequency
Fpass2 = 7; % Second Passband Frequency
Fstop2 = 7.5; % Second Stopband Frequency
Wstop1 = 10; % First Stopband Weight
Wpass = 1; % Passband Weight
Wstop2 = 10; % Second Stopband Weight
dens = 20; % 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);
DataFilt=filter(Hd,data);
end
When comparing my filtered signal (DataFilt) with the original signal it
looks like the beginning of the filtered signal is overdamped. What am I
doing wrong or lacks to understand?
You can use this example:
t=linspace(0,20,4493);
plot(t,2*cos(5*pi*t)+sin(2*pi*t))
DataFilt=bandpass(2*cos(5*pi*t)+sin(2*pi*t));
figure
plot(t,DataFilt)
Thanks in advance
Thomas
I have a problem with filtering a biological EEG signal. The frequency band
of interest is 2-7 Hz, so
I've created a passband filter using the FDA toolbox, it looks like this:
The input (data) is my signal.
function DataFilt = bandpass(data)
%UNTITLED Returns a discrete-time filter object.
%
% M-File generated by MATLAB(R) 7.6 and the Signal Processing Toolbox 6.9.1.
%
% Generated on: 31-Mar-2011 17:04:23
%
% Equiripple Bandpass filter designed using the FIRPM function.
% All frequency values are in Hz.
Fs = 200; % Sampling Frequency
N = 1000; % Order
Fstop1 = 1.5; % First Stopband Frequency
Fpass1 = 2; % First Passband Frequency
Fpass2 = 7; % Second Passband Frequency
Fstop2 = 7.5; % Second Stopband Frequency
Wstop1 = 10; % First Stopband Weight
Wpass = 1; % Passband Weight
Wstop2 = 10; % Second Stopband Weight
dens = 20; % 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);
DataFilt=filter(Hd,data);
end
When comparing my filtered signal (DataFilt) with the original signal it
looks like the beginning of the filtered signal is overdamped. What am I
doing wrong or lacks to understand?
You can use this example:
t=linspace(0,20,4493);
plot(t,2*cos(5*pi*t)+sin(2*pi*t))
DataFilt=bandpass(2*cos(5*pi*t)+sin(2*pi*t));
figure
plot(t,DataFilt)
Thanks in advance
Thomas