Design Notching Filter for different frequencies

21 visualizaciones (últimos 30 días)
Abdulrahman
Abdulrahman el 5 de Ag. de 2014
Editada: Neema Joseph el 21 de Nov. de 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?

Respuesta aceptada

Nade Sritanyaratana
Nade Sritanyaratana el 5 de Ag. de 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 comentarios
Abdulrahman
Abdulrahman el 6 de Ag. de 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 el 6 de Ag. de 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

Iniciar sesión para comentar.

Más respuestas (1)

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

Etiquetas

Community Treasure Hunt

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

Start Hunting!

Translated by