# Representing changing sample rate in block diagram and frequency response plot

I have an discrete integrator which sums over a block of input samples to produce output samples at a lower rate.

The integrator sums a block of 8 input samples, multiplies the sum by a coefficient, and adds it to the previous output sample to produce the new output sample. Then it moves to the next block of input. The result is an output stream at 1/8 the sample rate of the input stream.

I'm trying to determine how best to illustrate the process, both as a block diagram, and in terms of frequency response.

I recognize that the frequency response is problematic since resampling is non-linear, but I'm wondering if there are some standard practices.

I'm sure there is a simple way to represent this as a block diagram. I'm just not sure what the convention is.

• Is it a continuously running integrator or a moving average over a finite number of samples (or possibly a block average such as "integrate and dump)? Apr 19, 2022 at 22:57
• @DanBoschen I've edited the question to try and clarify the process. Apr 20, 2022 at 0:12

This is how I would represent the processing described by the OP:

"MAF8" represents a moving average filter over 8 samples. Even though the OP is doing a block average, the result will be identical to a moving average since the down-sample by 8 (which is shown by the down arrow with the 8 as typically done) will select each 8th sample resulting in the functionally equivalent processing.

The subsequent accumulation with a gain coefficient $$\alpha$$ at the lower rate at the output of the down-sample is drawn as traditionally done (with $$\alpha <1$$ to be stable, this is called a "leaky accumulator").

The depiction as a moving average makes understanding the spectrum of the filtering very straightforward. Prior to the down-sample, this will have a frequency response given as an "aliased Sinc function" or specifically the Dirichlet Kernel as given in the plot below and found from Matlab/Octave using:

freqz([1 1 1 1 1 1 1 1])


The OP is correct that the subsequent decimation is non-linear, and specifically results in aliasing of this frequency response. What I typically do is plot the frequency response using the above result out to the new digital frequency range (which is 1/8 of this spectrum) and then roll the remaining response to show the aliasing that would result from each of the upper frequency bands. This is shown below for the above frequency response from the moving average filter after the aliasing due to the down-sampling operation. What we see is the top blue curve represents the actual response for any signal that was originally in the band from DC to 1/16 of the original sampling rate (what becomes $$f_s/2$$ after down-sampling). The remaining curves are the attenuation for any signals at the higher frequencies that would alias into this band due to the down-sampling. Note we are seeing the mapping of the frequency response from the first curve cyclically folding onto the primary frequency band after down-sampling.

This process is then cascaded with the accumulator which has a frequency response (at the lower sampling rate) given by

$$H(z) = \frac{z}{z-\alpha}$$

For example with $$\alpha=0.2$$:

freqz(1, [1 -.2])


I would multiply the above response with the primary response given by the upper blue curve for the moving average filter and down-sampler to get the composite frequency response and I would take the aliasing curves as advise in terms of determining if there is sufficient filtering in these frequency bands prior to the down-sampling (there could be additional filtering ahead of this operation for example, or perhaps the possible interference is not of sufficient concern).

• Thanks, this is great. The reflected frequency curves showing aliasing makes perfect sense and should be simple to implement. Apr 20, 2022 at 16:52
• Right - and the noise floor (such as quantization noise or amplified front-end analog noise) would add in power so to see the SNR due to that you can RSS each curve. Apr 20, 2022 at 17:11