Recently I was reading "Optimum FIR Digital Filter Implementations for Decimation, Interpolation, and Narrow-Band Filtering) by Crochiere and Rabiner (1975). To estimate the number of decimation Stages and factors, they are targeting to optimize the total number of multiplies and adds (per second) calling this number $R_T$. With $R_T$ being sum of multiplies and adds of each stage:
$R_T = \sum_i^K R_i$.
When playing around with Matlab, I found the Matlab function designMultistageDecimator, in one example they compare a multistage approach with a single filter by calculating the cost (with the function cost ), here however, it is multiplication and addition per input sample.
I would have assumed that the cost behaves in the manner, that it is the total sum of all cost per stage.
For the single filter, which will be then compared to a cascade, I understand the result, having 753 coefficients and a decimation factor of 48, that roughly there are 16 mults and 16 adds per input sample.
But when it comes to the filter cascade, in the example given by Matlab
- Stage one has 17 coefficients (13 non zero) and a decimation factor of 3
- Stage two has 11 coefficients (7 non zero) and a decimation factor of 2
- Stage three has 15 coefficients (9 non zero) and a decimation factor of 2
- Stage four has 63 coefficients (49 non zero) and a decimation factor of 4
The estimated multiplications are ~7.2 and additions ~6.6 per input sample.
This confuses me, I would have assumed that is roughly ~25 multiplication and ~25 additions. Just taking the last stage having more or less 50 non zero elements and a decimation factor of 4 would add at least 12.5 operations, or not?
So my questions are,
How are the costs, in the sense of multiplies and adds computed for a cascaded design in matlab using the function cost? (Thanks @TimWescott)
Why is it not the sum of multiplication and add per stage? A sample at the output has to see at least on o the polyphaser trees of the last stage having at least 12 coefficients or not?
Follow up question:
- After the answer by @TimWescott, I understand now the math behind the result of the cost funciton. However, I am asking myself how to interpret the output of the cost function? Is on sample, given this example, really only seeing ~7 multiplications / ~7 additions?
- In therms of dsp-terminolgy what would the calculation of operations int the following way:
13/3 + 7/2 +9/2 +49/4 = ~25