FIR filter for ECG signal
20 Ansichten (letzte 30 Tage)
Ältere Kommentare anzeigen
![](https://www.mathworks.com/matlabcentral/answers/uploaded_files/168495/image.jpeg)
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 Kommentare
Antworten (1)
Star Strider
am 5 Jan. 2018
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 Kommentare
Duy Nguyen
am 6 Jan. 2018
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
am 6 Jan. 2018
Bearbeitet: Star Strider
am 6 Jan. 2018
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)
Siehe auch
Kategorien
Mehr zu Digital and Analog Filters finden Sie in Help Center und File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!