Notch filtering from coefficients
21 Ansichten (letzte 30 Tage)
Ältere Kommentare anzeigen
Giorgio Frignani
am 5 Jul. 2020
Kommentiert: Star Strider
am 6 Jul. 2020
Hi, I'm working on a notch filter to remove a peak in my spectrum. I designed the filter in different ways (fdesign.notch principally) and I get 6 coefficients. I tried filtering just with notchfilt(signal) but by plot seems nothing happens. Is this correct?
BTW how can I filter by using these coefficients? filtfilt accepts only 2..
Thanks
F0 = 2690; % interference is at
Fs = 44100; % sampling frequency is
notchspec = fdesign.notch('N,F0,Q',2,F0,100,Fs);
notchfilt = design(notchspec,'SystemObject',true);
% fvtool(notchfilt,'Color','white');
FOA_mag = notchfilt(Xa_mag); % xa_mag is the magnitude from fft of the signal
% got these coefficients from struct:
notchfilt.SOSMatrix
ans =
1.0000 -1.8549 1.0000 1.0000 -1.8514 0.9962
0 Kommentare
Akzeptierte Antwort
Star Strider
am 5 Jul. 2020
Bearbeitet: Star Strider
am 6 Jul. 2020
The function gives you the ‘b’ vector for the filter. The ‘a’ vector is 1, since this appears to be a FIR filter design.
To understand how the filter works, use freqz:
figure
freqz([1.0000 -1.8549 1.0000 1.0000 -1.8514 0.9962], 1, 2^16, 44100)
Use the first two arguments with filtfilt.
(I do not have the DSP System Toolbox, so I cannot comment further on your code.)
EDIT — (5 Jul 2020 at 00:18)
I would design the filter this way:
F0 = 2690;
Fs = 44100;
Fn = Fs/2;
fcuts = [2600 [-5 5]+F0 2790];
mags = [10 0 10];
devs = [0.1 0.05 0.1];
[n,Wn,beta,ftype] = kaiserord(fcuts,mags,devs,Fs);
b = fir1(n, Wn, 'stop', kaiser(n+1, beta), 'noscale');
figure
freqz(b, 1, 2^16, Fs)
.
2 Kommentare
Weitere Antworten (0)
Siehe auch
Kategorien
Mehr zu Filter Design 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!