# Filtering

This is a continuation from the previous tutorial - ** Fourier series and LTI systems**.

In a variety of applications, it is of interest to change the relative amplitudes of the frequency components in a signal or perhaps eliminate some frequency components entirely, a process referred to as filtering.

Linear time-invariant systems that change the shape of the spectrum are often referred to as ** frequency-shaping filters**. Systems that are designed to pass some frequencies essentially undistorted and significantly attenuate or eliminate others are referred to as

**.**

*frequency-selective filters*As indicated by eqs. (3.124) and (3.131) [refer to the *Fourier series and LTI systems tutorial*], the Fourier series coefficients of the output of an LTI system are those of the input multiplied by the frequency response of the system.

Consequently, filtering can be conveniently accomplished through the use of LTI systems with an appropriately chosen frequency response, and frequency-domain methods provide us with the ideal tools to examine this very important class of applications. In this and the following two tutorials, we take a first look at filtering through a few examples.

## 1. Frequency-Shaping Filters

One application in which frequency-shaping filters are often encountered is audio systems.

For example, LTI filters are typically included in such systems to permit the listener to modify the relative amounts of low-frequency energy (bass) and high-frequency energy (treble). These filters correspond to LTI systems whose frequency responses can be changed by manipulating the tone controls.

Also, in high-fidelity audio systems, a so-called equalizing filter is often included in the preamplifier to compensate for the frequency response characteristics of the speakers.

Overall, these cascaded filtering stages are frequently referred to as the equalizing or equalizer circuits for the audio system. Figure 3.22 illustrates the three stages of the equalizer circuits for one particular series of audio speakers.

In this figure, the magnitude of the frequency response for each of these stages is shown on a log-log plot. Specifically, the magnitude is in units of \(20\log_{10}|H(j\omega)|\), referred to as decibels or dB. The frequency axis is labeled in Hz (i.e., \(\omega/2\pi\)) along a logarithmic scale. A logarithmic display of the magnitude of the frequency response in this form is common and useful.

Taken together, the equalizing circuits in Figure 3.22 are designed to compensate for the frequency response of the speakers and the room in which they are located and to allow the listener to control the overall frequency response.

In particular, since the three systems are connected in cascade, and since each system modifies a complex exponential input \(Ke^{j\omega{t}}\) by multiplying it by the system frequency response at that frequency, it follows that the overall frequency response of the cascade of the three systems is the product of the three frequency responses.

The first two filters, indicated in Figures 3.22(a) and (b), together make up the control stage of the system, as the frequency behavior of these filters can be adjusted by the listener. The third filter, illustrated in Figure 3.22(c), is the equalizer stage, which has the fixed frequency response indicated.

The filter in Figure 3.22(a) is a low-frequency filter controlled by a two-position switch, to provide one of the two frequency responses indicated. The second filter in the control stage has two continuously adjustable slider switches to vary the frequency response within the limits indicated in Figure 3.22(b).

Another class of frequency-shaping filters often encountered is that for which the filter output is the derivative of the filter input, i.e., \(y(t)=\text{d}x(t)/\text{d}t\). With \(x(t)\) of the form \(x(t)=e^{j\omega{t}}\), \(y(t)\) will be \(y(t)=j\omega{e}^{j\omega{t}}\), from which it follows that the frequency response is

\[\tag{3.137}H(j\omega)=j\omega\]

The frequency response characteristics of a differentiating filter are shown in Figure 3.23. Since \(H(j\omega)\) is complex in general, and in this example in particular, \(H(j\omega)\) is frequently displayed (as in the figure) as separate plots of \(|H(j\omega)|\) and \(\measuredangle{H}(j\omega)\). The shape of this frequency response implies that a complex exponential input \(e^{j\omega{t}}\) will receive greater amplification for larger values of \(\omega\). Consequently, differentiating filters are useful in enhancing rapid variations or transitions in a signal.

One purpose for which differentiating filters are often used is to enhance edges in picture processing.

A black-and-white picture can be thought of as a two-dimensional "continuous-time" signal \(x(t_1,t_2)\), where \(t_1\) and \(t_2\) are the horizontal and vertical coordinates, respectively, and \(x(t_1,t_2)\) is the brightness of the image.

If the image is repeated periodically in the horizontal and vertical directions, then it can be represented by a two-dimensional Fourier series consisting of sums of products of complex exponentials, \(e^{j\omega_1t_1}\) and \(e^{j\omega_2t_2}\), that oscillate at possibly different frequencies in each of the two coordinate directions.

Slow variations in brightness in a particular direction are represented by the lower harmonics in that direction. For example, consider an edge corresponding to a sharp transition in brightness that runs vertically in an image. Since the brightness is constant or slowly varying along the edge, the frequency content of the edge in the vertical direction is concentrated at low frequencies. In contrast, since there is an abrupt variation in brightness across the edge, the frequency content of the edge in the horizontal direction is concentrated at higher frequencies.

Figure 3.24 illustrates the effect on an image of the two-dimensional equivalent of a differentiating filter. Figure 3.24(a) shows two original images and Figure 3.24(b) the result of processing those images with the filter. Since the derivative at the edges of a picture is greater than in regions where the brightness varies slowly with distance, the effect of the filter is to enhance the edges.

Specifically each image in Figure 3.24(b) is the magnitude of the two-dimensional gradient of its counterpart image in Figure 3.24(a) where the magnitude of the gradient of \(f(x,y)\) is

\[\left[\left(\frac{\partial{f(x,y)}}{\partial{x}}\right)^2+\left(\frac{\partial{f(x,y)}}{\partial{y}}\right)^2\right]^{1/2}\]

Discrete-time LTI filters also find a broad array of applications. Many of these involve the use of discrete-time systems, implemented using general- or special-purpose digital processors, to process continuous-time signals, a topic we discuss at some length in later tutorials.

In addition, the analysis of time series information, including demographic data and economic data sequences such as the stock market average, commonly involves the use of discrete-time filters.

Often the long-term variations (which correspond to low frequencies) have a different significance than the short-term variations (which correspond to high frequencies), and it is useful to analyze these components separately. Reshaping the relative weighting of the components is typically accomplished using discrete-time filters.

As one example of a simple discrete-time filter, consider an LTI system that successively takes a two-point average of the input values:

\[\tag{3.138}y[n]=\frac{1}{2}(x[n]+x[n-1])\]

In this case \(h[n]=\frac{1}{2}(\delta[n]+\delta[n-1])\), and from eq. (3.122) [refer to the *Fourier series and LTI systems tutorial*], we see that the frequency response of the system is

\[\tag{3.139}H(e^{j\omega})=\frac{1}{2}[1+e^{-j\omega}]=e^{-j\omega/2}\cos(\omega/2)\]

The magnitude of \(H(e^{j\omega})\) is plotted in Figure 3.25(a), and \(\measuredangle{H}(e^{j\omega})\) is shown in Figure 3.25(b).

As discussed in the *exponential and sinusoidal signals tutorial*, low frequencies for discrete-time complex exponentials occur near \(\omega=0,\pm2\pi,\pm4\pi,\ldots\), and high frequencies near \(\omega=\pm\pi,\pm3\pi,\ldots\).

This is a result of the fact that \(e^{j(\omega+2\pi)n}=e^{j\omega{n}}\), so that in discrete time we need only consider a \(2\pi\) interval of values of \(\omega\) in order to cover a complete range of distinct discrete-time frequencies.

As a consequence, any discrete-time frequency responses \(H(e^{j\omega})\) must be periodic with period \(2\pi\), a fact that can also be deduced directly from eq. (3.122) [refer to the *Fourier series and LTI systems tutorial*].

For the specific filter defined in eqs. (3.138) and (3.139), we see from Figure 3.25(a) that \(|H(e^{j\omega})|\) is large for frequencies near \(\omega=0\) and decreases as we increase \(|\omega|\) toward \(\pi\), indicating that higher frequencies are attenuated more than lower ones.

For example, if the input to this system is constant—i.e., a zero-frequency complex exponential \(x[n]=Ke^{j0\cdot{n}}=K\)—then the output will be

\[y[n]=H(e^{j\cdot0})Ke^{j\omega0\cdot{n}}=K=x[n]\]

On the other hand, if the input is the high-frequency signal \(x[n]=Ke^{j\pi{n}}=K(-1)^n\), then the output will be

\[y[n]=H(e^{j\pi})Ke^{j\pi\cdot{n}}=0\]

Thus, this system separates out the long-term constant value of a signal from its high-frequency fluctuations and, consequently, represents a first example of frequency-selective filtering, a topic we look at more carefully in the next subsection.

## 2. Frequency-Selective Filters

Frequency-selective filters are a class of filters specifically intended to accurately or approximately select some bands of frequencies and reject others.

The use of frequency-selective filters arises in a variety of situations. For example, if noise in an audio recording is in a higher frequency band than the music or voice on the recording is, it can be removed by frequency-selective filtering.

Another important application of frequency-selective filters is in communication systems. As we discuss in detail in later tutorials, the basis for amplitude modulation (AM) systems is the transmission of information from many different sources simultaneously by putting the information from each channel into a separate frequency band and extracting the individual channels or bands at the receiver using frequency-selective filters.

Frequency-selective filters for separating the individual channels and frequency-shaping filters (such as the equalizer illustrated in Figure 3.22) for adjusting the quality of the tone form a major part of any home radio and television receiver.

While frequency selectivity is not the only issue of concern in applications, its broad importance has led to a widely accepted set of terms describing the characteristics of frequency-selective filters.

In particular, while the nature of the frequencies to be passed by a frequency-selective filter varies considerably from application to application, several basic types of filter are widely used and have been given names indicative of their function.

For example, a ** lowpass filter** is a filter that passes low frequencies—i.e., frequencies around \(\omega=0\)—and attenuates or rejects higher frequencies.

A ** highpass filter** is a filter that passes high frequencies and attentuates or rejects low ones, and a

**is a filter that passes a band of frequencies and attenuates frequencies both higher and lower than those in the band that is passed.**

*bandpass filter*In each case, the ** cutoff frequencies** are the frequencies defining the boundaries between frequencies that are passed and frequencies that are rejected—i.e., the frequencies in the

**and**

*passband***.**

*stopband*Numerous questions arise in defining and assessing the quality of a frequency-selective filter. How effective is the filter at passing frequencies in the passband? How effective is it at attenuating frequencies in the stopband? How sharp is the transition near the cutoff frequency—i.e., from nearly free of distortion in the passband to highly attenuated in the stopband?

Each of these questions involves a comparison of the characteristics of an actual frequency-selective filter with those of a filter with idealized behavior. Specifically, an ** ideal frequency-selective filter** is a filter that exactly passes complex exponentials at one set of frequencies without any distortion and completely rejects signals at all other frequencies.

For example, a continuous-time ** ideal lowpass filter** with cutoff frequency \(\omega_\text{c}\) is an LTI system that passes complex exponentials \(e^{j\omega{t}}\) for values of \(\omega\) in the range \(-\omega_\text{c}\le\omega\le\omega_\text{c}\) and rejects signals at all other frequencies. That is, the frequency response of a continuous-time ideal lowpass filter is

\[\tag{3.140}H(j\omega)=\begin{cases}1,\qquad|\omega|\le\omega_\text{c},\\0,\qquad|\omega|\gt\omega_\text{c}\end{cases}\]

as shown in Figure 3.26.

Figure 3.27(a) depicts the frequency response of an ideal continuous-time highpass filter with cutoff frequency \(\omega_\text{c}\) and Figure 3.27(b) illustrates an ideal continuous-time bandpass filter with lower cutoff frequency \(\omega_\text{c1}\) and upper cutoff frequency \(\omega_\text{c2}\).

Note that each of these filters is symmetric about \(\omega=0\), and thus, there appear to be two passbands for the highpass and bandpass filters. This is a consequence of our having adopted the use of the complex exponential signal \(e^{j\omega{t}}\), rather than the sinusoidal signals \(\sin\omega{t}\) and \(\cos\omega{t}\), at frequency \(\omega\).

Since \(e^{j\omega{t}}=\cos\omega{t}+j\sin\omega{t}\) and \(e^{-j\omega{t}}=\cos\omega{t}-j\sin\omega{t}\), both of these complex exponentials are composed of sinusoidal signals at the same frequency \(\omega\). For this reason, we usually define ideal filters so that they have the symmetric frequency response behavior seen in Figures 3.26 and 3.27.

In a similar fashion, we can define the corresponding set of ideal discrete-time frequency-selective filters, the frequency responses for which are depicted in Figure 3.28.

In particular, Figure -3.28(a) depicts an ideal discrete-time lowpass filter, Figure 3.28(b) is an ideal highpass filter, and Figure 3.28(c) is an ideal bandpass filter.

Note that, as discussed in the preceding section, the characteristics of the continuous-time and discrete-time ideal filters differ by virtue of the fact that, for discrete-time filters, the frequency response \(H(e^{j\omega})\) must be periodic with period \(2\pi\), with low frequencies near even multiples of \(\pi\) and high frequencies near odd multiples of \(\pi\).

As we will see on numerous occasions, ideal filters are quite useful in describing idealized system configurations for a variety of applications. However, they are not realizable in practice and must be approximated. Furthermore, even if they could be realized, some of the characteristics of ideal filters might make them undesirable for particular applications, and a nonideal filter might in fact be preferable.

In detail, the topic of filtering encompasses many issues, including design and implementation. While we will not delve deeply into the details of filter design methodologies, in the following tutorials we will see a number of other examples of both continuous-time and discrete-time filters and will develop the concepts and techniques that form the basis of this very important engineering discipline.

The next tutorial introduces some ** examples of continuous-time filters described by differential equations**.