%% Design IIR Notch Filter
% Design and plot an IIR notch filter with 11 notches (equal to filter order plus 1) that removes a 60 Hz tone (f0) from a signal at 600 Hz(fs). For this example, set the Q factor for the filter to 35 and use it to specify the filter bandwidth.

fs = 600;
fo = 60;
q = 35;
bw = (fo/(fs/2))/q;
[b,a] = iircomb(fs/fo,bw,'notch'); % Note type flag 'notch'

% Use the Filter Visualization Tool (fvtool) to generate the plot showing the filter notches.

fvtool(b,a);

% Note that the notches are evenly spaced and one falls at exactly 60 Hz.
% Copyright 2012 The MathWorks, Inc.