# Digital Filters - INTRODUCTION, TIME-DOMAIN DESCRIPTION, DESIGN OF, COMPARISON OF, EXAMPLES OF FILTERING, Example 1, Example 2

### signal figure shown pass

**Gordana Jovanovic-Dolecek***INAOE, Mexico*

## INTRODUCTION

A signal is defined as any physical quantity that varies with changes of one or more independent variables, and each can be any physical value, such as time, distance, position, temperature, or pressure (Oppenheim & Schafer, 1999; Elali, 2003; Smith, 2002). The independent variable is usually referred to as “time”. Examples of signals that we frequently encounter are speech, music, picture, and video signals. If the independent variable is continuous, the signal is called continuous-time signal or analog signal, and is mathematically denoted as *x* (t). For discrete-time signals the independent variable is a discrete variable and therefore a discrete-time signal is defined as a function of an independent variable *n* , where *n* is an integer. Consequently, *x* (n) represents a sequence of values, some of which can be zeros, for each value of integer *n* . The discrete–time signal is not defined at instants between integers and is incorrect to say that *x* (n) is zero at times between integers. The amplitude of both the continuous and discrete-time signals may be continuous or discrete. Digital signals are discrete-time signals for which the amplitude is discrete. Figure 1 illustrates the analog and the discrete-time signals.

Most signals we encounter are generated by natural means. However, a signal can also be generated synthetically or by computer simulation (Mitra, 2001).

A signal carries information, and objective of signal processing is to extract useful information carried by the signal. The method of information extraction depends on the type of signal and the nature of the information being carried by the signal. “Thus, roughly speaking, signal processing is concerned with the mathematical representation of the signal and algorithmic operation carried out on it to extract the information present” (Mitra, 2001, p. 1).

Analog signal processing (ASP) works with the analog signals, while digital signal processing (DSP) works with digital signals. Since most of the signals we encounter in nature are analog, DSP consists of these three steps:

- A/D conversion (transformation of the analog signal into the digital form)
- Processing of the digital version
- Conversion of the processed digital signal back into an analog form (D/A)

We now mention some of the advantages of DSP over ASP (Diniz, Silva, & Netto, 2002; Grover & Deller, 1999; Ifeachor & Jervis, 2001; Mitra, 2001; Stein, 2000):

Less sensitivity to tolerances of component values and independence of temperature, aging and many other parameters.

- Programmability, that is, the possibility to design one hardware configuration that can be programmed to perform a very wide variety of signal processing tasks simply by loading in different software.
- Several valuable signal processing techniques that cannot be performed by analog systems, such as for example linear phase filters.
- More efficient data compression (maximum of information transferred in the minimum of time).
- Any desirable accuracy can be achieved by simply increasing the word length.
- Applicability of digital processing to very low frequency signals, such as those occurring in seismic applications. (Analog processor would be physically very large in size.)
- Recent advances in very large scale integrated (VLSI) circuits, make possible to integrate highly sophisticated and complex digital signal processing systems on a single chip.

Nonetheless, DSP has some disadvantages (Diniz et al., 2002; Grover & Deller, 1999; Ifeachor & Jervis, 2001; Mitra, 2001; Stein, 2000):

- Increased complexity: The need for additional pre-and post-processing devices such as A/D and D/A converters and their associated filters and complex digital circuitry.
- The limited range of frequencies available for processing.
- Consummation of power: Digital systems are constructed using active devices that consume electrical power whereas a variety of analog processing algorithms can be implemented using passive circuits employing inductors, capacitors, and resistors that do not need power.

In various applications, the aforementioned advantages by far outweigh the disadvantages and with the continuing decrease in the cost of digital processor hardware, the field of digital signal processing is developing fast. “Digital signal processing is extremely useful in many areas, like image processing, multimedia systems, communication systems, audio signal processing” (Diniz et al., 2002, pp. 2-3).

The system which performs digital signal processing i.e., transforms an input sequence *x* ( *n* ) into a desired output sequence *y* ( *n* ), is called a digital filter (see Figure 2).

We consider a filter is linear-time invariant system (LTI). The linearity means that the output of a scaled sum of the inputs is the scaled sum of the corresponding outputs, known as the principle of superposition. The time invariance says that a delay of the input signal results in the same delay of the output signal.

## TIME-DOMAIN DESCRIPTION

If the input sequence *x* ( *n* ) is a unit impulse sequence d( *n* ) (Figure 3), then the output signal represents the characteristics of the filter called the impulse response, and denoted by *h* ( *n* ). We can therefore describe any digital filter by its impulse response *h* ( *n* ).

Depending on the length of the impulse response *h* ( *n* ), digital filters are divided into filters with the *finite impulse response* (FIR) and *infinite impulse response* (IIR).

For example, let us consider an FIR filter of length *N* = 8 and impulse response as shown in Figure 4a. In Figure 4b, the initial 20 samples of the impulse response of the IIR filter are plotted *.*

In practical applications, one is only interested in designing stable digital filters, that is, whose outputs do not become infinite. The stability of a digital filter can be expressed in terms of the absolute values of its unit sample responses (Kuc, 1988; Mitra, 2001; Proakis & Manolakis, 1996; Smith, 2002).

Because the summation (4) for an FIR filter is always finite, FIR filters are always stable. Therefore, the stability problem is relevant in designing IIR filters.

The operation in time domain which relates the input signal *x* ( *n* ), impulse response *h* ( *n* ) and the output signal *y* ( *n* ), is called the *convolution* , and is defined as where * is the standard sign for convolution. Figure 5 illustrates the convolution operation.

The output *y* ( *n* ) can also be computed recursively using the following difference equation (Kuc, 1988; Mitra, 2001; Proakis & Manolakis, 1996; Silva & Jovanovic-Dolecek, 1999) where *x* ( *n* - *k* ) and *y* ( *n* - *k* ) are input and output sequences *x* ( *n* ) and *y* ( *n* ) delayed by *k* samples, and *b* *k* and *a* *k* , are constants. The order of the filter is given by the maximum value of *N* and *M* . The first sum is a *non-recursive* , while the second sum is a *recursive* part. Typically, FIR filters have only non-recursive part, while IIR filters always have the recursive part. As a consequence, FIR and IIR filters are also known as non-recursive and recursive filters, respectively.

From (6) we see that the principal operations in a digital filter are multiplications, delays and additions. From the equation (6) we can draw the structure of the digital filter which is also known as a direct form and is shown in Figure 6. More details about filter structures can be found for example in Mitra (2001), Kuc (1988), and Proakis and Manolakis (1996).

## DESIGN OF DIGITAL FILTERS

The design of digital filter is the determination of a realizable system function *H* ( *z* ) approximating the given frequency response specification (Mitra, 2001; Smith, 2002; Stearns, 2002; White, 2000). There are two major issues that need to be answered before one can develop *H* ( *z* ). The first issue is the development of a reasonable magnitude specification from the requirements of the filter application. The second issue is the choice on whether an FIR or an IIR digital filter is to be designed (Mitra, 2001; White, 2000).

In most practical applications the problem of interest is the digital filter design for a given magnitude response specification. If necessary, the phase response of the designed filter can be corrected by equalizers filters (Mitra, 2001).

The filter that only passes low frequencies and rejects high frequencies is called a lowpass filter. The ideal lowpass filter has the magnitude specification givenby by

where ? *c* is called cutoff frequency. This filter can not be realized so the realizable specification is shown in Figure 10. The cutoff frequency ? c is replaced by the transition band in which the magnitude specification is not given. The magnitude responses in the passband and the stopband are given with some acceptable tolerances, as shown in Figure 10.

The passband is defined for frequencies

where ? *p* is called the passband edge frequency. The characteristic in the passband is defined as

where d *1* is called the passband ripple.

In the stopband, defined by the stopband edge frequency ? *s*

the magnitude response approximates zero with an error of d 2 , called the stopband ripple

If the filter specification is given in terms of the Gain function in dB, the passband ripple *Rp* is then

and the stopband attenuation *A* *s* is

In a similar way, we can define the specifications for the highpass, bandpass, and stopband filters. For more details see White (2000) and Mitra (2001).

The principal methods for the design of FIR filters are: frequency sampling, window methods, weighted-least-squares (WLS), Remez method, and so on. For more details see White (2000) and Diniz et al. (2002).

As an example an FIR filter with the passband edge ? *p* =0.2p, the stopband edge ? *p* =0.3p, passband ripple *R* *p* =0.1 dB and the stopband attenuation *A* *s* =60 dB is plotted in Figure 11a and 11b. The designed filter has order of *N* = 57.

The most widely used methods for IIR filter design are extensions of the methods for the analog filter design (Mitra, 2001; Silva & Jovanovic-Dolecek, 1999; White, 2002). The reason is two-fold. Like IIR filters, analog filters have an infinite impulse response, and the methods for the design of analog filters are highly advanced. As a first step, the digital filter specification is converted into an analog lowpass filter specification, and an analog filter meeting this specification is designed. Next, the designed analog filter is transformed into a desired digital filter. Commonly used transformation methods are bilinear and impulse invariance method (Mitra, 2001, Silva & Jovanovic-Dolecek, 1999). If a filter other than a Page 187 lowpass filter needs to be designed, the method also includes the frequency transformation in which the designed lowpass filter is transformed into the appropriate type (highpass, bandpass, or band-rejecting filter).

As an example, an elliptic filter is designed with the same specification as the filter plotted in Figure 11a and 11b. Its impulse response and the gain are plotted in Figure 11c and 11d. The impulse response, being infinite, is shown only for the initial 20 samples.

## COMPARISON OF DIGITAL FILTERS

FIR filters are often preferred over IIR filters because they have many very desirable properties (Mitra, 2001; Proakis & Manolakis, 1996), such as linear phase, stability, absence of limit cycle, and good quantization properties. Arbitrary frequency responses can be designed, and excellent design techniques are available for a wide class of filters.

The main disadvantage of FIR filters is that they involve a higher degree of computational complexity compared to IIR filters with equivalent magnitude response. It has been shown that for most practical filter specifications the ratio of the FIR filter order and IIR filter order is typically of tens or more (Mitra, 2001), and as a result the IIR filter is computationally more efficient. However, if the linearity of the phase is required, the IIR filter must be equalized and in this case the savings in computation may no longer be that significant (Mitra, 2001).

In many applications where the linearity of the phase is not required, the IIR filters are preferable because of the lower computational requirements.

FIR filters of length *N* require ( *N* +1)/2 multipliers if *N* is odd and *N* /2 multipliers if *N* is even, *N* -1 adders and *N* -1 delays. The complexity of the implementation increases with the increase in the number of multipliers.

Over the past few years, there have been a number of attempts to reduce the number of multipliers, like Adams and Willson (1983); Adams and Willson (1984); Ramakrishnan (1989); Bartolo, Clymer, Burgess, and Turnbull (1998) and so on. Another approach is a true multiplier-less design where the coefficients are reduced to simple integers or to simple combinations of powers of two, for example, Tai and Lin (1992), Yli-Kaakinen and Saramaki (2001), Liu, Chen, Shin, Lin, and Jou (2001), Coleman (2002), Jovanovic-Dolecek and Mitra (2002), and so on.

## EXAMPLES OF FILTERING

## Example 1

A simple low-pass digital signal *x* 1 ( *n* ) is plotted in Figure12.a. Its spectral characteristic is shown in Figure 12b. Time- and frequency-domain representations of a high-pass signal *x* 2 ( *n* ) are shown in Figures 12c and 12d.

Suppose we add signals *x* 1 ( *n* ) and *x* 2 ( *n* ). The result is shown in Figure 13. The composite signal has both low-pass and high-pass components. In order to eliminate the high-pass components we need to pass this signal through a low-pass filter which will preserve only the low-pass components and eliminate the high-pass ones. The low-pass filter is shown in Figure 13. Figure 14 shows the result of filtering of the composite signal.

## Example 2

In this example we consider a signal composed of two cosine signals *x* 1 ( *n* ) and *x* 2 ( *n* ), shown in Figure 16.

The result of adding these two signals is shown in Figure 17. Two peaks at 0.2p and 0.6p in the spectral characteristic correspond to the cosine components *x* 1 and *x* 2 , respectively.

Suppose we now apply low-pass filtering to the sum of these two cosine signals. The designed low-pass filter is shown in Figure 18, and the result of filtering is shown in Figure 19. Notice that the second high pass cosine signal has been eliminated.

To eliminate the low-pass cosine signal, we design the high-pass filter shown in Figure 20. The filtered signal is shown in Figure 21.

## Example 3

The following figure presents an example of a speech signal (McClellan, Schafer, & Yoder, 1998).

We consider one part of the signal (the samples from 1300 to 1500), which is shown in Figure 23a. This figure shows the waveform samples, while Figure 23b. presents the spectral characteristic of this waveform. We apply two low-pass filters. One of them passes all spectral components below 0.25p and eliminates all spectral components higher than 0.3p (Figure 24a). The other filter (Figure 24b) passes only spectral components bellow 0.05p, and attenuates all components higher than 0.1p.

The speech signal filtered by the first filter is shown in Figure 25, while the result of filtering with the second filter is shown in Figure 26. Notice that the resulting signal becomes smoother when higher frequencies are eliminated. By comparing both filtered signals one can notice that even smoother signal can be obtained when lower frequencies are preserved. Therefore, low-pass filtering can be used to remove large fluctuations in the signal.

We now apply two high-pass filters shown in Figure 27 to the speech signal from Figure 23. The result of filtering shown in Figures 28 and 29 demonstrates that the signal in which higher frequency components are preserved is less smooth and has more fluctuations.

## Example 4

In this example we illustrate the effect of filtering of an image. Filtering is used for modifying or enhancing an image, for example to emphasize certain features or remove others. In linear image filtering, two-dimensional filters are used, and they can be obtained from corresponding one-dimensional filters. FIR filters are more convenient for image filtering, because of stability, ease of design and implementation. We apply low pass and high pass filtering to the image signal, (generated in MATLAB), given in Figure 30. The two-dimensional low-pass filter and the result of filtering are shown in Figures 31a and 31b, respectively. The two-dimensional high-pass filter, shown in Figure 30c, is applied to the image, and the resulting image is shown in Figure 30d. We can notice that the effect of low-pass filtering is image smoothing, while high-pass filtering causes enhancement of variations across the image.

The noise is added to the image and the result is shown in Figure 32a. Two filters are applied to eliminate the noise. Figure 32b shows the result of applying a simple averaging filter, while Figure 32c shows the effect of applying a special filter called the median filter. Notice that the median filter is much better in removing noise.

## CONCLUSION

Digital signal processing lies at the heart of the modern technological development finding the applications in a different areas like image processing, multimedia, audio signal processing, communications, and so on. A system which performs digital signal processing is called a digital filter. The digital filter changes the characteristics of the input digital signal in order to obtain the desired output signal. Digital filters either have a finite impulse response, (FIR), or an infinite impulse response, (IIR). FIR filters are often preferred because of desired characteristics, such as linear phase and no stability problems. The main disadvantage of FIR filters is that they involve a higher degree of computational complexity compared to IIR filters with equivalent magnitude response. In many applications where the linearity of the phase is not required, the IIR filters are preferable because of the lower computational requirements. Over the past several years there have been a number of attempts to reduce the complexity of FIR filters. The design of FIR filters with low complexity and IIR filters with approximately linear phase are the major digital filter design tasks.

## User Comments