digital-brain/content/zettels/decimation.md

5.6 KiB

+++ title = "Decimation" author = ["Dehaeze Thomas"] draft = false +++

Tags
[Digital Signal Processing]({{< relref "digital_signal_processing.md" >}})

Decimation is the two-step process of low pass filtering followed by and operation known as downsampling.

We can downsample a sequence of sampled signal values by a factor of \(M\) by retaining every Mth sample and discarding all the remaining samples. Relative to the original sample rate \(f_{s,\text{old}}\), the sample rate of the downsampled sequence is:

\begin{equation} f_{s,\text{new}} = \frac{f_{s,\text{old}}}{M} \end{equation}

For example, assume that an analog sinewave has been sampled to produce \(x_{\text{old}}(n)\). The downsampled sequence is: \[ x_{\text{new}}(m) = x_{\text{old}}(Nm) \] where \(M=3\), the result is shown in Figure 1.

{{< figure src="/ox-hugo/decimation_example.png" caption="<span class="figure-number">Figure 1: Sample rate conversion: (a) original sequence; (b) downsampled by \(M=3\) sequence" >}}

The spectral implications of downsampling are what we should expect as shown in Figure

{{< figure src="/ox-hugo/decimation_spectral_aliasing.png" caption="<span class="figure-number">Figure 2: 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

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 (b).

{{< figure src="/ox-hugo/decimation_two_stages.png" caption="<span class="figure-number">Figure 3: Decimation: (a) single-stage; (b) two-stage" >}}

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}

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 (a). The number of taps \(N\) required for a single-stage decimation would be:

\begin{equation} N = \frac{\text{Atten}}{22 (f_{\text{stop}} - f_{\text{pass}})} = \frac{60}{22(2.2/400 - 1.8/400)} = 2727 \end{equation}

which is way too large for practical implementation.

To reduce the number of necessary filter taps, we can partition the decimation problem into two stages. With \(M = 100\), \(F = (2200-1800)/2200\), Eq. eq:M1opt yields \(M_{1,\text{opt}} = 26.4\). 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 (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\). The total number of required taps is:

\begin{equation} N_{\text{total}} = N_{\text{LPF}_1} + N_{\text{LPF}_2} = \frac{60}{22(14.2/400-1.8/400)} + \frac{60}{22(2.2/16 - 1.8/16)} \approx 197 \end{equation}

Which is much more efficient that the single stage decimation.

{{< figure src="/ox-hugo/decimation_two_stage_example.png" caption="<span class="figure-number">Figure 4: 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." >}}

References:

<lyons11_under_digit_signal_proces>