{{<figuresrc="/ox-hugo/decimation_spectral_aliasing.png"caption="<span class=\"figure-number\">Figure 2: </span>Decimation by a factor of three: (a) spectrum of original \\(x\_{\text{old}}(n)\\) signal; (b) spectrum after downsampling by three.">}}
There is a limit to the amount of downsampling that can be performed relative to the bandwidth \\(B\\) of the original signal.
We must ensure that \\(f\_{s,\text{new}} > 2B\\) to present overlapped spectral replications (aliasing errors) after downsampling.
If a decimation application requires \\(f\_{s,\text{new}}\\) to be less than \\(2B\\), then \\(x\_{\text{old}}(n)\\) must be low pass filtered before the downsampling process if performed.
## Two Stage Decimation {#two-stage-decimation}
When the desired decimation factor \\(M\\) is larger, say \\(M > 20\\), there is an important feature of the filter / decimation process to keep in mind.
Significant low pass filter computational savings may be obtained by implementing the two-stage decimation, shown in Figure [3](#figure--fig:decimation-two-stages) (b).
The question is: "Given a desired total downsampling factor \\(M\\), what should be the values of \\(M\_1\\) and \\(M\_2\\) to minimize the number of taps in low-pass filters \\(\text{LPF}\_1\\) and \\(\text{LPF}\_2\\)"?
For two stage decimation, the optimum value for \\(M\_1\\) is:
\begin{equation} \label{eq:M1opt}
M\_{1,\text{opt}} \approx 2 M \cdot \frac{1 - \sqrt{MF/(2-F)}}{2 - F(M+1)}
\end{equation}
where \\(F\\) is the ratio of single-stage low pass filter's transition region width to that filter's stop-band frequency:
\begin{equation}
F = \frac{f\_{\text{stop}} - B^\prime}{f\_{\text{stop}}}
\end{equation}
After using Eq. <eq:M1opt> to determine the optimum first downsampling factor, and setting \\(M\_1\\) equal to the integer sub-multiple of \\(M\\) that is closest to \\(M\_{1,\text{opt}}\\), the second downsampling factor is:
\begin{equation} \label{eq:M2\_from\_M1}
M\_2 = \frac{M}{M\_1}
\end{equation}
<divclass="exampl">
Let's assume we have an \\(x\_{\text{old}}(n)\\) input signal arriving at a sample rate of \\(400\\,kHz\\), and we must decimate that signal by a factor of \\(M=100\\) to obtain a final sample rate of \\(4\\,kHz\\).
Also, let's assume the base-band frequency range of interest is from \\(0\\) to \\(B^\prime = 1.8\\,kHz\\), and we want \\(60\\,dB\\) of filter stop-band attenuation.
A single stage decimation low-pass filter's frequency response is shown in Figure [4](#figure--fig:decimation-two-stage-example) (a).
The number of taps \\(N\\) required for a single-stage decimation would be:
The integer sub-multiple of 100 closest to \\(26.4\\) is \\(25\\), so we set \\(M\_1 = 25\\).
Next, from Eq. <eq:M2_from_M1>, \\(M\_2 = 4\\) is found.
The first low pass filter has a pass-band cutoff frequency of \\(1.8\\,kHz\\) and its stop-band is \\(400/25 - 1.8 = 14.2\\,kHz\\) (Figure [4](#figure--fig:decimation-two-stage-example) (d)).
The second low pass filter has a pass-band cutoff frequency of \\(1.8\\,kHz\\) and its stop-band is \\(4-1.8 = 2.2\\,kHz\\).
{{<figuresrc="/ox-hugo/decimation_two_stage_example.png"caption="<span class=\"figure-number\">Figure 4: </span>Two stage decimation: (a) single-stage filter response; (b): decimation by 100; (c) spectrum of original signal; (d) output spectrum of the \\(M=25\\) down-sampler; (e) output spectrum of the \\(M=4\\) down-sampler.">}}
There are two **practical issues** to consider for two-stage decimation:
- First, if the dual-filter system is required to have a pass-band peak-peak ripple of \\(R\\) dB, then both filters must be designed to have a pass-band peak-peak ripple of no greater than \\(R/2\\) dB.
- Second, the number of multiplications needed to compute each \\(x\_{\text{new}}(m)\\) output sample is much larger than \\(N\_\text{total}\\) because we must compute so many \\(\text{LPF}\_1\\) and \\(\text{LPF}\_2\\) output samples destined to be discarded.
In order to cope with the second issue, an efficient decimation filter implementation scheme called _polyphase decomposition_ can be used.
<summary>The advantages of two stage decimation, over single-stage decimation are:
<ulclass="org-ul">
<li>an overall reduction in computation workload</li>
<li>reduced signal and filter coefficient data storage</li>
<li>simpler filter designs</li>
<li>a decrease in the ill effects of finite binary-work-length filter coefficients</li>
</ul>
These advantages become more pronounced as the overall desired decimation factor \(M\) becomes larger.</summary>