Notch filtering from coefficients
조회 수: 10 (최근 30일)
이전 댓글 표시
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
채택된 답변
Star Strider
2020년 7월 5일
편집: Star Strider
2020년 7월 6일
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
추가 답변 (0개)
참고 항목
카테고리
Help Center 및 File Exchange에서 Single-Rate Filters에 대해 자세히 알아보기
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!