| Filter Design Toolbox | ![]() |
Construct a cascaded integrator-comb interpolation filter object
Syntax
Description
hm = mfilt.cicinterp(r,m,n,ibits,obits)
constructs a cascaded integrator-comb (CIC) interpolation 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 |
InterpolationFactor |
Any positive integer |
None |
Amount to increase the 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. |
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 having size (m+1,n) |
2-by-2 matrix, int32 |
Stored conditions for the filter, including values for the interpolator and comb states. The matrix dimension entries m and n are the differential delay and number of filter stages. |
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 interpolation 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 interpolation filter can help you compensate for the induced droop.
Examples
Demonstrate interpolation by a factor of two, in this case from 22.05 KHz to 44.1 KHz. Note the scaling required to see the results in the stem plot and to use the full range of the int16 data type.
R = 2; % Interpolation factor hm = mfilt.cicinterp(R); % Use default NumberofStages and % DifferentialDelay fs = 22.05e3; % Original sampling frequency--22.05 KHz n = 0:5119; % 5120 samples, 0.232 second long signal x = sin(2*pi*1e3/fs*n); % Original signal, sinusoid at 1 KHz % Scale input to use the full dynamic range of the INT16 data type x = int16((2^15-1)*x/gain(hm)); y_int = filter(hm,x); % 5120 samples, still 0.232 seconds % Scale the input and output to overlay plots x = double(x); x = x/max(abs(x)); y = double(y_int); y = y/max(abs(y)); stem(n(1:22)/fs,x(1:22),'filled'); % Plot original signal sampled % at 22.05 KHz hold on; stem(n(1:44)/(fs*R),y(4:47),'r'); % Plot interpolated signal % (44.1 KHz) in red xlabel('Time (sec)');ylabel('Signal Value');
As you expect, the plot shows that the interpolated signal matches the input sine shape, with additional samples between each original sample.
Use the filter visualization tool (FVTool) to plot the response of the interpolator object. For example, to plot the response of an interpolator with an interpolation factor of 7, 4 stages, and 1 differential delay, do something like the following:
Algorithm
To show how the CIC interpolation 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 integrator section, refer to [1] in References.
See Also
cicdecimate, cicinterpolate, mfilt, mfilt.cicdecim, mfilt.cicdecimzerolat, mfilt.cicinterpzerolat
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.cicdecimzerolat | mfilt.cicinterpzerolat | ![]() |
Learn more about the latest releases of MathWorks products: |
| © 1994-2009 The MathWorks, Inc. - Site Help - Patents - Trademarks - Privacy Policy - Preventing Piracy - RSS |