# Downsampling

In signal processing, downsampling (or "subsampling") is the process of reducing the sampling rate of a signal. This is usually done to reduce the data rate or the size of the data.

The downsampling factor (commonly denoted by M) is usually an integer or a rational fraction greater than unity. This factor multiplies the sampling time or, equivalently, divides the sampling rate. For example, if 16-bit compact disc audio (sampled at 44,100 Hz) is downsampled to 22,050 Hz, the audio is said to be downsampled by a factor of 2. The bit rate is also reduced in half, from 1,411,200 bit/s to 705,600 bit/s, assuming that each sample retains its bit depth of 16 bits.

## Maintaining the sampling theorem criterion

Since downsampling reduces the sampling rate, it is usually a good idea to make sure the Nyquist–Shannon sampling theorem criterion is maintained relative to the new lower sample rate, to avoid aliasing in the resulting digital signal. To ensure that the sampling theorem is satisfied, or approximately so, a low-pass filter is used as an anti-aliasing filter to reduce the bandwidth of the signal before the signal is downsampled; the overall process (low-pass filter, then downsample) is sometimes called decimation.

If the original signal had been bandwidth limited, and then first sampled at a rate higher than the Nyquist rate, then the sampled signal may already have a bandwidth compliant with the requirements of the sampling theorem at the lower rate, so the downsampling can be done directly without any additional filtering. Downsampling only changes the sample rate, not the bandwidth, of the signal. The only reason to filter the bandwidth is to avoid the case where the new sample rate would become lower than the Nyquist rate and cause aliasing.

In some cases, the anti-aliasing filter can be a band-pass filter; the aliasing inherent in downsampling will then transpose a band of interest to baseband samples. A bandpass signal, i.e. a band-limited signal whose minimum frequency is different from zero, can be downsampled avoiding superposition of the spectra if certain conditions are satisfied; see undersampling.

## Downsampling by integer factor

Downsampling a sequence $\scriptstyle x[n]$ by retaining only every Mth sample creates a new sequence  $\scriptstyle y[n] = x[nM].$  If the original sequence contains significant normalized frequency components in the region $\scriptstyle [0.5/M,\ 1-0.5/M]$ (cycles/sample), the downsampler should be preceded by a low-pass filter with cutoff frequency $\scriptstyle 0.5/M$.[note 1]  In this application, such an anti-aliasing filter is referred to as a decimation filter, and the combined process of filtering (convolution) and downsampling is called decimation.

The process described above would generate an output sample for every input sample, and then M-1 of every M outputs would be discarded. Such is the process for an IIR filter that relies on feedback from output to input. With FIR filtering, it is an easy matter to compute only every Mth output. The calculation performed by a decimating FIR filter for the nth output sample is a dot product:

$y[n] = \sum_{k=0}^{K-1} x[nM-k]\cdot h[k],$

where the h[•] sequence is the impulse response, and K is its length. In a general purpose processor, after computing y[n], the easiest way to compute y[n+1] is to advance the starting index in the x[•] array by M, and recompute the dot product.

Impulse response coefficients taken at intervals of M form a subsequence, and there are M such subsequences (phases) multiplexed together. The dot product is the sum of the dot products of each subsequence with the corresponding samples of the x[•] sequence. Furthermore, because of decimation by M, the stream of x[•] samples involved in any one of the M dot products is never involved in the other dot products. Thus M low-order FIR filters are each filtering one of M multiplexed phases of the input stream, and the M outputs are being summed. This viewpoint offers a different implementation that might be advantageous in a multi-processor architecture. In other words, the input stream is demultiplexed and sent through a bank of M filters whose outputs are summed. When implemented that way, it is called a polyphase filter.

For completeness, we now mention that a possible implementation of each phase is to replace the coefficients of the other phases with zeros in a copy of the h[•] array, process the original x[•] sequence at the input rate, and decimate the output by a factor of M. The equivalence of this inefficient method and the implementation described above is known as the first Noble identity.[1]

## Downsampling by rational fraction

Let M/L denote the downsampling factor.

1. Upsample by a factor of L
2. Downsample by a factor of M

A proper upsampling design requires an interpolation filter after increasing the data rate and that a proper downsampling design requires a filter before eliminating some samples. These two low-pass filters can be combined into a single filter.

These two steps are generally not interchangeable. Downsampling results in a loss of data and, if performed first, could result in data loss if there is any data filtered out by the downsampler's low-pass filter. Since both interpolation and anti-aliasing filters are low-pass filters, the filter with the smallest bandwidth is more restrictive and can therefore be used in place of both filters. When the rational fraction M/L is greater than unity then L < M and the single low-pass filter should have cutoff at $\scriptstyle 0.5/M$ cycles/sample.

NOTE: Upsampling first is necessary in all cases where the rate is not an even multiple. E.g.: if a sample rate of 2x is changed to a rate of 1x by averaging every pair of samples this would be equivalent to a low pass filtering operation. But taking every other sample would be equivalent to up then down sampling in this special case where the multiple was 2 to 1, so there is no need to do an upsample first.

## Discrete-time Fourier transform (DTFT)

Let X(f) be the Fourier transform of any function, x(t), whose samples at some interval, T, equal the x[n] sequence. Then the DTFT of the x[n] sequence is the Fourier series representation of a periodic summation of X(f):

$\underbrace{ \sum_{n=-\infty}^{\infty} \overbrace{x(nT)}^{x[n]}\ e^{-i 2\pi f nT} }_{\text{DTFT}} = \frac{1}{T}\sum_{k=-\infty}^{\infty} X(f-k/T).$

(Eq.1)

When T has units of seconds, $\scriptstyle f$ has units of hertz. Replacing T with MT in the formulas above gives the DTFT of the decimated sequence, x[nM]:

$\sum_{n=-\infty}^{\infty} x(n\cdot MT)\ e^{-i 2\pi f n(MT)} \equiv \frac{1}{MT}\sum_{k=-\infty}^{\infty} X\left(f-\tfrac{k}{(MT)}\right).$

(Eq.2)

The periodic summation has been reduced in amplitude and periodicity by a factor of M.  Aliasing occurs when adjacent copies of X(f) overlap. If an anti-aliasing filter is applied to the x[n] sequence, it should have a cutoff frequency  $< \tfrac{0.5}{MT}$  hertz at sample-rate 1/T, or (equivalently) a cutoff  $< \tfrac{0.5}{M}$  at normalized frequency 1.0 cycles/sample.

Alternatively, the sample-rate can be presumed to be held constant, meaning that the interval between the retained samples is reduced from MT to T. The resulting Fourier series is:

$\sum_{n=-\infty}^{\infty} x(n\cdot MT)\ e^{-i 2\pi f nT} = \frac{1}{T}\sum_{k=-\infty}^{\infty} X_M(f-k/T) = \frac{1}{MT}\sum_{k=-\infty}^{\infty} X\left(\tfrac{f-k/T}{M}\right) ,$

(Eq.3)

where:

$X_M(f)\ \stackrel{\mathrm{def}}{=}\ \mathcal{F}\left \{x(Mt)\right \} \equiv \tfrac{1}{M}\cdot X(f/M).$

The original periodicity is restored, but $\scriptstyle X(f/M)$  is M times wider than $\scriptstyle X(f),$  which can cause adjacent copies to overlap unless the x[n] sequence is pre-filtered as described above.   Eq.2 and Eq.3 are identical, except for a frequency scale factor.

## Z-transform

The z-transform of the x[n] sequence is defined by:

$X(z)\ \stackrel{\mathrm{def}}{=} \sum_{n=-\infty}^{\infty} x[n]\ z^{-n},$   where z is a complex variable.[note 2]

On the unit circle, z is constrained to values of the form  $e^{i \omega}.$  Then one cycle of  $X(e^{i \omega}), \ \scriptstyle -\pi \ \le \ \omega \ \le \ \pi$  is identical to one period  $\left(\scriptstyle -\frac{0.5}{T} \ \le \ f \ \le \ \frac{0.5}{T}\right)$  of Eq.1.

The z-transform of the decimated sequence is:

$X_M(z)\ \stackrel{\mathrm{def}}{=} \sum_{n=-\infty}^{\infty} x[nM]\ z^{-n},$

and one cycle of  $X_M(e^{i \omega}), \ \scriptstyle -\pi \ \le \ \omega \ \le \ \pi$  is identical to one period of Eq.2 and Eq.3.

In terms of  $X(z),$  it can be shown that:[2][3]

$X_M(z) = \frac{1}{M} \sum_{k=0}^{M-1} X\left(z^{\tfrac{1}{M}} \cdot e^{-i \tfrac{2\pi}{M} k}\right) = \frac{1}{M} \sum_{k=0}^{M-1} X\left( e^{\tfrac{i(\omega - 2\pi k)}{M} } \right).$

The periodicity of each "k" term is 2πM radians, and the terms are offset by multiples of 2π. So the periodicity of the summation is 2π (as required by the z-transform definition). The k=0 term is  $X(e^{i \omega})$  stretched across 2πM radians, which means that it exceeds the unit circle and folds back on itself M-1 times, or (equivalently) it overlaps and is overlapped by the other M-1 terms of the summation. But if its expanded bandwidth is still limited to the region  $\scriptstyle (-\pi \ < \ \omega \ < \ \pi),$  the folding/overlapping does not cause aliasing.  That can be assured by an anti-alias filter with a cutoff frequency < π/M at frequency 2π (radians/sample), or (equivalently) a cutoff  $< \tfrac{0.5}{M}$  at frequency 1.0 cycles/sample.

For comparison with the DTFT (Eq.2),  ω = 2π corresponds to $\scriptstyle f=1/(MT).$  And it corresponds to $\scriptstyle f=1/T$  in the other Fourier series (Eq.3).

## Notes

1. ^ Realizable low-pass filters have a "skirt", where the response diminishes from near unity to near zero. So in practice the cutoff frequency is placed far enough below the theoretical cutoff that the filter's skirt is contained below the theoretical cutoff.
2. ^ In a discussion involving multiple types of transforms, it is a common practice to distinguish them on the basis of their arguments, rather than the function name.
• Fourier transform is denoted by  $X(f)$  or  $X(\omega).$
• Z transform is denoted by  $X(z).$
• DTFT is denoted by  $X(e^{i \omega})$  or  $X(e^{i 2\pi fT}),$  but sometimes  $X_{2\pi}(\omega)$  or  $X_{1/T}(f).$

## Citations

1. ^ [Gilbert]; Nguyen, Truong (1996-10-01). Wavelets and Filter Banks (2 ed.). Wellesley,MA: Wellesley-Cambridge Press. pp. 100–101. ISBN 0961408871.
2. ^ Schniter, Phil (March 2006). "ECE-700 Multirate Notes". p. 2. Retrieved 2013-12-10.
3. ^ "DSP and Digital Filters (2013-3810)". 2013. p. 68. Retrieved 2013-12-10.

## References

• Oppenheim, Alan V.; Ronald W. Schafer, John R. Buck (1999). Discrete-Time Signal Processing (2nd ed.). Prentice Hall. ISBN 0-13-754920-2.
• Proakis, John G. (2000). Digital Signal Processing: Principles, Algorithms and Applications (3rd ed.). India: Prentice-Hall. ISBN 8120311299.