Design Notching Filter for different frequencies

16 次查看(过去 30 天)
Hi,
I want to design a filter with Notches in different frequencies. The MATLAB give the option for one Notch only:
F0 = 60; % interference is at 60 Hz
Fs = 3000; % sampling frequency is 3000 Hz
BW=1;
f = fdesign.notch('N,F0,BW',2,F0,10,Fs);
h = design(f,'SystemObject',true);
hfvt= fvtool(h,'Color','white');
Any idea how to filter the other frequencies?

采纳的回答

Nade Sritanyaratana
You can use dfilt.cascade to combine filters in series.
In the following code, I create two notch filters, and cascade them together.
F0 = 60; % interference is at 60 Hz
Fs = 3000; % sampling frequency is 3000 Hz
BW=1;
f = fdesign.notch('N,F0,BW',2,F0,10,Fs);
h = design(F);
hfvt= fvtool(h,'Color','white');
f2 = fdesign.notch('N,F0,BW',2,F0+300,10,Fs);
h2 = design(f2);
hfvt= fvtool(h2,'Color','white');
hd = dfilt.cascade(h, h2);
hfvt= fvtool(hd,'Color','white');
  2 个评论
Abdulrahman
Abdulrahman 2014-8-6
It works when I tried to use different version of MATLAB. But still I don't know how to plot the bode plot of the overall filter?
Nade Sritanyaratana
One quick correction to the code I provided:
After the line:
f = fdesign.notch('N,F0,BW',2,F0,10,Fs);
Correct the following line:
h = design(f);
In other words, F should be f.
Regarding the Bode plot of the composite filter, the last line I provided should have displayed the magnitude response:
hfvt= fvtool(hd,'Color','white');
Did this not work for you? Here's a screenshot of what I'm getting:
The "Analysis" menu provides the option to also look at the phase response, if desired.
Lastly, there are three more methods that simply plot the Bode plots for magnitude, phase, or both - Magnitude response:
>> hd.magresp;
Phase response:
>> hd.phaseresp;
Both:
>> hd.freqresp

请先登录,再进行评论。

更多回答(1 个)

Neema Joseph
Neema Joseph 2018-11-21
编辑:Neema Joseph 2018-11-21
can you please help to write the output of cascaded filter in case of an audio input

类别

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