digital-brain/content/zettels/decimation.md

133 lines
6.7 KiB
Markdown
Raw Normal View History

2022-03-01 17:02:01 +01:00
+++
title = "Decimation"
author = ["Dehaeze Thomas"]
draft = false
+++
Tags
: [Digital Signal Processing]({{< relref "digital_signal_processing.md" >}})
<div class="definition">
Decimation is the two-step process of low pass filtering followed by and operation known as downsampling.
</div>
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}
<div class="exampl">
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--fig:decimation-example).
<a id="figure--fig:decimation-example"></a>
{{< figure src="/ox-hugo/decimation_example.png" caption="<span class=\"figure-number\">Figure 1: </span>Sample rate conversion: (a) original sequence; (b) downsampled by \\(M=3\\) sequence" >}}
</div>
The spectral implications of downsampling are what we should expect as shown in Figure
<a id="figure--fig:decimation-spectral-aliasing"></a>
{{< figure src="/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).
<a id="figure--fig:decimation-two-stages"></a>
{{< figure src="/ox-hugo/decimation_two_stages.png" caption="<span class=\"figure-number\">Figure 3: </span>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}
<div class="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:
\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](#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\\).
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.
<a id="figure--fig:decimation-two-stage-example"></a>
{{< figure src="/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." >}}
</div>
2022-03-15 15:38:10 +01:00
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:
<ul class="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>
2022-03-01 17:02:01 +01:00
## References: {#references}
<lyons11_under_digit_signal_proces>