Notch filtering from coefficients

조회 수: 21 (최근 30일)
Giorgio Frignani
Giorgio Frignani 2020년 7월 5일
댓글: Star Strider 2020년 7월 6일
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

채택된 답변

Star Strider
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
Giorgio Frignani
Giorgio Frignani 2020년 7월 6일
Fantastic, it seems to work in both ways! I just didn't get coefficients meaning..
Thank you
Star Strider
Star Strider 2020년 7월 6일
As always, my pleasure!

댓글을 달려면 로그인하십시오.

추가 답변 (0개)

카테고리

Help CenterFile Exchange에서 Filter Design에 대해 자세히 알아보기

태그

Community Treasure Hunt

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

Start Hunting!

Translated by