%% Design Butterworth IIR Bandpass Filter
% Design a Butterworth IIR bandpass filter. The filter design procedure is:
% Specify the filter design specifications using a fdesign function.
% Pick a design method provided by the designmethods function.
% To determine the available design options to choose from, use the designoptions function.
% Design the filter using the design function.
%
% Construct a default bandpass filter design specification object using fdesign.bandpass.

bandpassSpecs = fdesign.bandpass

% Determine the available designmethods using the designmethods function. To design a Butterworth filter, pick butter.

designmethods(bandpassSpecs,'Systemobject',true)

% When designing the filter, you can specify additional design options. View a list of options using the designoptions function. The function also shows the default design options the filter uses.

designoptions(bandpassSpecs,'butter')

% Use the design function to design the filter. Pass 'butter' and the specifications given by variable bandpassSpecs, as input arguments. Specify the 'matchexactly' design option to 'passband'.

bpFilter = design(bandpassSpecs,'butter','matchexactly','passband','SystemObject',true)

% Visualize the frequency response of the designed filter.

fvtool(bpFilter)

%
%
% Copyright 2012 The MathWorks, Inc.