Designing a differentiator filter using cfirpm
7 次查看(过去 30 天)
显示 更早的评论
Hi,
I would like to use a differentiator filter with response and phase function as shown below as described in this paper: https://www.ncbi.nlm.nih.gov/pmc/articles/PMC2235870/
The purpose of the filter is to normalize power spectrum by compensating for the 1/f trend. The author mentioned that their method can be implemented using cfirpm in Matlab but they did not give any further information about the parameters that they used. Any pointers would be appreciated. Thank you.
Maria
0 个评论
采纳的回答
Star Strider
2019-9-11
编辑:Star Strider
2019-9-11
The moving average filter is easy enough to design:
Fs = 250; % Sampling Frequency (Hz) For EEG
Ts = 1/Fs; % Sampling Interval (sec)
b = [1 -1]; % MA Filter Numerator
a = 2*Ts; % MA Filter Denominator
figure
freqz(b, a, 2^14, Fs) % Filter Bode Plot
It gives a result similar to the published Bode plot.
n = 60;
f = [0.01 0.9];
b = cfirpm(n,f,{@differentiator,Fs})
a = 1;
figure
freqz(b,a,2^14, Fs)EDIT —
EDIT —
3 个评论
Star Strider
2019-9-12
My pleasure.
The sampling frequency in the filter designs has to be the sampling frequency of your signals.
I noticed the filter transfer functions amplified the signals, however the paper had similar results.
The way I would deal with that is to change ’b’ for both filters:
a = Ts * 10^3.1; % MA Filter Denominator
and for the cfirpm filter:
a = 10^3.1;
These are the magnitude of the maxima of the transfer functions, and are calculated from the maximum amplitude of both being about 62 dB, so . The maximum amplitude of the transfer functions is about 0 dB with these changes, as desired for filters.
That change should stop them from being amplifiers, and produces the correct result when I evaluate them with freqz. Note that they significantly attenuate low frequencies, and (being differentiators) will amplify high-frequency noise. They will also remove baseline offset.
Also, in your code, you are filtering with the moving average filter coefficients. The two filters have similar characteristics, so that may not make a significant difference.
I’ve not used these types of filters with EEG signals (or any other signals, for that matter), generally using elliptic filters to remove band-limited noise and to remove baseline offset and low-frequency baseline wander. It’s certainly an interesting approach to dealing with the noise.
更多回答(0 个)
另请参阅
类别
在 Help Center 和 File Exchange 中查找有关 Digital Filter Analysis 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!