FIR filter for ECG signal

조회 수: 10 (최근 30일)
Duy Nguyen
Duy Nguyen 2018년 1월 5일
편집: Star Strider 2018년 1월 6일
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)

답변 (1개)

Star Strider
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
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
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 CenterFile Exchange에서 Digital Filter Design에 대해 자세히 알아보기

태그

Community Treasure Hunt

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

Start Hunting!

Translated by