Filter löschen
Filter löschen

Design Notching Filter for different frequencies

16 Ansichten (letzte 30 Tage)
Abdulrahman
Abdulrahman am 5 Aug. 2014
Bearbeitet: Neema Joseph am 21 Nov. 2018
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?

Akzeptierte Antwort

Nade Sritanyaratana
Nade Sritanyaratana am 5 Aug. 2014
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 Kommentare
Abdulrahman
Abdulrahman am 6 Aug. 2014
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
Nade Sritanyaratana am 6 Aug. 2014
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

Melden Sie sich an, um zu kommentieren.

Weitere Antworten (1)

Neema Joseph
Neema Joseph am 21 Nov. 2018
Bearbeitet: Neema Joseph am 21 Nov. 2018
can you please help to write the output of cascaded filter in case of an audio input

Community Treasure Hunt

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

Start Hunting!

Translated by