%% Impulse and Frequency Response of CIC Compensation Decimator
% Design an CIC compensation decimator. Specify the decimation factor to be 2, passband frequency to be 4 kHz, stopband frequency to be 4.5 kHz, and the input sample rate to be 16 kHz.

fs = 16e3;
fPass = 4e3;
fStop = 4.5e3;

CICCompDecim = dsp.CICCompensationDecimator('DecimationFactor',2,'PassbandFrequency',fPass, ...
    'StopbandFrequency',fStop,'SampleRate',fs);

%
% Plot the impulse response. The group delay of the filter is 45.5.

fvtool(CICCompDecim,'Analysis','impulse')

%
% Plot the magnitude and Phase response.

fvtool(CICCompDecim,'Analysis','freq')

% Copyright 2012 The MathWorks, Inc.