Notch filtering from coefficients

19 ビュー (過去 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 Center および File ExchangeFilter Design についてさらに検索

タグ

Community Treasure Hunt

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

Start Hunting!

Translated by