%% Design a CIC Compensator Using fdesign Object
% Designed to compensate for the rolloff inherent in CIC filters, CIC compensators can improve the performance of your CIC design. This example designs a compensator d with five sections and a differential delay equal to one. The plot displayed after the code shows the increasing gain in the passband that is characteristic of CIC compensators, to overcome the droop in the CIC filter passband. Ideally, cascading the CIC compensator with the CIC filter results in a lowpass filter with flat passband response and narrow transition region.

h = fdesign.ciccomp;
set(h, 'NumberOfSections', 5, 'DifferentialDelay', 1);
cicComp = design(h,'equiripple','SystemObject',true);
fvtool(cicComp)

% This compensator would work for a decimator or interpolator that had differential delay of 1 and 5 sections.
% Copyright 2012 The MathWorks, Inc.