# Practical (Nonideal) Filters

Ideally, a filter has a unit gain (0 dB) in the passband and a gain of zero (–∞ dB) in the stopband. However, real filters cannot fulfill all the criteria of an ideal filter. In practice, a finite transition band always exists between the passband and the stopband. In the transition band, the gain of the filter changes gradually from one (0 dB) in the passband to zero (–∞ dB) in the stopband. Practical filters might have passband ripple, and the stopband attenuation of the filter cannot be infinite.

## Transition Band

The following figure shows the passband, the stopband, and the transition band for each type of practical filter.

In each plot in the previous figure, the x-axis represents frequency, and the y-axis represents the magnitude of the filter in dB. The passband is the region within which the gain of the filter varies from 0 dB to –3 dB.

## Passband Ripple and Stopband Attenuation

In many applications, you can allow the gain in the passband to vary slightly from unity. This variation in the passband is the passband ripple, or the difference between the actual gain and the desired gain of unity. In practice, the stopband attenuation cannot be infinite, and you must specify a value with which you are satisfied. Measure both the passband ripple and the stopband attenuation in decibels (dB). Equation A defines a decibel.

| (A)

where log denotes the base 10 logarithm, Ai(f) is the amplitude at a particular frequency f before filtering, and A0(f) is the amplitude at a particular frequency f after filtering.

When you know the passband ripple or stopband attenuation, you can use Equation A to determine the ratio of input and output amplitudes. The ratio of the amplitudes shows how close the passband or stopband is to the ideal. For example, for a passband ripple of –0.02 dB, Equation A yields the following set of equations.

| (B)

| (C)

Equations B and C show that the ratio of input and output amplitudes is close to unity, which is the ideal for the passband.

Practical filter design attempts to approximate the ideal desired magnitude response, subject to certain constraints. The following table compares the characteristics of ideal filters and practical filters.

Characteristic | Ideal Filters | Practical Filters
Passband | Flat and constant | Might contain ripples
Stopband | Flat and constant | Might contain ripples
Transition band | None | Have transition regions

Practical filter design involves compromise, allowing you to emphasize a filter characteristic you want at the expense of a characteristic you do not want. The compromises you can make depend on whether the filter is an FIR or IIR filter and the design algorithm.