So this is a curious one. I am continuing investigating #CIC filters now that I have run @Rick Lyons tests and proven to myself that they are now correctly implemented. It involves the impulse response (or what I was looking for, the frequency response) of these filters.
One of the things I like about FIR filters is that you can send the unit impulse through them, and take the FFT of the result and see the frequency response of the filter. So naturally I plotted the FFT of the impulse response of the 3 stage, decimate by 5, CIC filter. Not surprisingly, depending on where in the decimation cycle the impulse comes in, the outputs of the filter change. So I wrote some code to send an impulse through at offset 0, 1, 2, 3, and 4 (since it is a decimate by 5 the sequence repeat). These are the first 10 values for each offset
Simple Impulse test, first 10 values: Offset 0 1 2 3 4 --------------------------  - 15, 10, 6, 3, 1  - 10, 15, 18, 19, 18  - 0, 0, 1, 3, 6  - 0, 0, 0, 0, 0 ... (all the rest of the values are 0
When you plot the FFTs of these you get this:
There are essentially three distinct plots for the three unique sequences from the output. I am at a loss to explain what this value would change. The spectral content shouldn't be different as far as I can tell.
Those are the frequency responses of each individual 'polyphase' of the full FIR filter. The frequency response you're most likely interested in is that of the full FIR filter impulse, which is the interleaved version of those 'polyphase'. Try FFTing:
[1 3 6 10 15 18 19 18 15 10 6 3 1]
Should look more like what you're expecting.
Ok, that is pretty awesome!
if the yaxis was in 'dB' it would even look like a normal frequency response!
Your right it does. Now nothing I've read about CIC filters talks about polyphase. That is something I need to understand, can you point me to a reference?
And as an update I've downloaded half a dozen papers that refer to implementing CIC filters using polyphase techniques. It will take me a bit to digest them.
My first reading is that each 'stage' of the CIC filter is one FIR phase. Thus a 3 stage CIC has 3 phases which is what I found for my example above. I will get to test this by tweaking to code a bit.
I would ignore the CIC filter part and read up about standard FIR filters and their polyphase implementation when used for decimation.
CIC is just a clever recursive way to implement a certain family of FIR filters,essentially an implementation detail.
How did you choose how to do the interleaving?
I'm not sure what you mean...
Start from the full FIR filter and pick every N samples...?