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 Edit

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 filtersEdit

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:

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 Edit

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:

This is expanded:

and divided by the highest order of :

The coefficients of the denominator, , are the 'feed-backward' coefficients and the coefficients of the numerator are the 'feed-forward' coefficients, . The resultant linear difference equation is:

or, for the example:

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