Contents

dsp.CICDecimator System object

Package: dsp

Decimate input using Cascaded Integrator-Comb filter

Description

The CICDecimator object decimates inputs using a Cascaded Integrator-Comb filter. Inputs and outputs to the object have signed fixed-point data types. You must have a Fixed-Point Designer™ license to use the CICDecimator System object™.

To decimate inputs using a CIC filter:

  1. Define and set up your System object. See Construction.

  2. Call step to decimate the input according to the properties of dsp.CICDecimator. The behavior of step is specific to each object in the toolbox.

Construction

H = dsp.CICDecimator returns a CICDecimator System object, H, that you can use to decimate the input with a cascaded integrator-comb (CIC) decimation filter.

H = dsp.CICDecimator('PropertyName',PropertyValue,...) returns a CICDecimator object, H, with each specified property set to the value you specify.

H = dsp.CICDecimator(R,M,N,'PropertyName', PropertyValue, ...) returns a CICDecimator object, H, with the DecimationFactor property set to R, the DifferentialDelay property set to M, the NumSections property set to N, and any other specified properties set to the values you specify.

Properties

DecimationFactor

Decimation factor of filter

Specify a positive integer amount by which the object decimates the input. The default is 2.

DifferentialDelay

Differential delay of filter comb sections

Specify a positive integer delay value for the object to use in each comb section of the filter. The default is 1.

NumSections

Number of integrator and comb sections

Specify the number of integrator and comb sections in the CIC filter as a positive integer value. The default is 2.

FixedPointDataType

Fixed-point property setting

Specify the fixed-point data type as one of | Full precision | Minimum section word lengths | Specify word lengths | Specify word and fraction lengths |. The default is Full precision. When you set this property to:

  • Full precision – the CICDecimator object automatically determines the word and fraction lengths of the filter sections and output.

  • Minimum section word length – the object automatically determines the word and fraction lengths of the filter sections and the fraction length of the output. You must specify the OutputWordLength.

  • Specify word lengths – the object automatically determines the fraction lengths of the filter sections and the output. You must specify values for the OutputWordLength and the SectionWordLengths properties.

  • Specify word and fraction lengths, – the object does not automatically determine word and fraction lengths for the filter sections or the output. You must specify them using the OutputFractionLength, OutputWordLength, SectionFractionLengths, and SectionWordLengths properties.

SectionWordLengths

Word length of each filter section

Specify the fixed-point word length for each section of the CIC filter as a scalar or a vector of length 2*NumSections. This property applies only when you set the FixedPointDataType property to either Specify word lengths or Specify word and fraction lengths. The default is [16 16 16 16].

SectionFractionLengths

Fraction length of each filter section

Specify the fixed-point fraction length for each section of the CIC filter as a scalar or a vector of length 2*NumSections. This property applies only when you set the FixedPointDataType property to Specify word and fraction lengths. The default is 0.

OutputWordLength

Word length of filter output

Specify the fixed-point word length for the filter output. This property applies only when you set the FixedPointDataType property to Minimum section word lengths, Specify word lengths, orSpecify word and fraction lengths. The default is 32.

OutputFractionLength

Fraction length of filter output

Specify the fixed-point fraction length for the output of the CIC filter. This property applies only when you set the FixedPointDataType property to Specify word and fraction lengths. The default is 0.

Methods

cloneCreate CIC Decimator object with same property values
freqzFrequency response
fvtoolOpen filter visualization tool
getNumInputsNumber of expected inputs to step method
getNumOutputsNumber of outputs of step method
impzImpulse response
isLockedLocked status for input attributes and nontunable properties
phasezUnwrapped phase response
releaseAllow property value and input characteristics changes
resetReset filter states of CIC decimator object
stepDecimate input using Cascaded Integrator-Comb filter

More Analysis Methods for Filter System Objects.

Examples

Decimate signal by a factor of 4 (i.e., downsample the signal from 44.1 kHz to 11.025 kHz):

hcicdec = dsp.CICDecimator(4);  
%    DecimationFactor = 4
%    default NumSections = 2 and DifferentialDelay = 1
hcicdec.FixedPointDataType = 'Minimum section word lengths'; 
hcicdec.OutputWordLength = 16; 

% Create fixed-point sinusoidal input signal 
Fs = 44.1e3;              % Original sampling frequency
n = (0:1023)';            % 1024 samples, 0.0232 sec signal
x = fi(sin(2*pi*1e3/Fs*n),true,16,15);     

% Create SignalSource System object
hsr = dsp.SignalSource(x, 64); 

% Decimate output with 16 samples per frame
y = zeros(16,16);
for ii=1:16
     y(ii,:) = step(hcicdec, step( hsr ));   
end

% Plot first frame of original and decimated signals.
% Output latency is 2 samples.  
gainCIC = ...
   (hcicdec.DecimationFactor*hcicdec.DifferentialDelay)^hcicdec.NumSections;
stem(n(1:56)/Fs, double(x(4:59))); hold on;     
stem(n(1:14)/(Fs/hcicdec.DecimationFactor),double(y(1,3:end))/gainCIC,'r','filled'); 
xlabel('Time (sec)');ylabel('Signal Amplitude');
legend('Original signal', 'Decimated signal', 'location', 'north');
hold off;    

Algorithms

This object implements the algorithm, inputs, and outputs described on the CIC Decimation block reference page. The object properties correspond to the block properties, except:

  • The Rate options block parameter is not supported by the dsp.CICDecimator object.

Was this topic helpful?