Home Page      Guest Comments

Moulton  Lectures

 

On

Electro-Acoustics

 

 

 

Lecture 17

 

Digital Noise Cancellation 2

 

Simple Digital Filter Design

 

 

 

Presented by:

Dave L Moulton

 

 

 

 

Location:  Thales Acoustics Harrow UK

Date:  19-March-2003

 


Content

 

Lecture 16 was aimed at giving the class an introduction to the z-transform.

 

In this lecture I want to make use of the z-transform by showing how it features in the design of a very simple first order low pass filter. My approach will be to convert an analogue representation of the filter to a digital filter. 

 

I will show how the digital filter is represented as a z-domain algorithm and as a recurrence relationship.

 

The response of the filter will be created in excel and displayed as discrete time domain ‘input /output’ response curves.

 

I will first introduce a couple of mathematical design tools which are essential in making the transform from an analogue filter to a digital filter. These  tools are based on the mapping of the s-plane into the z-plane, resulting in what are known as a Bi-linear Transform and a Frequency Warping Transform.

 

 

On with the lecture

 

Essential Design Tools

My approach will be a conventional one which starts by defining the transfer function of an analogue filter, in this case a first order low pass filter. I will then use a standard method of transforming the analogue filter into an equivalent digital (Discrete) version.

 

Before we can start any digital filter design we first need to understand what is required to make the transition from an analogue filter to a digital filter. Lets go back to basics and describe the fundamental make up of a transfer function.  Figure 17.1 shows the movement from the Time Domain to the S-Domain and then on to the Z-Domain.

 

 

 

 

 

Figure 17.1

 

We need to look at the way in which s-plane poles map onto the z-plane.  Without going into all of the mathematical proof, I will simply state the relevant relationships.

 

Bi-linear Transform

The transformation relationship between the s-plane and the z-plane is known as the bi-linear transform:

 

 

Graphically the transformation of poles from the s-plane to the z-plane is shown below in figure 17.2.  This transform results in all poles that lie in the LH s-plane being located within the unit circle of the z-plane.  All poles in the RH s-plane end up being located outside of the unit circle.  All poles that lie on the jw axis (stable oscillation) lie on the perimeter of the unit circle.

 

 

Figure 17.2

 

Frequency Warping

As a consequence of the bi-linear transform we must also look at the resulting affect on the filter cut off frequency.  To explain this more clearly I will derive the frequency transformation from the bi-linear transform.

 

To make the calculation easier we will restrict our analysis to an undamped sinusoid, thus let s=jw, we symbolize the cut-off frequency of the analogue prototype as wa and the cut-off frequency of the equivalent digital filter as wd.  Applying this to the Bi-Linear transform we get:

 

 

We need to re-express this equation so that wd is a function of wa. 

 

Thus:

Removing common factors:

 

 

Manipulating the equation into a more familiar form:

 

 

Converting to trigonometric functions:

 

 

Thus the warping transformation can be expressed as:

 

 

We now have the tools required to design a digital Filter.

I will go through the design process step by step.

 

 

Designing a simple first order Low Pass Filter

 

Step 1:  Analogue Filter representation

Decide on the configuration of the analogue equivalent filter, it is a good idea to draw out the analogue filter as an electrical circuit.  In our case this will be the low pass filter circuit shown in figure 17.3, comprising a Resistor and Capacitor:

Figure 17.3

 

Step 2:  Analogue Filter Transfer Function

Derive the Laplace Transfer function for the filter.  This  is done in the usual way by converting the reactive component (Compliance or Capacitance C) to its equivalent impedance.  We then treat the system as a potential divider and work out the relationship between the input and output in terms of  Laplace functions:

 

The Impedance of the Capacitor is defined as: 

The calculation for the filter transfer function takes the form:

Leading to:

 

Summarizing this in a diagram we have:

Figure 17.4

 

The analogue radian cut-off frequency wa  for this type of filter is:

 

 

Thus the analogue filter transfer function can be re-expressed as:

 

 

Step 3:  Introducing the Bi-Linear Transform

We now use the bi-linear transform  to convert the Laplace function ‘s’ to z-transforms.

 

Now to rearrange [17.13] so that we have Y(z) on its own and as a term by term function of z.

 

Multiplying through to remove the fraction (denominator function).

 

 

Tidying up:

 

 

Isolating Y(z) will provide the result we want.

 

 

The relationship in [17.17] describes an algorithm for the discrete low pass filter.  This algorithm can be described in block form as shown in figure 17.5 below:

 

 

 

Figure 17.5

 

Step 4:  Setting up a Recurrence Relationship.

In order to make the filter algorithm look more useable, we can set up what is known as a recurrence relationship.  This basically describes  a general case for the nth sample. For example  X( z ) is described as x( n ) and

X( z )z-1 is described by x( n – 1 ), the previous sample. Applying this notation to the algorithm described in equation [17.17] we get:

 

 

 

Step 5:  Executing the Algorithm

This is the easy bit.  The Low pass filter recurrence relationship shown in [17.18] can be very easily displayed in Excel and also very easily programmed onto a pc with a decent data acquisition card (i/o card) and appropriate software.

 

Putting the algorithm into Excel

For the purpose of this lecture I have pre programmed the algorithm into Excel and will show the results in graphical format. 

 

For our example we will choose a digital filter with a cut-off frequency

fd = 1kHz,   and a sampling frequency of  10kHz (Ts = 10-4 secs).

We now need to use the frequency warping formula described in [17.7].

 

 

Note: We are dealing with radians, and not degrees.

 

Thus the coefficients are:

 

 

Our specific 1kHz filter sampled at a rate of 10kHz has the following algorithm:

 

 

The title columns for an Excel spread sheet may look like the table shown in table 17.1.

 

The table shows a pulse input between samples 4 and 8.

x(0)=0, x(1)=0, x(2)=0, x(3)=0,x(4)=1, x(5)=1, x(6)=1, x(7)=1, x(8)=1, x(9)=0, etc…..

Sample

n

 

Time

nTs

secs

Input

x(n)

0.24524x(n)

0.24524x(n-1)

0.50953y(n-1)

Output

Y(n)

0

0.0000

0

0

0

0

0

2

0.0001

0

0

0

0

0

3

0.0002

0

0

0

0

0

4

0.0003

1

0.24524

0

0

0.24524

5

0.0004

1

0.24524

0.24524

0.12497

0.61545

6

0.0005

1

0.24524

0.24524

0.31359

0.80407

7

0.0006

1

0.24524

0.24524

0.40970

0.90000

8

0.0007

1

0.24524

0.24524

0.45858

0.94906

9

0.0008

0

0

0.24524

0.48357

0.72881

10

0.0009

0

0

0

0.37135

0.37135

11

0.0010

0

0

0

0.18921

0.18921

12

0.0011

0

0

0

0.09641

0.09641

13

0.0012

0

0

0

0.04912

0.04912

14

0.0013

0

0

0

0.02503

0.02503

15

0.0014

0

0

0

0.01275

0.01275

16

0.0015

0

0

0

0.00650

0.00650

17

0.0016

0

0

0

0.00331

0.00331

 

Table 17.1

 

The table above shows the discrete time domain response of the digital low pass filter to a pulse input.  Note that the output data rises when the pulse starts and then decays when the pulse finishes. This is typical of a capacitor C being charged via the resistor R and then discharging through the same Resistor when the pulse ends.

Figure 17.6

 

What we would expect from the analogue equivalent filter.

 

 

Figure 17.7

 

Results from an Excel Spread Sheet

 

Graph 17.1 shows the response of our filter to step function displayed as discrete data points.


 

 


Graph 17.1

 

Graph 17.2 show the same data with all of the point joined up by a smooth curve interpolator provided within Excel. This enables us to display response shape as a conventional analogue  equivalent.  In real life this is made possible by a Reconstruction Filter connected to the output of the Digital to Analogue ( A to D) converter.


 

 


Graph 17.2

 

A few other graphical examples:

 

Graph 17.3:  Filter Response to a Narrow Impulse.


 


Graph 17.3

 


Graph 17.4:  Filter Response to a 1kHz sinewave input.

 


Graph 17.4

Note in graph 17.4 the amplitude of the output signal is approximately 3dB down on the input signal, also the output lags the input by P/4  (45°).   This is to be expected for a Low Pass filter with a cut-off frequency of 1kHz.

 

 

 

End of Lecture