www.gusucode.com > dsp 案例源码程序 matlab代码 > dsp/DesignTwoStageDecimatorExample.m

    %% Design Two-Stage Decimator
% Design a two-stage decimator by cascading |dsp.CICDecimator| and
% |dsp.CICCompensationDecimator| System objects.

%% Construct the objects
CICDecim = dsp.CICDecimator('DecimationFactor', 6, ...
                            'NumSections', 6);
fs = 16e3;     % Sampling frequency of input of compensation decimator
fPass = 4e3;   % Passband frequency
fStop = 4.5e3; % Stopband frequency
CICCompDecim = dsp.CICCompensationDecimator(CICDecim, ...
                              'DecimationFactor', 2, ...
                              'PassbandFrequency', fPass, ...
                              'StopbandFrequency', fStop, ...
                              'SampleRate', fs);
                          
 %% Create a cascade of the two objects using the |cascade| method
 FC = cascade(CICDecim, CICCompDecim);
 
 %% Visualize the frequency response of the cascade
 f = fvtool(CICDecim, CICCompDecim, FC, 'Fs', [fs*6, fs, fs*6],...
        'Arithmetic', 'fixed');
 set(f, 'NormalizeMagnitudeto1', 'on');
 legend(f,'CIC Decimator','CIC Compensation Decimator', ...
             'Overall Response');