| Filter Design Toolbox | ![]() |
Construct a cascaded integrator-comb decimation filter object
Syntax
Description
hm = mfilt.cicdecim(r,m,n,ibits,obits,bps)
returns a cascaded integrator-comb (CIC) decimation filter object.
The following table describes the input arguments for creating hm.
Objects have properties that control the way the object behaves. This table lists all the properties for the filter, with a description of each.
| Name |
Values |
Default |
Description |
BitsPerStage |
Any integer or a vector of length 2* n. |
16 |
Defines the bits per stage used while accumulating the data in the integrator stages or while subtracting the data during the comb stages (using 'wrap' arithmetic). Enter bps as a scalar or vector of length 2*n, where n is the number of stages. When bps is a scalar, the scalar value is applied to each filter stage. The default is 16 for each stage in the decimator. |
DecimationFactor |
Any positive integer |
2 |
Amount to reduce the input sampling rate. |
DifferentialDelay |
Any integer |
1 |
Sets the differential delay for the filter. Usually a value of one or two is appropriate. |
FilterStructure |
Any mfilt structure string |
None |
Reports the type of filter object, such as a decimator or fractional integrator. You cannot set this property--it is always read only and results from your choice of mfilt object. |
InputBitWidth |
8, 16, 32 |
16 |
Word length of the input samples. |
NonProcessedSamples |
Any |
0 |
Shows the values of the samples that were not processed during the filtering operation. Note that this is not the number of samples that were not processed. Refer to filter for more information about nonprocessed samples. |
NumOfSamplesProcessed |
Any integer |
0 |
Returns the number of samples processed during filtering. As a check, the number of samples reported processed plus the number of nonprocessed samples should be the total number of input samples. |
NumberOfStages |
Any positive integer |
2 |
Number of stages used in the decimator. |
OutputBitWidth |
1 to 32 |
16 |
Word length of the output samples. |
ResetBeforeFiltering |
'off' or 'on' |
on |
Determine whether the filter states get restored to their starting values for each filtering operation. The starting values are the values in place when you create the filter if you have not changed the filter since you constructed it. ResetBeforeFiltering returns to zero any state that the filter changes during processing. States that the filter does not change are not affected. |
States |
Any int32 matrix with dimensions (m+1,n) |
2-by-2 matrix, int32 |
Stored conditions for the filter, including values for the integrator and comb sections. m is the differential delay and n is the number of stages in the filter. |
About the States of the Filter
In the states property you find the states for both the integrator and comb portions of the filter. states is a matrix of dimensions m+1-by-n, with the states apportioned as follows:
In the state matrix, state values are specified and stored in int32 format.
Design Considerations
When you design your CIC decimation filter, remember the following general points:
= k * 2
/rm radians, k = 1,2,3....
n, the number of stages in the filter, determines the passband attenuation. Increasing n improves the filter ability to reject aliasing and imaging, but it also increases the droop (or rolloff) in the filter passband. Using an appropriate FIR filter in series after the CIC decimation filter can help you compensate for the induced droop.
Examples
This example applies a decimation factor r equal to 8 to a 160-point impulse signal. The signal output from the filter has 160/r, or 20, points or samples. Choosing 10 bits for the quantizer word length represents a fairly common setting for analog to digital converters. The plot shown after the code presents the stem plot of the decimated signal, with 20 samples remaining after decimation:
m = 4; % Differential delays in the filter n = 4; % Filter stages r = 8 % Decimation factor x = int16(zeros(160,1)); x(1) = 1; % Create a 160-point % impulse signal hm = mfilt.cicdecim(r,m,n); % Expects 16-bit input by default. y = filter(hm,x); stem(y) % Plot the output as a stem plot xlabel('Samples'); ylabel('Amplitude'); title('Decimated Signal');
This example demonstrates one way to compute the frequency response, using a 4-stage decimation filter with the decimation factor set to 7:
FVTool provides ways for you to change the title and x labels to match the figure shown. Here's the frequency response plot for the filter. For details about the transfer function used to produce the frequency response, refer to [1] in the References section.
Algorithm
To show how the CIC decimation filter is constructed, the following figure presents a block diagram of the filter structure for a two-stage CIC decimation filter (n = 2). fs is the high sampling rate, the input to the decimation process.
For details about the bits that are removed in the Comb section, refer to [1] in References.
See Also
mfilt, mfilt.cicdecimzerolat, mfilt.cicinterp, mfilt.cicinterpzerolate, cicdecimate
References
[1] Hogenauer, E. B., "An Economical Class of Digital Filters for Decimation and Interpolation," IEEE Transactions on Acoustics, Speech, and Signal Processing, ASSP-29(2): pp. 155-162, 1981
[2] Meyer-Baese, Uwe, "Hogenauer CIC Filters," in Digital Signal Processing with Field Programmable Gate Arrays, Springer, 2001, pp. 155-172
| mfilt | mfilt.cicdecimzerolat | ![]() |
Learn more about the latest releases of MathWorks products: |
| © 1994-2009 The MathWorks, Inc. - Site Help - Patents - Trademarks - Privacy Policy - Preventing Piracy - RSS |