Make your own free website on

What is Digital Filtering

Digital Filtering is the extraction of unwanted signal components from an incoming signal. This is very much similar to analog filtering but digital filtering provides much more flexability and functionality.
In filtering, there are four types of basic filters, the lowpass, highpass, bandpass, and bandstop filters. The lowpass filter filters out any unwanted signal components higher than the desired cutoff frequency. The highpass filter filters out any unwanted signal components lower than the desired cutoff frequency. The bandpass filter filters out any unwanted signal components which are not within the lower cutoff frequency and the higher cutoff frequency. The bandstop filter filters out any noise within a certain range of frequencies. The frequency responses are listed below.

Lowpass Frequency Response.

lowpass frequency response

Highpass Frequency Response.
highpass frequency response

Bandpass Frequency Response.
bandpass frequency response

Bandstop Frequency Response.
bandstop frequency response

In digital filtering, there are two types of basic digital filters the FIR (finite Impulse Response) filter and the IIR (Infinite Impulse Response) filter.

Finite Impulse Response Filtering

A Finite Impulse Response filter is characterized by an impulse response which is finite in duration. An impulse response is basically the response of the filter when a unit impulse are placed as input to the filter. The output of the filter will more or less resemble a sinc function which is usually the shape of the filter. Why ? Because the fourier transform of a sinc function gives spectral characteristics which we can adjust the cutoff frequency. The sinc function is usually infinite in duration with infinite energy going off to infinity. Since this type of signal is impossible to realize in any DSP or processor; we truncate the tailing energies. This can be done in many ways. One of the more popular ways is to "window" the sinc function with a function which goes to zero at the tailing energies. Below is an image of an impulse respoonse of an FIR filter. Notice it resembles a sinc function.

impulse response

The process of "windowing" is basically multiplying the window function by the sinc function. Doing this, will achieve truncated filter coefficients which can then be implemented into memory. Below are some of the windowing functions and their plots.

Name of Window transition Width (Hz) Normalized Passband Ripple Stopband Attenuation (dB) Window Function
Rectangular or
.9/N .7416 21 1
Hanning 3.1/N .0546 44 .5 + .5 cos((2*pi*n)/N)
Hamming 3.3/N .0194 53 .54 + .46 cos((2*pi*n)/N)
Blackman 5.5/N .0017 74 .42 + .5 cos((2*pi*n)/(N-1)) + .08cos((4*pi*n)/(N-1))
Kaizer 2.93/N (beta=4.54)
4.32/N (beta=6.76)
5.71/N (beat=8.96)
I(beta*(1-[(2*n)/(N-1)]^2)^.5) / (I*beta)

Advantages / Disadvantages of FIR filtering

Infinite Impulse Response Filtering

Infinite Impulse Response filtering is the filtering of a signal with a signal which has an impulse response which is virtually infinte in duration. Like I mentioned in FIR, how is this done since I mentioend previously that infinite signals cannot be represented in computer memory? Good question indeed. The truth is IIR filters use "recursive algorithms" employing feedback of the output to give the filter its IIR signature. The implementation of a difference equation is the computer implementation of this feeback network. Below we will show you an example of an IIR implementation. We will first start with a transfer function in the Z domain and derive the difference equation in the time domain which is what we will use to implement the filter. We will also show the structure of the filter which is the pictoral diagram showing the input/output and delay elements and the "flow" of the filter.

Take this second order filter

H(z) = .345(1 + 2z^-1 +z^-2) / (1 + .5z^-1 + 2z^-2)

changing H(z) = Y(z)/X(z) and multiplying the denominator by Y(z) and numerator by X(z) we get:

Y(z)(1 + .5z^-1 + 2z^-2) = X(z)(.345 + .69z^-1 + .345z^-2)

(Y(z) + .5Y(z)z^-1 + 2Y(z)z^-2) = (.345X(z) + .69X(z)z^-1 + .345X(z)z^-2)

taking the inverse Z transform, we get:

Y(n) + .5Y(n-1) + 2Y(n-2) = .345X(n) + .69X(n-1) + .345X(n-2)

solving for Y(n) we get out difference equation:

Y(n) = .345X(n) + .69X(n-1) + .345X(n-2) - .5Y(n-1) - 2Y(n-2)

Now, this difference equation can be implemented. Also note that X(n-1) and X(n-2) are previous samples which mean that at the start of the filter they must be defined. These are called initial conditions. Usually you can set them to 0 since in most signals there isn't any information prior to time 0 seconds.

Assignment: Plot the Z plane, frequency, and phase response of the above second order filter and email me back and let me know if its stable and tell me its cutoff frequency. Matlab is a great tool for this. I would recommend using some of the scripts I have on this site. Assume a sampling frequency of 48 Khz and the initial conditions are 0.

Also, if it is unstable, try using this: H(z) = .32(1 + 2z^-1 + 1) / (1 + .5z^-1 -2z^-2) and tell me what the cutoff frequency is. Hint: If you are using my scripts the frequency response is normalized so you must denormalize the x-axis to half the sampling frequency to obtain the cutoff frequency. My email is: