Digital Filter

In electronics, a digital filter is any electronic filter that works by performing digital mathematical operations on an intermediate form of a signal. This is in contrast to older analog filters which work entirely in the analog realm and must rely on physical networks of electronic components (such as resistors, capacitors, transistors, etc.) to achieve the desired filtering effect.

Digital filters can achieve virtually any filtering effect that can be expressed as a mathematical function or algorithm. The two primary limitations of digital filters are their speed (the filter can't operate any faster than the computer at the heart of the filter), and their cost. However as the cost of integrated circuits has continued to drop over time, digital filters have become increasingly commonplace and are now an essential element of many everyday objects such as radios, cellphones, and stereophonic sound|stereo receivers.

Digital filter advantages
Digital filters can easily realize performance characteristics far beyond what are practically implementable with analog filters. It is not particularly difficult, for example, to create a 1000 Hz low-pass filter which can achieve near-perfect transmission of a 999 Hz input while entirely blocking a 1001 Hz signal. Practical analog filters cannot discriminate between such closely spaced signals.

Also, for complex multi-stage filtering operations, digital filters have the potential to attain much better signal-to-noise ratios than analog filters. This is because whereas at each intermediate stage the analog filter adds more noise to the signal, the digital filter performs noiseless mathematical operations at each intermediate step in the transform. The primary source of noise in a digital filter is to be found in the initial analog-to-digital conversion (ADC) step where, in addition to analog circuit noise, the signal is subject to an unavoidable quantization error which is due to the finite resolution of the digital signal|digital representation of the signal.

Note also that frequency components exceeding half the Sample (signal)|sampling rate of the filter (cf. Nyquist sampling theorem) will be confounded (or aliased) by the filter. Thus an anti-aliasing filter is usually placed ahead of the ADC circuitry to prevent these high-frequency components from aliasing.

Types of digital filters
Many digital filters are based on the Fast Fourier transform, a mathematical algorithm that quickly extracts the frequency spectrum of a signal, allowing the spectrum to be manipulated (such as to create pass-band filters) before converting the modified spectrum back into a time-series signal.

The transfer function for a typical linear digital filter can be expressed as a transform in the Z-domain, as:


 * $$H(z) = \frac{B(z)}{A(z)} = \frac$$

where M is the order of the filter. See Z-transform's LCCD equation for further discussion of this transfer function.

This form is for a recursive filter, which typically leads to infinite impulse response behaviour, but if the denominator is unity, then this is the form for a finite impulse response filter.

Another form of a digital filter is that of a state-space model. A well used state-space filter is the Kalman filter published by Rudolf Kalman in 1960.

Converting the transfer function to a difference equation
In discrete-time systems, the digital filter is often implemented by converting the transfer function to a linear constant-coefficient difference equation (LCCD) via the Z-transform. The discrete frequency-domain transfer function is written as the ratio of two polynomials. For example:


 * $$H(z) = \frac{(z+1)^2} {(z-\frac{1}{2}) (z+\frac{3}{4})}$$

This is expanded:
 * $$H(z) = \frac{z^2+ 2z +1} {z^2 +\frac{1}{4} z - \frac{3}{8}}$$

and divided by the highest order of $$z$$:

H(z) = \frac{1 + 2z^{-1} +z^{-2}} {1 +\frac{1}{4} z^{-1} - \frac{3}{8} z^{-2}} = \frac{Y(z)}{X(z)} $$

The coefficients of the denominator, $$a_{k}$$, are the 'feed-backward' coefficients and the coefficients of the numerator are the 'feed-forward' coefficients, $$b_{k}$$. The resultant linear difference equation is:

y[n] = -\sum_{k=1}^{N} a_{k} y[n-k] + \sum_{k=0}^{M} b_{k} x[n-k] $$

or, for the example:



y[n] = x[n] + 2x[n-1] + x[n-2] - \frac{1}{4} y[n-1] + \frac{3}{8} y[n-2] $$

This equation shows how to compute the next output sample, $$y[n]$$, in terms of the past outputs, $$y[n-p]$$, the present input, $$x[n]$$, and the past inputs, $$x[n-p]$$. In this form, the filter is amenable to numerical simulation via straightforward iteration.