FIR filter for ECG signal
7 ビュー (過去 30 日間)
古いコメントを表示

Hello everyone, I have a problem that I use FIR filter to eliminate the frequency 60Hz, but it does not work. Could you help me?
b=fir1(6,[0.118 0.122],'stop');
freqz(b,1);
dataIn=load('noisy_ECG.mat');
c=struct2cell(dataIn);
d=cell2mat(c);
dataOut=filter(b,1,d);
e=[0:9999];
plot(e,dataOut)
0 件のコメント
回答 (1 件)
Star Strider
2018 年 1 月 5 日
One problem is that your filter is not long enough.
Try this:
b=fir1(64,[0.119 0.121],'stop');
freqz(b,1)
You may also want to refine it to create a more narrow stopband. Without knowing your sampling frequency, I cannot re-design it.
2 件のコメント
Duy Nguyen
2018 年 1 月 6 日
thank you, the sampling frequency is 1kHz. So I set cutoff frequency from 59Hz to 61Hz for 60Hz stopband. Could you help me to re-design this filter? thank you very much.
Star Strider
2018 年 1 月 6 日
編集済み: Star Strider
2018 年 1 月 6 日
My pleasure.
Here you go:
Fs = 1E+3; % Sampling Frequency
Fn = Fs/2; % Nyquist Frequency
b=fir1(48, [59.8 60.2]/Fn, 'stop');
freqz(b, 1, 2^16, Fs)
If you want a much steeper rolloff and much narrower notch, this works:
sb_frq = [58 59 61 62]; % Define Passband / Stopband Frequencies
mags = [1 0 1]; % Design Lowpass Filter
devs = [0.05 0.01 0.05]; % Allowed Deviations
[n,Wn,beta,ftype] = kaiserord(sb_frq,mags,devs,Fs); % Use Kaiser Window
n = n + rem(n,2); % Define Filter Order
b = fir1(n,Wn,ftype,kaiser(n+1,beta),'scale'); % Design Filter
freqz(b, 1, 2^16, Fs)
参考
カテゴリ
Help Center および File Exchange で Digital Filter Design についてさらに検索
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!