Clear Filters
Clear Filters

Why does dsp.CICInterpolator prepend zeros?

2 views (last 30 days)
Harry on 27 Feb 2020
Answered: Harry on 27 Feb 2020
The output of dsp.CICInterpolator is exactly what I expect, except with N zeros padded at the start. What is the idea behind these extra zeros?
In the literature, we usually see that the group delay of a CIC filter is N*(R*M-1)/2. However, with the prepended zeros, dsp.CICInterpolator has a group delay of N*(R*M-1)/2 + N.
The example code provided here uses a lot of magic numbers. In particular, it plots y(1,4:end) (i.e. discarding the first 3 samples). This produces the correct alignment because the group delay in this example is N*(R*M-1)/2 + N = 3. However, if we remove the prepended zeros, then we get N*(R*M-1)/2 as I would expect.
I can't find any specific details on the implementation. Can anyone shed any light on this?
Many thanks.

Answers (1)

Harry on 27 Feb 2020
I guess this ultimately comes down to how we view the initial state of the integrator stages. If we view the N integrator stages as starting with "valid" input values of 0, then we will always clock out N zeros at the start.
This makes a lot of practical sense, as it's often convenient to keep output data lengths the same as input (or, for an interpolator, exactly R times greater). Therefore, we have to impose some assumption before the start and/or after the end of the input.
Similar assumptions are made by the filter function and I find they work very well in practice. If and when we care about group delay, then this can be managed separately.

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!