Cart 0

Examples of Discrete-Time Filters Described by Difference Equations

This is a continuation from the previous tutorial - examples of continuous-time filters described by differential equations.


As with their continuous-time counterparts, discrete-time filters described by linear constant-coefficient difference equations are of considerable importance in practice. Indeed, since they can be efficiently implemented in special- or general-purpose digital systems, filters described by difference equations are widely used in practice.

As in almost all aspects of signal and system analysis, when we examine discrete-time filters described by difference equations, we find both strong similarities and important differences with the continuous-time case.

In particular, discrete-time LTI systems described by difference equations can either be recursive and have impulse responses of infinite length (IlR systems) or be nonrecursive and have finite-length impulse responses (FIR systems).

The former are the direct counterparts of continuous-time systems described by differential equations illustrated in the examples of continuous-time filters described by differential equations tutorial, while the latter are also of considerable practical importance in digital systems.

These two classes have distinct sets of advantages and disadvantages in terms of ease of implementation and in terms of the order of filter or the complexity required to achieve particular design objectives.

In this tutorial we limit ourselves to a few simple examples of recursive and nonrecursive filters, while in later tutorials we develop additional tools and insights that allow us to analyze and understand the properties of these systems in more detail.


1. First-Order Recursive Discrete-Time Filters

The discrete-time counterpart of each of the first-order filters considered in the examples of continuous-time filters described by differential equations tutorial is the LTI system described by the first-order difference equation


From the eigenfunction property of complex exponential signals, we know that if \(x[n]=e^{j\omega{n}}\), then \(y[n]=H(e^{j\omega})e^{j\omega{n}}\), where \(H(e^{j\omega})\) is the frequency response of the system.

Substituting into eq. (3.151), we obtain




so that


The magnitude and phase of \(H(e^{j\omega})\) are shown in Figure 3.34(a) for \(a=0.6\) and in Figure 3.34(b) for \(a=-0.6\).


Figure 3.34.  Frequency response of the first-order recursive discrete-time filter of eq. (3.151):  (a) \(a=0.6\);  (b) \(a=-0.6\).


We observe that, for the positive value of \(a\), the difference equation (3.151) behaves like a lowpass filter with minimal attenuation of low frequencies near \(\omega=0\) and increasing attenuation as we increase \(\omega\) toward \(\omega=\pi\).

For the negative value of \(a\), the system is a highpass filter, passing frequencies near \(\omega=\pi\) and attenuating lower frequencies.

In fact, for any positive value of \(a\lt1\), the system approximates a lowpass filter, and for any negative value of \(a\gt-1\), the system approximates a high pass filter, where \(|a|\) controls the size of the filter passband, with broader passbands as \(|a|\) is decreased.

As with the continuous-time examples, we again have a trade-off between time domain and frequency domain characteristics. In particular, the impulse response of the system described by eq. (3.151) is


The step response \(s[n]=u[n]*h[n]\) is


From these expressions, we see that \(|a|\) also controls the speed with which the impulse and step responses approach their long-term values, with faster responses for smaller values of \(|a|\), and hence, for filters with smaller passbands.

Just as with differential equations, higher order recursive difference equations can be used to provide sharper filter characteristics and to provide more flexibility in balancing time-domain and frequency-domain constraints.

Finally, note from eq. (3.155) that the system described by eq. (3.151) is unstable if \(|a|\ge1\) and thus does not have a finite response to complex exponential inputs. As we stated previously, Fourier-based methods and frequency domain analysis focus on systems with finite responses to complex exponentials; hence, for examples such as eq. (3.151), we restrict ourselves to stable systems.



2. Nonrecursive Discrete-Time Filters

The general form of an FIR nonrecursive difference equation is


That is, the output \(y[n]\) is a weighted average of the (\(N+M+1\)) values of \(x[n]\) from \(x[n-M]\) through \(x[n+N]\), with the weights given by the coefficients \(b_k\). Systems of this form can be used to meet a broad array of filtering objectives, including frequency-selective filtering.

One frequently used example of such a filter is a moving-average filter, where the output \(y[n]\) for any n—say, \(n_0\)—is an average of values of \(x[n]\) in the vicinity of \(n_0\).

The basic idea is that by averaging values locally, rapid high-frequency components of the input will be averaged out and lower frequency variations will be retained, corresponding to smoothing or lowpass filtering the original sequence.

A simple two-point moving-average filter was briefly introduced in the filtering tutorial [refer to eq. (3.138)]. An only slightly more complex example is the three-point moving-average filter, which is of the form


so that each output \(y[n]\) is the average of three consecutive input values. In this case, the impulse response is


and thus, from eq. (3.122) [refer to the Fourier series and LTI systems tutorial], the corresponding frequency response is


The magnitude of \(H(e^{j\omega})\) is sketched in Figure 3.35. We observe that the filter has the general characteristics of a lowpass filter, although, as with the first-order recursive filter, it does not have a sharp transition from passband to stopband.


Figure 3.35   Magnitude of the frequency response of a three-point moving-average lowpass filter.


The three-point moving-average filter in eq. (3.158) has no parameters that can be changed to adjust the effective cutoff frequency.

As a generalization of this moving-average filter, we can consider averaging over \(N+M+1\) neighboring points—that is, using a difference equation of the form


The corresponding impulse response is a rectangular pulse (i.e., \(h[n]=\frac{1}{N+M+1}\) for \(-N\le{n}\le{M}\), and \(h[n]=0\) otherwise). The filter's frequency response is


The summation in eq. (3.161) can be evaluated by performing calculations similar to those in Example 3 .12 [refer to the Fourier series representation of discrete-time periodic signals tutorial], yielding


By adjusting the size, \(N+M+1\), of the averaging window we can vary the cutoff frequency. For example, the magnitude of \(H(e^{j\omega})\) is shown in Figure 3.36 for \(N+M+1=33\) and \(N+M+1=65\).


Figure 3.36   Magnitude of the frequency response for the lowpass moving-average filter of eq. (3.162):  (a) \(M=N=16\);  (b) \(M=N=32\).


Nonrecursive filters can also be used to perform highpass filtering operations. To illustrate this, again with a simple example, consider the difference equation


For input signals that are approximately constant, the value of \(y[n]\) is close to zero. For input signals that vary greatly from sample to sample, the values of \(y[n]\) can be expected to have larger amplitude. Thus, the system described by eq. (3.163) approximates a highpass filtering operation, attenuating slowly varying low-frequency components and passing rapidly varying higher frequency components with little attenuation.

To see this more precisely we need to look at the system's frequency response. In this case, the impulse response is \(h[n]=\frac{1}{2}\{\delta[n]-\delta[n-1]\}\), so that direct application of eq. (3.122) [refer to the Fourier series and LTI systems tutorial] yields


In Figure 3.37 we have plotted the magnitude of \(H(e^{j\omega})\), showing that this simple system approximates a highpass filter, albeit one with a very gradual transition from passband to stopband.

By considering more general nonrecursive filters, we can achieve far sharper transitions in lowpass, highpass, and other frequency-selective filters.


Figure 3.37  Frequency response of a simple highpass filter.


Note that, since the impulse response of any FIR system is of finite length (i.e., from eq. (3.157), \(h[n]=b_n\) for \(-N\le{n}\le{M}\) and 0 otherwise), it is always absolutely summable for any choices of the \(b_n\). Hence, all such filters are stable.

Also, if \(N\gt0\) in eq. (3.157), the system is noncausal, since \(y[n]\) then depends on future values of the input. In some applications, such as those involving the processing of previously recorded signals, causality is not a necessary constraint, and thus, we are free to use filters with \(N\gt0\). In others, such as many involving real-time processing, causality is essential, and in such cases we must take \(N\le0\).




In the last few tutorials, we have introduced and developed Fourier series representations for both continuous-time and discrete-time systems and have used these representations to take a first look at one of the very important applications of the methods of signal and system analysis, namely, filtering.

In particular, as we discussed in the response of LTI systems to complex exponentials tutorial, one of the primary motivations for the use of Fourier series is the fact that complex exponential signals are eigenfunctions of LTI systems.

We have also seen that any periodic signal of practical interest can be represented in a Fourier series—i.e., as a weighted sum of harmonically related complex exponentials that share a common period with the signal being represented.

In addition, we have seen that the Fourier series representation has a number of important properties which describe how different characteristics of signals are reflected in their Fourier series coefficients.

One of the most important properties of Fourier series is a direct consequence of the eigenfunction property of complex exponentials.

Specifically, if a periodic signal is applied to an LTI system, then the output will be periodic with the same period, and each of the Fourier coefficients of the output is the corresponding Fourier coefficient of the input multiplied by a complex number whose value is a function of the frequency corresponding to that Fourier coefficient. This function of frequency is characteristic of the LTI system and is referred to as the frequency response of the system.

By examining the frequency response, we were led directly to the idea of filtering of signals using LTI systems, a concept that has numerous applications, including several that we have described.

One important class of applications involves the notion of frequency-selective filtering—i.e., the idea of using an LTI system to pass certain specified bands of frequencies and stop or significantly attenuate others. We introduced the concept of ideal frequency-selective filters and also gave several examples of frequency-selective filters described by linear constant-coefficient differential or difference equations.

Our purpose has been to begin the process of developing both the tools of Fourier analysis and an appreciation for the utility of these tools in applications. In the tutorials that follow, we continue with this agenda by developing the Fourier transform representations for aperiodic signals in continuous and discrete time and by taking a deeper look not only at filtering, but also at other important applications of Fourier methods.


The next tutorial discusses about representation of aperiodic signals with continuous-time Fourier transform


Share this post



Sold Out