You are on page 1of 68

# EE 010 604

EEE-2013

Page 1

EE 010 604

## Digital Signal Processing

SYLLABUS
EE 010 604 Digital Signal Processing
Teaching scheme 3 hours lecture and 1 hour tutorial per week Credits: 4

Objectives To provide knowledge of transforms for the analysis of discrete time systems. To impart knowledge in digital filter design techniques and associated problems. Module 1 (14hrs) Discrete time signals and systems: Basic principles of signal processing-Building blocks of digital signal processing. Review of sampling process and sampling theorem. Standard signals-delta, step, ramp. Even and odd functions. Properties of systems-linearity, causality, time variance, convolution and stability difference equations-frequency domain representation Discrete time Fourier transform and its properties- Z transform and inverse Z transform-solution of difference equations. Module 2 (14hrs) Discrete Fourier transform-inverse discrete Fourier transform-properties of DFT-linear and circular convolution-overlap and add method-overlap and save method-FFT - radix 2 DIT FFT-Radix2 DIF FFT Module 3 (12hrs) Finite register length problems in digital filters-fixed point and floating point formats-errors due to quantization, truncation and round off. Introduction to DSP processors. Architecture of TMS 320C54 XX Digital Signal Processor. Principle of speech signal processing (Block Schematic only). Module 4 (12hrs) Design of FIR filters-Properties of FIR filters-Design of FIR filters using Fourier series method- Design of FIR filters without using windows- Design of FIR filters using windows-Design using frequency sampling-Design using frequency sampling method-Design using Kaisers approach- realization of FIR filters . Module 5 (8hrs) Digital filter design: Design of IIR filters from analog filters - analog butter worth functions for various filters - analog to digital transformation-backward difference and forward difference approximationsimpulse invariant transformation bilinear transformation- frequency warping and pre warping-design examples- frequency transformations. Structures for realizing digital IIR filters-Direct form 1-direct form II-parallel and cascade structure- lattice structure. EEE-2013 Page 2

EE 010 604

## Digital Signal Processing

Text Books: 1. 2. 3. John G. Proakis, Dimitris G. Manolakis, Digital Signal Processing, PHI, New Delhi, 1997V. Mitra, Digital Signal Processing , 3e, Tata McGraw Hill Education New Delhi,2007 P. Ramesh Babu- Digital Signal Processing-Scitech publication

Reference Books: 1. 2. 3. 4. 5. Alan V. Oppenheim, Ronald W. Schafer, Discrete time Signal Processing, PHI,New Delhi,1997. Udayashankara, Real Time Digital Signal Processing, PHI, New Delhi, 2010. Ganesh Rao, Digital Signal Processing, Sanguins Haykin and Van Veen, Signals and Systems, John Wiley and sons Inc., 2010. Li Tan, Digital Signal Processing-Architecture Implementation and Applications - Elsevier Publications

EEE-2013

Page 3

EE 010 604

EEE-2013

Page 4

EE 010 604

## Digital Signal Processing-Introduction

Digital signal processing (DSP) technology and its advancements have dramatically impacted our modern society everywhere. Without DSP, we would not have digital/Internet audio or video; digital recording; CD, DVD, and MP3players; digital cameras; digital and cellular telephones; digital satellite and TV; or wire and wireless networks. Medical instruments would be less efficient or unable to provide useful information for precise diagnoses if there were no digital electrocardiography (ECG) analyzers or digital x-rays and medical image systems. We would also live in many less efficient ways, since we would not be equipped with voice recognition systems, speech synthesis systems, and image and video editing systems. Without DSP, scientists, engineers, and technologists would have no powerful tools to analyze and visualize data and perform their design, and so on.

## Block Diagram of Digital Signal Processing

The concept of DSP is illustrated by the simplified block diagram in Figure, which consists of an analog filter, an analog-to-digital conversion (ADC) unit, a digital signal (DS) processor, a digital-to-analog conversion (DAC) unit, and a reconstruction (anti-image) filter. As shown in the diagram, the analog input signal, which is continuous in time and amplitude, is generally encountered in our real life. Examples of such analog signals include current, voltage, temperature, pressure, and light intensity. Usually a transducer (sensor) is used to convert the nonelectrical signal to the analog electrical signal (voltage). This analog signal is fed to an analog filter, which is applied to limit the frequency range of analog signals prior to the sampling process. The purpose of filtering is to significantly attenuate aliasing distortion, which will be explained in the next chapter. The band-limited signal at the output of the analog filter is then
EEE-2013 Page 5

EE 010 604

## Digital Signal Processing

sampled and converted via the ADC unit into the digital signal, which is discrete both in time and in amplitude. The DS processor then accepts the digital signal and processes the digital data according to DSP rules such as low pass, high pass, and band pass digital filtering, or other algorithms for different applications. Notice that the DS processor unit is a special type of digital computer and can be a general-purpose digital computer, a microprocessor, or an advanced microcontroller; furthermore, DSP rules can be implemented using software in general. With the DS processor and corresponding software, a processed digital output signal is generated. This signal behaves in a manner according to the specific algorithm used. The next block in Figure, the DAC unit, converts the processed digital signal to an analog output signal. As shown, the signal is continuous in time and discrete in amplitude. The final block in Figure is designated as a function to smooth the DAC output voltage levels back to the analog signal via a reconstruction (anti-image) filter for real-world applications.

## Sampling of Continuous Signal

The analog filter processes the analog input to obtain the band-limited signal, which is sent to the analog to- digital conversion (ADC) unit. The ADC unit samples the analog signal, quantizes the sampled signal, and encodes the quantized signal levels to the digital signal. Here we first develop concepts of sampling processing in time domain. Figure shows an analog (continuous-time) signal (solid line) defined at every point over the time axis (horizontal line) and amplitude axis (vertical line). Hence, the analog signal contains an infinite number of points.

It is impossible to digitize an infinite number of points. Furthermore, the infinite points are not appropriate to be processed by the digital signal (DS) processor or computer, since they require infinite amount of memory and infinite amount of processing power for computations.
EEE-2013 Page 6

EE 010 604

## Digital Signal Processing

Sampling can solve such a problem by taking samples at the fixed time interval, as shown in Figures, where the time T represents the sampling interval or sampling period in seconds. As shown in Figure, each sample maintains its voltage level during the sampling interval T to give the ADC enough time to convert it. This process is called sample and hold. Since there exists one amplitude level for each sampling interval, we can sketch each sample amplitude level at its corresponding sampling time instant shown in Figure, where 14 samples at their sampling time instants are plotted, each using a vertical bar with a solid circle at its top. After the analog signal is sampled, we obtain the sampled signal whose amplitude values are taken at the sampling instants, thus the processor is able to handle the sample points. Next, we have to ensure that samples are collected at a rate high enough that the original analog signal can be reconstructed or recovered later. In other words, we are looking for a minimum sampling rate to acquire a complete reconstruction of the analog signal from its sampled version. If an analog signal is not appropriately sampled, aliasing will occur, which causes unwanted signals in the desired frequency band. The sampling theorem guarantees that an analog signal can be in theory perfectly recovered as long as the sampling rate is at least twice as large as the highest-frequency component of the analog signal to be sampled. The condition is described as fs>2fmax, where fmax is the maximum-frequency component of the analog signal to be sampled. For example, to sample a speech signal containing frequencies up to 4 kHz, the minimum sampling rate is chosen to be at least 8 kHz, or 8,000 samples per second; to sample an audio signal possessing frequencies up to 20 kHz, at least 40,000 samples per second, or 40 kHz, of the audio signal are required. Figure illustrates sampling of two sinusoids, where the sampling interval between sample points is T 0:01 second, thus the sampling rate is fs 100 Hz. The first plot in the figure displays a sine wave with a frequency of 40 Hz and its sampled amplitudes. The sampling theorem condition is satisfied, since 2fmax 80 Hz < fs. The sampled amplitudes are labeled using the circles shown in the first plot. We notice that the 40-Hz signal is adequately sampled, since the sampled values clearly come from the analog version of the 40-Hz sine wave.

EEE-2013

Page 7

EE 010 604

## Digital Signal Processing

However, as shown in the second plot, the sine wave with a frequency of 90 Hz is sampled at 100 Hz. Since the sampling rate of 100 Hz is relatively low compared with the 90-Hz sine wave, the signal is under sampled due to 2fmax 180 Hz > fs. Hence, the condition of the sampling theorem is not satisfied. Based on the sample amplitudes labeled with the circles in the second plot, we cannot tell whether the sampled signal comes from sampling a 90-Hz sine wave (plotted using the solid line) or from sampling a 10-Hz sine wave (plotted using the dot-dash line). They are not distinguishable. Thus they are aliases of each other. We call the 10-Hz sine wave the aliasing noise in this case, since the sampled amplitudes actually come from sampling the 90-Hz sine wave.

Now let us develop the sampling theorem in frequency domain, that is, the minimum sampling rate requirement for an analog signal. As we shall see, in practice this can help us design the anti-aliasing filter (a low pass filter that will reject high frequencies that cause
EEE-2013 Page 8

EE 010 604

## Digital Signal Processing

aliasing) to be applied before sampling, and the anti-image filter (a reconstruction low pass filter that will smooth the recovered sample-and-hold voltage levels to an analog signal) to be applied after the digital-to-analog conversion (DAC). Shannon sampling theorem For a uniformly sampled DSP system, an analog signal can be perfectly recovered as long as the sampling rate is at least twice as large as the highest-frequency component of the analog signal to be sampled. We summarize two key points here. 1. Sampling theorem establishes a minimum sampling rate for a given band limited analog signal with the highest-frequency component fmax. If the sampling rate satisfies Equation (2.5), then the analog signal can be recovered via its sampled values using the low pass filter, as described in Figure. 2. Half of the sampling frequency fs=2 is usually called the Nyquist frequency (Nyquist limit), or folding frequency. The sampling theorem indicates that a DSP system with a sampling rate of fs can ideally sample an analog signal with its highest frequency up to half of the sampling rate without introducing spectral overlap (aliasing). Hence, the analog signal can be perfectly recovered from its sampled version.

## Elementary Discrete-Time Signals

1. Unit-impulse sequence

2. Unit-step sequence

EEE-2013

Page 9

EE 010 604

## Digital Signal Processing

The plot of the unit-impulse function is given in Figure. The unit-impulse function has the unit amplitude at only n 0 and zero amplitudes at other time indices. The plot is given in Figure 3.4. The unit-step function has the unit amplitude at n=0 and for all the positive time indices, and amplitudes of zero for all the negative time indices. 3. Sinusoidal function

4. Exponential function

Generation of Digital Signals Given the sampling rate of a DSP system to sample the analytical function of an analog signal, the corresponding digital function or digital sequence (assuming its sampled amplitudes are encoded to have finite precision) can be found. The digital sequence is often used to 1. Calculate the encoded sample amplitude for a given sample number n; 2. Generate the sampled sequence for simulation. The procedure to develop the digital sequence from its analog signal function is as follows. Assuming that an analog signal x(t) is uniformly sampled at the time interval of Dt T, where T is the sampling period, the corresponding digital function (sequence) x(n) gives the instant

EEE-2013

Page 10

EE 010 604

## Digital Signal Processing

encoded values of the analog signal x(t) at all the time instants t nDt nT and can be achieved by substituting time t nT into the analog signal x(t), that is,

Also notice that for sampling the unit-step function u(t), we have

## Discrete Time Systems

Definition : A discrete time system is a physical device (or an algorithm) which performs required operation on a discrete time signal. A discrete time system is represented as shown in Figure.

Discrete time system Here x (n) is input discrete time signal applied to the system. It is also called as excitation.

The system operates on discrete time signal. This is called as procession of input signal, x(n) . Output of system is denoted by y (n). It is also called as response of system. Notation : When input signal is passed through the system then it is represented by following notation : T x(n)-----> y(n) OR y(n) = T[x(n)]

Here T is called as transformation operation. Example : A filter is a good example of a system. A signal containing noise is applied at the input of filter. This is an input signal to the system (filter). The filter cancels or attenuates noise signal. This is the processing of signal. A noise-free signal obtained at the output of filter is called as response of system. Properties of D.T. Systems and Classification : Properties of systems are with respect to input and output signal. For the simplicity we will consider the system having single input and single output. But the same explanation is valid for the system having multiple inputs and multiple outputs. Important properties of systems are as follows : EEE-2013 Page 11

EE 010 604

## Time variance Causality Stability

Now based on the properties, the systems can be classified as follows : Classification of system

## Static or Dynamic Systems (Dynamicity Property): i) Static systems:

Definition: It is a system in which output at any instant of time depends on input sample at the same time. Example : (i) y(n) = 5x(n)

Here 5 is constant which multiplies input x(n). But output at n th instant that means y(n) depends on input at the same (n th) time instant x (n). So this is static system. Significance : Observe the input-output relations of static system. Output does not depend on delayed [ x ( n - k ) ] or advanced [ x ( n + k ) ] input signals. It depends only on present ( n th ) input signal. If output depends on delayed input signals then such signals should be stored in memory to calculate the output at nthinstant. This is not required in static systems. Thus for static systems, memory is not required. So static systems are memoryless systems. ii) Dynamic systems :

Definition : It is a system in which output at any instant of time depends on input sample at the same time as well as at other times. Here other times means, other than the present time instant. It may be past time or future time. Note that if x ( n ) represents input signal at present instant then, (a) x ( n - k ); that means delayed input signal is called as past signal. (b) x ( n + k ); that means advanced input signal is called as future signal. EEE-2013 Page 12

EE 010 604

## Digital Signal Processing

Thus in dynamic systems, output depends on present input as well as past or future inputs.

## Examples: (i) y(n) = x(n) + 5x(n-l) .

Here output at nth instant depends on input at n th instant, x ( n ) as well as ( n - 1 instant x ( n - 1 ) is previous (past) sample. So the system is dynamic. (ii) y(n) = 3x(n + 2)+x(n)

Here x(n + 2) indicates advanced version of input sample that means it is future sample; so this is dynamic system. Significance: Observe input-output relations of dynamic system. Since output depends on past or future input samnle; we need a memory to store such samples. Thus dynamic system has a memory. Time Variant or Time Invariant Systems (Time Variance Property) : Definition: A system is time invariant if its input-output characteristics do not change with time. Explanation : A time invariant system means its input-output characteristics are not changing with time shifting. Let us consider we are applying input signal x (n) to the system as shown in Figure. It produces output y (n ). Now delay input by 'k' samples. That means input becomes x (n - k). Apply this delayed input to the same system as shown in Figure. Let us say the system now gives output y (n - k). Then this system is called as time or shift invariant system.

Time invariant system Observe that initially the output is y(n) with input x(n). When input is delayed by 'k', samples then the output is also delayed by same 'k' samples. Thus the input-output characteristics are not changed. So the system is time invariant Theorem: A system is time invariant if and only if EEE-2013 Page 13

EE 010 604

## Digital Signal Processing

Implies that How to determine whether the system is time invariant or not? To check whether the system is time invariant (TIV) or time variant (TV) follow the following steps: Step I: Delay the input x (n) by 'k' units that means x (n - k). Denote the corresponding output by y (n, k). T That means x (n - k) ------ y (n, k) Step II: In the given equation of system y(n)replace 'n' by 'n - k' throughout. This output is y(n-k). .

Step III : If y (n, k) = y (n - k) then system is time invariant (TIV) and if y (n, k) y (n - k) then system is time variant (TV). Prob. 1 : Determine whether the following systems is time invariant or not. .

## y(n) = x(n) - x(.n-1 ) Soln. : Step I :

Delay the input by 'k' samples and denote corresponding output by y (n, k) ----------(1)

## y (n, k) = x(n-k) - x(n-k-l)

Step II : Replace 'n' by 'n - k' throughout the given equation. y(n-k) = x(n-k) - x(n-k-l) Step III : Compare Equations (1) and (2) Here y (n, k) = y (n - k). Thus the system is time invariant (TIV). --------(2)

Linear or Non-linear Systems (Linearity Property): A linear system is a system which follows superposition principle. Consider a system as shown in Fig. 1.5(a); whose response is T. Its input is x (n) and it produces output y (n).

EEE-2013

Page 14

EE 010 604

## Digital Signal Processing

Let input x1 (n) produces output y1(n) and input x2(n) produces output y2(n). Consider two arbitrary constants a1 and a2. . Then simply we can say that input a 1x1 (n) produces output and input a 2 x2 (n) produces output a2 y2 (n). Now we can write the theorem for linear systems as follows: Theorem: A system is said to be linear if the combined response of a 1x1 (n) and a2 x2 (n) is equal to the addition of individual responses. That means, -------------------- (1) Equation (1) is called as superposition theorem. The graphical representation of L.H.S. and R.H.S. of Equation (1) is as shown in Fig. 1.5(b) and Fig. 1.5(c) respectively.

EEE-2013

Page 15

EE 010 604

## Digital Signal Processing

An important characteristics of linear system is that when input is zero then it produces zero output. But if zero input gives some value at the output (non-zero) then it is non-linear system. If this condition is satisfied then apply the superposition theorem to check whether the system is linear or not. How to decide whether the system is linear or not ? Step I : Apply zero input and check the output. If output is zero then system is linear.

If this step is satisfied then follow the remaining steps. Step II : Apply individual input to the system and note down corresponding outputs. Then add all outputs. Denote this addition by y (n). This is R.H.S. of Equation (1) as shown in Fig.1.5.c Step III : Combine all inputs, apply it to the system and find out output y (n). This is L.H.S. of Equation (1) as shown in Fig1.5 (b). Step IV : if y (n) = y (n) then the system is linear otherwise it is non-linear system. Q. Determine whether the following systems are linear or not. Prob. 1 : Soln. : Step I : When input x (n) is zero then output y (n) = n.0= 0. Thus the system is linear. Now y(n) = nx.(n)

first step is satisfied so we will check remaining steps for linearity. Step II : Let there are two inputs x 1(n) and x2(n).

The given equation of output is y (n) = n x (n) that means x (n)-- T ----- > n x (n). So the function of system is to multiply input x(n) by 'n'. Now for two inputs x 1(n) andx2(n) the corresponding outputs are y1(n) and y2(n). T x1(n)------> y1(n) = nx1 (n) T and x2(n)------> y2(n) = nx2 (n)

Now add these outputs to get y (n) y (n) = y1(n)+ y2(n) = nx1(n) + nx2(n) y(n) = n[x1(n) + x2(n)] . ... (1)

Step III : Now add inputs x1 (n) and x2 (n) and then pass it through the system. EEE-2013 Page 16

EE 010 604

## T .'. [x1(n) + x2(n)------>y"(n) = T[x1(n) + x2(n)] = n[x1(n) + x2(n)] .

We know that the function of system is to multiply input by 'n'. Here [x1(n) + x2(n)] acts as one input to the system. So the corresponding output is, y"(n) = n[x1(n) + x2(n)] ...(2)

## the system is linear.

Causal or Anticausal Systems (Causality Property): A) Causal systems : Definition : A system is said to be causal system if output at any instant of time depends only on present and past inputs. But the output does not depend on future inputs. Examples : The output of system depends on present and past inputs that means output, y (n) is a function of x(n), x(n-l),x(n-2) ... etc. some examples of causal systems are : (i) y(n) = x(n) + x(n-l) (ii) y(n) = 3x(n) (iii) y(n) = x(n) + 4x(n-l) Significance : Since causal system does not include future input samples; such system is practically realizable. That means such system can be implemented practically. Generally all real time systems are causal systems; because in real time applications only present and past samples are present. . Since future samples are not present; causal system is memory less system. B) Anticausal or non-causal systems :

Definition : A system is said to be anticausal system if its output depends not only on present and past inputs but also on future inputs. Examples : In this case, output y (n) is function of x(n), x(n-l),x(n-2) .... etc. as well as it is function of x (n + 1), x (n + 2) ... etc. some examples of non-causal systems are : (i) y(n) = x(n) + x(n+l) (ii) y(n) = Bx(n + 2) (iii) y(n) = x(n) + nx(n+l)

EEE-2013

Page 17

EE 010 604

## Digital Signal Processing

Significance: Since non-causal system contains future samples; a non-causal system is practically not realizable. That means in practical cases it is not possible to implement a non-causal system. But if the signals are stored in the memory and at a later time they are used by a system then such signals are treated as advanced or future signal. Because such signals are already present, before the system has started its operation. In such cases it is possible to implement a non-causal system.

Some practical examples of non-causal systems are as follows : (ii) Weather forecasting (iii) Planning commission etc.

## (i) Population growth

Determine if the systems described by following equations are causal or non-causal. Soln. : (i) y(n) = x(n) + x(n-2)

It is a causal system because output depends only on present input i.e. x (n) and past input i.e. x (n - 2). (ii) T[x(n)] = ex(n) The given equation is,

y(n) = ex(n) This is causal system since output depends on present input, x (n). (Hi) T[x(n)] = -ax(n) + 6 The given equation is, y (n) = ax (n ) + 6 This is causal system because output depends on present input x (n ';. There is no future input signal. (iv) y (n) = cos x (n) This is a causal system because the function of system is to obtain cosine value of present input. (v) y(n) = x(n) + nx(n-l) This is a causal system because output depends on present and past input but not on the future input. (vii) y(n) =.x(n) + nx(n + l). Here output depends on future input i.e. x(n+ 1). So this is non-causal system. Stable or Unstable Systems (Stability Property) :

EEE-2013

Page 18

EE 010 604

## Digital Signal Processing

To define stability of a system we will use the term 'BIBO'. It stands for Bounded Input Bounded Output. The meaning of word 'bounded' is some finite value. So bounded input means input signal is having some finite value, i.e. input signal is not infinite. Similarly bounded output means, the output signal attains some finite value i.e. the output is not reaching to infinite level. Definition of stable system : An initially relaxed system is BIBO stable if and only if every bounded input produces bounded output. Here a relaxed system means when input to the system is zero then the output of system is also zero.

Mathematical representation : Let us consider some finite number MX whose value is less than infinity. That means MX < , so its a finite value. Then if input is bounded, we can write, | x (n) | < Mx < ...(1)

Similarly consider some finite number M whose value is less than infinity. That means M y< , so its a finite value. Then if output is bounded, we can write, |y(n)| < M y< Definition of unstable system : An initially relaxed system is said to be unstable if bounded input produces unbounded (infinite) output. Significance : Unstable system shows erratic and extreme behaviour. . When unstable system is practically implemented then it causes overflow. Prob. 1 : Determine whether the following discrete-time systems are stable or not. ...(2)

The given equation is, (i) y(n) = ex(n) We have to check the stability of a system by applying bounded input. That means the value of x(n) should be finite (bounded). The value of 'e' is 2.718. So for bounded input, the output y (n) will be bounded. Thus this is stable system. (ii) T[x(n)] = ax(n) + 6. The given equation is, y(n)=ax(n) + 6

Here 'a' is some arbitrary constant. So as long as x (n) is bounded the output y (n) is also bounded. Thus it is stable system. EEE-2013 Page 19

EE 010 604

## Digital Signal Processing

(iii) y(n) = cos[x(n)]. For every bounded value of x (n), its cosine value is always bounded (finite). So given system is stable. (iv) y (n) = x (- n ) Here x (- n) means folding of input sequence. That means taking mirror image of x (n). But in case of folding operation; the amplitude of signal is not changed. So if input is bounded the output y(n) = x(-n) will be bounded. Thus it is stable system. (v) y ( n) = x (2 n )

If input x (n) is bounded then output y ( n) is also bounded. So it is a stable system. Prob, 1 : Explain the given system with respect to following properties :

(i) Dynamicity (ii) Time invariance (iii) Linearity (iv) Causality (v) Stability, n (1) y(n) Soln. : Y(n)= (i) Dynamicity : Expand the given summation by putting different values of k,

y(n) = x (-) + .... + x (-3 ) + x(-2) + x(-l) + x(0) + x(l) + x(2) + ... + x(n).(1) Observe this equation. This equation contains past terms x (- 3 ), x (- 2) ... etc. These terms should be stored in memory. So it is dynamic system. (ii) Time invariance :

Time invariance property states that if we delay the input sequence then output should be delayed by same amount, Observe Equation (1). It is summation of all input terms. So it is clear that if we delay input by some value then output y (n) will be delayed by same amount. Thus this is time invariant system. (Hi) Linearity : Equation (1) indicates the addition of individual terms and the addition operation is linear. So given system is linear. (iv) Causality : From Equation (1) we can say that the present output y (n) depends on (a) present input x (n) and (b) Past inputs like x(-3), x(-2), x(-l) .... But there is no future or advanced input term like x (n + 1). Thus this system is causal. (v) Stability : We know that the system is stable if bounded input produces bounded output.

EEE-2013

Page 20

EE 010 604

## Digital Signal Processing

Now, given equation is, ) y(n) Here, x (k) is the input signal. To check the stability of a system, we have to apply bounded input signal. So let us assume that we are applying unit step as an input signal. That means x(k) = u(k) ... An unit step.

We know that unit step is present from n = 0 to n = its magnitude is always 1. So its value is bounded (less than ). This unit step is shown in Fig..

## Fig.: Bounded input, u (k) Mathematically it is expressed as,

u (k) =

Since input x(k) = u(k)we can write given equation y ( n ) as, y(n) = Let us calculate y ( n ) for few values of n. 2 = u(0) + u( 1 ) + u(2) = 1 + 1 + 1 = 3

## For n = 2=> y(2) =

For n = 5 =>y(5) =

EE 010 604

## Digital Signal Processing

= u(0)+u(l)+u(2)+u(3)+u(4)+u(5)+u(6) + u(7) + u(8) + u(9)+u(.10) It is clear that as n -> , y ( n ) - , even if input u ( k ) is bounded. Thus the system is unstable.

Difference Equations

EEE-2013

Page 22

EE 010 604

EEE-2013

Page 23

EE 010 604

EEE-2013

Page 24

EE 010 604

The z-Transform

EEE-2013

Page 25

EE 010 604

EEE-2013

Page 26

EE 010 604

EEE-2013

Page 27

EE 010 604

EEE-2013

Page 28

EE 010 604

EEE-2013

Page 29

EE 010 604

EEE-2013

Page 30

EE 010 604

EEE-2013

Page 31

EE 010 604

EEE-2013

Page 32

EE 010 604

EEE-2013

Page 33

EE 010 604

EEE-2013

Page 34

EE 010 604

EEE-2013

Page 35

EE 010 604

EEE-2013

Page 36

EE 010 604

EEE-2013

Page 37

EE 010 604

EEE-2013

Page 38

EE 010 604

EEE-2013

Page 39

EE 010 604

## MODULE-5 IIR-TYPE DIGITAL FILTERS

5.1. Introduction: A general causal digital filter has the difference equation: N y[n] = i=0 M a i x[n-i] b k y[n-k]

k=1

which is of order max{ N,M }, and is recursive if any of the b j coefficients are non-zero. A second order recursive digital filter therefore has the difference equation:

## y[n] = a 0 x[n] + a 1 x[n-1] + a 2 x[n-2] - b 1 y[n-1] - b 2 y[n-2]

A digital filter with a recursive linear difference equation can have an infinite impulse-response. Remember that the frequency-response of a digital filter with impulse-response {h[n]} is:

## 5.2. The z-transform:

Consider the response of a causal stable LTI digital filter to the special sequence {z n } where z is a complex. If {h[n]} is the impulse-response, by discrete time convolution, the output is a sequence {y[n]} where

EEE-2013

Page 40

EE 010 604

## Digital Signal Processing

y[n]

h[k] z n - k k=-

z n h[k] z - k k=-

## = zn H(z) with H(z) = h[k] z - k

k=-

The expression obtained for H(z) is the z-transform of the impulse-response. H(z) is a complex number when evaluated for a given complex value of z.

It may be shown that for a causal stable system, H(z) must be finite when evaluated for a complex number z with modulus greater than or equal to one.
Since H ( z ) =

n =

h[n]z n

n =

h[n]z

j n

## 5.3. The z-plane:

It is useful to represent complex numbers on an Argand diagram as illustrated below. The main reason for doing this is that the modulus of the difference between two complex numbers a+jb and c+jd say i.e. | (a+jb) (c+jd) |is represented graphically as the length of the line between the two complex numbers as plotted on the Argand diagram.

EEE-2013

Page 41

EE 010 604

## Digital Signal Processing

Imaginary part

Rej
-3+3j
R

1-2j

Real part

If one of these complex numbers, c +jd say is zero i.e. 0+j0, then the modulus of the other number |a+jb| is the distance of a+jb from the origin 0+j0 on the Argand diagram. Of course, any complex number, a+jb say, can be converted to polar form Rej where R= |a+jb| and = tan-1(b/a). Plotting a complex number expressed as Rej on an Argand diagram is also illustrated above. We draw an arrow of length R starting from the origin and set at an angle from the real part axis (measured anti-clockwise). Rej is then at the tip of the arrow. In the illustration above, is about /4 or 45 degrees. If R=1, Rej = ej and on the Argand diagram would be a point at a distance 1 from the origin. Plotting ej for values in the range 0 to 2 (360O) produces points all of which lie on a unit circle , i.e. a circle of radius 1, with centre at the origin.

Where the complex numbers plotted on an Argand diagram are values of z for which we are interested in H(z), the diagram is referred to as the zplane. Points with z = e j lie on a unit circle, as shown in Fig 5.1. Remember that |e j | = |cos() +jsin()| = [cos2() + sin2()] = 1. Therefore evaluating the frequency-response H(ei) for in the range 0 to is equivalent to evaluating H(z) for z =e j which goes round the upper part of the unit circle as goes from 0 to .

EEE-2013

Page 42

EE 010 604

## Digital Signal Processing

Imaginary part of z

## z = exp(j ) 1 Fig 5.1 Real part of z

5.4. Relating H(z), signal-flow graphs and difference equations This is surprisingly straightforward. Consider non-recursive and recursive difference equations separately. Example 5.1: Find H(z) for the difference equation: y[n] = x[n] + x[n-1]

Solution:

## The impulse response is: {h[n]} = { ... , 0, 1, 1, 0, ... } H ( z ) =

n =

h[n]z n = h[n]z n =1 + z 1
n =0

Example 5.2: Find H(z) for the recursive difference equation: y[n] = a 0 x[n] + a 1 x[n-1] - b 1 y[n-1]

Solution: The method used in Example 5.1 is not so easy because the impulseresponse can now be infinite. Fortunately there is another way. Remember that if x[n] = z n then y[n] = H(z) z n , y[n-1] = H(z) z n - 1 etc. Substitute into the difference equation to obtain:
EEE-2013 Page 43

EE 010 604

## Digital Signal Processing

H(z) z n

= a 0 z n + a 1 z n - 1 - b 1 H(z) z n - 1 a0 + a1 z
-1

Therefore,

H(z) = 1 + b1 z-1

## except when z = - b 1 . When z = -b 1 , H(z) = .

By the same method, H(z) for a general digital filter whose differenceequation was given earlier is: a 0 + a 1 z - 1 + a 2 z - 2 + ... + a N z - N H(z) = 1) b 0 + b 1 z - 1 + b 2 z - 2 + ... + b M z - M (with b 0 =

Given H(z) in this form, we can easily go back to its difference-equation and hence its signal-flow graph, as illustrated by the following example.

Example 5.3: Give a signal flow graph for the second order digital filter with: a 0 + a 1 z -1 + a 2 z - 2 H(z) = 1 + b1 z
-1

+ b2 z-2

EEE-2013 Page 44

EE 010 604

## Digital Signal Processing

The signal-flow graph in Fig 5.2 is readily deduced from this differenceequation. It is referred to as a second order or bi-quadratic IIR section in direct form 1. x[n] a0 y[n] z-1 -b1 z-1 a2 -b2

z-1

a1

z-1

Fig 5.2: Direct Form I Biquadratic section Alternative signal flow graphs can generally be found for a given differenceequation. Considering again the Direct Form I bi-quadratic section in Fig 5.2, re-ordering the two halves in this signal flow graph gives Fig 5.3 which, by Problem 5.9, will have the same impulse-response as the signal-flow graph in fig 5.2. Now observe that Fig 5.3 may be simplified to the signalflow graph in Fig 5.4 which is known as a Direct Form II implementation of a bi-quadratic section. It has the minimum possible number of delay boxes and is said to be canonical. Its system function is identical to that of the Direct Form I signal-flow graph, and therefore it can implement any second order bi-quadratic system function. x[n] z-1 -b1 z-1 -b2 z-1 a2 z-1 a0 y[n]

a1

EEE-2013

Page 45

EE 010 604

x[n]

a0

y[n]

a1

a2

## Fig 5.4: Direct Form II Biquadratic Section

Example 5.4: Given values for a 1 , a 2 ,a 0 , b 1 and b 2 , write a program to implement Direct Form II.

Solution:

## W1 = 0; W2 = 0; while 1 X=input('X = '); sample}

{Assign vars W1,W2 to delay outputs} {Infinite 'while' loop} {Assign X to receive a single input

W = X-b1*W1-b2*W2;
Y =W*a0+W1*a1+W2*a2;

## {Recursive part of filter}

{Non-recursive part}

EEE-2013

Page 46

EE 010 604

## W2 =W1; W1 =W; disp([' Y=' num2str(Y)]); end;

{Set up delay outputs for next time} {Assign var Y to output}; {Go back for next sample}

5.5. System function: The expression obtained for H(z) is a ratio of polynomials in z 1 . H(z) is the system function. When z < 1, H(z) need not be finite. 5.6. Poles and zeros of H(z): The expression above for H(z) for a general digital filter may be reexpressed as:

(a0z N + a 1 z N -1 + ... + a N ) H(z) = zM-N (z M + b 1 z N-1 + ... + b M ) The denominator and numerator polynomials may now be expressed in factorised form to obtain:

## (z - z 1 )(z - z 2 )(z - z 3 )...( z - z H(z) = a0zM-N

(z - p 1 )( z - p 2 )(z - p 3 )...(z - p M )

The roots of the numerator: z 1 , z 2 ,..., z N , are called the zeros of H(z). The roots of the denominator: p 1 ,p 2 ,..., p M , are called the poles of H(z)

H(z) will be infinite when evaluated with z equal to a pole, and will become zero with z equal to a zero except in the special case where the zero coincides exactly with one of the poles. EEE-2013 Page 47

EE 010 604

## Digital Signal Processing

For a causal stable system, H(z) must be finite for z 1. Therefore there cannot be a pole whose modulus is greater than or equal to 1. All poles must satisfy z < 1, and when plotted on the Argand diagram, this means that they must lie inside the unit circle. There is no restriction on the positions of zeros.

Assume we wish to design a 4th order 'notch' digital filter to eliminate an unwanted sinusoid at 800 Hz without severely affecting rest of signal. The sampling rate is FS = 10 kHz. One simple way is to use the MATLAB function butter as follows: FS=10000; FL = 800 25 ; FU = 800+25; [a b] = butter(2, [FL FU]/(FS/2),stop); a = [0.98 -3.43 4.96 -3.43 0.98] b= [ 1 freqz(a, b); freqz(a, b, 512, FS); axis([0 FS/2 -50 5]); % Better graph % Scales axes -3.47 4.96 -3.39 0.96]

The frequency-responses (gain and phase) produced by the final two MATLAB statements are as follows:

EEE-2013

Page 48

EE 010 604

## Digital Signal Processing

0 M agnitude (dB )

-20

-40 0 500 1000 1500 2000 2500 3000 F requenc y (Hz ) 3500 4000 4500 5000

## 0 -100 -200 -300 -400

P has e (degrees )

500

1000

1500

## 2000 2500 3000 F requenc y (Hz )

3500

4000

4500

5000

Since the Butterworth band-stop filter will have -3dB gain at the two cut-off frequencies FL = 800-25 and FU=800+25, the notch has -3 dB frequency bandwidth: 25 + 25 = 50 Hz.

Now consider how to implement the 4th order digital filter. The MATLAB function gave us: a = [0.98 -3.43 4.96 -3.43 0.98] b= [ 1
EEE-2013

Page 49

EE 010 604

## The transfer (System) Function is, therefore:

0.98 3.43 z 1 + 4.96 z 2 3.43 z 3 + 0.98 z 4 H ( z) = 1 3.47 z 1 + 4.96 z 2 3.39 z 3 + 0.96 z 4

A Direct Form II implementation of the 4th order notch filter would have the signal-flow graph below:

x[n ]

+ + 3.47

z1

0.98

+ +

y[n]

z -4.96
1

3.43 4.96

+ z+ 3.39 -0.96
1

z
1

-3.43

0.0.98

This implementation works fine in MATLAB. But direct form IIR implementations of order greater than two are rarely used. Sensitivity to round-off error in coefficient values will be high. Also the range of intermediate signals in the z-1 boxes will be high.

EEE-2013

Page 50

EE 010 604

## Digital Signal Processing

High word-length floating point arithmetic hides this problem, but in fixed point arithmetic, great difficulty occurs. Instead we use cascaded bi-quad sections

Given a 4th order transfer function H(z). Instead of the direct form realization below:

x[n]

H(z )

y[n ]

we prefer to arrange two bi-quad sections, with a single leading multiplier G, as follows:

x[n]

H1(z )

H2(z )

y[n]

To convert the 4th order transfer function H(z) to this new form is definitely a th job for MATLAB. Do it as follows after getting a & b for the 4 order transfer function, H(z), as before: [a b] = butter(2, [FL FU]/(FS/2),stop);

[SOS G] = tf2sos(a,b)

EEE-2013

0.9776
Page 51

EE 010 604

## Digital Signal Processing

1 G = 0.978

-1.753

-1.744

0.9785

In MATLAB, SOS stands for second order section (i.e. bi-quad) and the function tf2SOS converts the coefficients in arrays a and b to the new set of coefficients stored in array SOS and the constant G. The array SOS has two rows: one row for the first bi-quad section and one row for the second biquad section. In each row, the first three terms specify the non-recursive part and the second three terms specify the recursive part. Therefore H(z) may now be realized as follows:

x[ n]

## 0.9 78 1.7 22 -0.978

y[ n]

-1.753

1.7 44

1.75 3

0.97 9 Fourth order IIR notch filter realised as two biquad (SOS) sections
This is now a practical and realizable IIR digital notch filter, though we sometimes implement the single multiplier G =0.918 by two multipliers, one for each bi-quad section. More about this later.

5.10 Calculation of gain-response of notch filter: How good is a notch filter? We can start to answer this question by specifying the filter's 3dB bandwidth i.e. the difference between the frequencies where the gain crosses 0.707 (-3dB ). We should also ask what is the gain at the notch frequency (800 Hz in previous example); i.e. what is the depth of the notch. If it is not deep enough either (i) increase the -3 dB bandwidth or (ii) increase the order. Do both if necessary. To sharpen the
EEE-2013 Page 52

EE 010 604

## Digital Signal Processing

notch, decrease the -3dB bandwidth, but this will make the notch less deep; so it may be necessary to increase the order to maintain a deep enough notch. This is an ad-hoc approach we can surely develop some theory later. It modifies the more formal approach, based on poles and zeroes, adopted last year.

EEE-2013

Page 53

EE 010 604

Gain 1 0 dB

0.7

-3 dB

800 0

## 800 + f 800 5kH z

Example: A digital filter with a sampling rate of 200 Hz is required to eliminate an unwanted 50 Hz sinusoidal component of an input signal without affecting the magnitudes of other components too severely. Design a 4th order "notch" filter for this purpose whose 3dB bandwidth is not greater than 3.2 Hz. (MATLAB calls this 2nd order.) How deep is the notch?

## Solution: FS=200; FL=50-1.6; FU=50+1.6; [a b]=butter(2,[FL,FU]/(FS/2), stop); [SOS G] = tf2sos(a,b)

5.11. IIR digital filter design by bilinear transformation Many design techniques for IIR discrete time filters have adopted ideas and terminology developed for analogue filters, and are implemented by transforming the system function, Ha(s), of an analogue prototype filter into
EEE-2013 Page 54

EE 010 604

## Digital Signal Processing

the system function H(z) of a digital filter with similar, but not identical, characteristics. For analogue filters, there is a wide variety of techniques for deriving H a(s) to have a specified type of gain-response. For example, it is possible to deriving Ha(s) for an n th order analogue Butterworth low-pass filter, with gain response: Ga ( ) = 1 1 + ( / C ) 2 n

It is then possible to transform Ha(s) into H(z) for an equivalent digital filter. There are many ways of doing this, the most famous being the bilinear transformation. It is not the only possible transformation, but a very useful and reliable one. The bilinear transformation involves replacing s by (2/T) (z-1)/(z+1)], but fortunately, MATLAB takes care of all the detail and we can design a Butterworth low pass filter simply by executing the MATLAB statement: [a b] = butter(N, fc) N is the required order and fc is the required 3 dB cut-off frequency normalised (as usual with MATLAB) to fS/2. Analogue Butterworth filters have a gain which is zero in the pass-band and falls to -3 dB at the cut-off frequency. These two properties are preserved by the bilinear transformation, though the traditional Butterworth shape is changed. The shape change is caused by a process referred to as frequency warping. Although the gain-response of the digital filter is consequently rather different from that of the analogue Butterworth gain response it is derived from, the term Butterworth filter is still applied to the digital filter. The order of H(z) is equal to the order of Ha(s) Frequency warping: It may be shown that the new gain-response G() = Ga() where = 2 tan(/2). The graph of against below, shows how in the range - to is mapped to in the range - to . The mapping is reasonably linear for in the range -2 to 2 (giving in the range -/2 to /2), but as increases beyond this range, a given increase in produces smaller and smaller increases in . The effect of frequency warping is well illustrated by considering the analogue gain-response shown in fig 5.17(a). If this were
EEE-2013 Page 55

EE 010 604

## Digital Signal Processing

transformed to the digital filter gain response shown in fig 5.17(b), the latter would become more and more compressed as .
Radians/sample 3.14 2.355 1.57 0.785 Radians/second 2 4 6 8 10 12

-12

-10

-8

-6

-4

## Fig Frequency Warping Fig5.16 6.1: Frequency warping

|Ha(j )|

|H(exp(j )|

/2 Fig. 5.17(a): Analogue Gain Fig. 5.17(b): Effect of Bilinear Fig 6.2(a): Analogue gain response Fig 6.2(b): Effect of bilinear transformation Response Transformation Prototype analogue transfer function: Although the shape changes, we would like G() at its cut off C to the same as Ga() at its cut-off frequency. If Ga() is Butterworth, it is -3dB at its cut-off frequency. So we would like G() to be -3 dB at its cut-off C. Achieved if the analogue prototype is designed to have its cut-off frequency at C = 2 tan(C/2). C is then called the pre-warped cut-off frequency.

EEE-2013

Page 56

EE 010 604

## Digital Signal Processing

Designing the analogue prototype with cut-off frequency 2 tan(C/2) guarantees that the digital filter will have its cut-off at C. Design of a 2nd order IIR low-pass digital filter by the bilinear transform method (by hand) Let the required cut-off frequency C = /4 radians/sample. We need a prototype transfer function Ha(s) for a 2nd order analogue Butterworth lowpass filter with 3 dB cut-off at C = 2tan(C/2) = 2 tan(/8) radians/second. Therefore, C = 2 tan(/8) = 0.828. It is well known by analogue filter designers that the transfer function for a 2nd order Butterworth low-pass filter with cut-off frequency =1 radian/second is:
H a ( s) = 1 1 + ( 2 )s + s 2

When the cut-off frequency is = C rather than = 1, the second order expression for H(s) becomes:
H a (s) = 1 1 + 2 ( s / C ) + ( s / C ) 2

Replacing s by j and taking the modulus of this expression gives G() = 1/[1+(/C)2n] with n=2. This is the 2nd order Butterworth low-pass gainresponse approximation. Deriving the above expression for Ha(s), and corresponding expressions for higher orders, is not part of our syllabus. It will not be necessary since MATLAB will take care of it. Setting C = 0.828 in this formula, then replacing s by 2(z-1)/(z+1) gives us H(z) for the required IIR digital filter. You can check this by hand, but fortunately MATLAB does all this for us. Example 5.7 Using MATLAB, design a second order Butterworth-type IIR low-pass filter with c = / 4. Solution:
EEE-2013 Page 57

EE 010 604

## [a b] = butter(2, 0.25) a = [0.098 0.196 0.33] 0.098]

b = [1 -0.94

The required expression for H(z) is 0.098 + 0.196 z-1 + 0.098 z-2 H(z) =

## 1 + 2 z 1 + z 2 H ( z ) = 0.098 1 0.94 z 1 + 0.33 z 2

which may be realised by the signal flow graph in fig 5.18. Note the saving of two multipliers by using a multipler to scale the input by 0.098.

x[n]

0.097

y[n]

0.94

-0.33

EEE-2013

Page 58

EE 010 604

## Digital Signal Processing

Recursive filters of order greater than two are highly sensitive to quantisation error and overflow. It is normal, therefore, to design higher order IIR filters as cascades of bi-quadratic sections. MATLAB does not do this directly as demonstrated by Example 5.8. Example 5.8: Design a 4th order Butterworth-type IIR low-pass digital filter is needed with 3dB cut-off at one sixteenth of the sampling frequency fS.

Solution: Relative cut-off frequency is /8. The MATLAB command below produces the arrays a and b with the numerator and denominator coefficients for the 4th order system function H(z). [a b] = butter(4, 0.125) Output produced by MATLAB is: a = 0.00093 b=1 0.0037 0.0056 0.0037 0.00093

-2.9768

3.4223

-1.7861

0.3556

## The system function is therefore as follows:

0.00093 + 0.0037 z 1 + .0056 z 2 + .0037 z 3 + 0.00093 z 4 H ( z) = 1 2.977 z 1 + 3.422 z 2 1.786 z 3 + 0.3556 z 4

This corresponds to the 4th order direct form signal flow graph shown below.

## z A 4th order direct form II realisation (not commonly Figure 5.19:

-1

used)

2.977

0.000 939

+ 3.422 z-1

+ +

Higher order IIR digital filters are generally not implemented like this. z-1 Instead, they 1.79 are implemented as cascaded biquad or second order sections (SOS). Fortunately MATLAB can transform the direct form coefficients to

EEE-2013

0.356

EE 010 604

## Digital Signal Processing

second order section (SOS) coefficients using a Signal Processing Toolbox function tf2sos as follows: [a b] = butter(4, 0.125) [sos G] = tf2sos(a,b) Executing these statements gives the following response: [a b] = butter(4, 0.125) a = [0.0009 b = [1 0.0037 0.0056 0.0037 0.0009]

-2.9768

3.4223

-1.7861

0.3556 ]

[sos G] = tf2sos(a,b) sos = [1 2 1 G = 0.00093 This produces a 2-dimensional array sos containing two sets of biquad coefficients and a gain constant G. A mathematically correct system function based on this data is as follows:
1 + 2 z 1 + z 2 1 + 2 z 1 + z 2 H ( z ) = 0.00093 1 1.365 z 1 + 0.478 z 2 1 1.612 z 1 0.745 z 2

1 2

1 1

-1.365 1

0.478 0.745 ]

-1.612

In practice, especially in fixed point arithmetic, the effect of G is often distributed among the two sections. Noting that 0.033 x 0.028 0.00093, and noting also that the two sections can be in either order, an alternative expression for H(z) is as follows:
1 + 2 z 1 + z 2 1 + 2 z 1 + z 2 H ( z ) = 0.033 0 . 028 1 1.612 z 1 0.745 z 2 1 1.365 z 1 + 0.478 z 2

This alternative expression for H(z) may be realised in the form of cascaded bi-quadratic sections as shown in fig 5.20.
EEE-2013 Page 60

EE 010 604

## Digital Signal Processing

x[n]

0.033

0.028

y[n]

1.6

1.36

-0.74

-0.48

Fig. 6.4: Fourth order IIR Butterworth filter with cut-off fs/16 Fig. 5.20 Fourth order IIR Butterworth LP filter with cut-off fs/16

1.1 0.9 0.7 0.5 0.3 0.1 -0.1 0 0.5 1 1.5 2 2.5 3 Radians/second Gain

3.5

4.5

## Fig. 5.21(a) Analogue 4th order Butterworth LP gain response

1.1 0.9 Gain 0.7 0.5 0.3 0.1 -0.1 0

1/2

Radians/sample

0.4

0.785

1.57

2.355

3.14

EEE-2013

Page 61

EE 010 604

## Digital Signal Processing

Fig. 5.21(a) shows the 4th order Butterworth low-pass gain response:
G () = 1 (1 + 8 )

(with cut-off frequency normalised to 1) as used by MATLAB as a prototype. Fig 5.21(b) shows the gain-response of the derived digital filter which, like the analogue filter, is 1 at zero frequency and 0.707 (-3dB) at the cut-off frequency (/8 0.39 radians/sample). Note however that the analogue gain approaches 0 as whereas the gain of the digital filter becomes exactly zero at = . The shape of the Butterworth gain response is warped by the bilinear transformation. However, the 3dB point occurs exactly at c for the digital filter, and the cut-off rate becomes sharper and sharper as because of the compression as .

5.13: IIR digital high-pass band-pass and band-stop filter design: The bilinear transformation may be applied to analogue system functions which are high-pass, band-pass or band-stop to obtain digital filter equivalents. For example a high-pass digital filter may be designed as illustrated below: Example 5.9 Design a 4th order high-pass IIR filter with cut-off frequency fs/16. Solution: Execute the following MATLAB commands and proceed as for lowpass [a b] = butter(4,0.125,high); freqz(a,b); [sos G] = tf2sos(a,b) Wide-band band-pass and band-stop filters (fU >> 2fL) may be designed by cascading low-pass and high-pass sections, but 'narrow band' band-pass/stop filters (fU not >> 2fL) will not be very accurate if this cascading approach is used. The MATLAB band-pass approach always works, i.e. for narrowband and wideband. A possible source of confusion is that specifying an order 2 produces what many people (including me, Barry) would call a 4th order IIR
EEE-2013 Page 62

EE 010 604

## Digital Signal Processing

digital filter. The design process carried out by butter involves the design of a low-pass prototype and then applying a low-pass to band-pass transformation which doubles the complexity. The order specified is the order of the prototype. So if we specify 2nd order for band-pass we get a 4th order system function which can be re-expressed (using tf2sos) as TWO biquad sections. Example 5.10: Design a 2nd (4th)order bandpass filter with L = /4 , u = /2. Solution: Execute the following MATLAB statements: [a b] = butter(2,[0.25 0.5]) freqz(a,b); [sos G] = tf2sos(a,b) MATLAB output:is: a = 0.098 0 -0.195 0 0.098 b = 1 -1.219 sos = 1 2 1 1 1.333 -0.667 1 -0.1665 1 -1.0524 0.33 0.5348 0.6232

1 -2 G = 0.098

EEE-2013

Page 63

EE 010 604

## Digital Signal Processing

Magnitude (dB)

-10 -20 -30 -40 0.1 0.2 0.3 0.4 0.5 0.6 0.7 0.8 Normalized Frequency ( rad/sample) 0.9

0.1

0.2

## 0.3 0.4 0.5 0.6 0.7 0.8 Normalized Frequency ( rad/sample)

0.9

Example 5.11: Design a 4th (8th)order bandpass filter with L = /4 , u = /2. Solution: Execute the following MATLAB statements [a b] = butter(4,[0.25 0.5]) freqz(a,b); axis([0 1 -40 0]); [sos G] = tf2sos(a,b) to obtain the MATLAB output: a = 0.01 0 -0.041 0 0.061 0 -0.041 0 0.01 1.519 -0.5

b = 1 -2.472 4.309 -4.886 4.477 -2.914 0.12 sos =1 2 1 1 1 -0.351 1 -0.832 0.428 0.49

1 -2.
EEE-2013

Page 64

EE 010 604

## Digital Signal Processing

2.

1 1

1 -0.046 1 -1.244

0.724 0.793

1 -2 G = 0.01

4th (8th) order IIR Band-pass (Fs/8 - Fs/4) 0 Magnitude (dB) -10 -20 -30 -40

0.1

0.2

0.9

0.1

0.2

## 0.3 0.4 0.5 0.6 0.7 0.8 Normalized Frequency ( rad/sample)

0.9

Example 5.12: Design a 4th (8th)order band-stop filter with L = /4 , u = /2. Solution: Execute the following MATLAB statements [a b] = butter(4,[0.25 0.5], stop) freqz(a,b); axis([0 1 -40 0]); [sos G] = tf2sos(a,b) to obtain the MATLAB output: a = 0.347 -1.149 b = 1 -2.472
EEE-2013

2.815 -4.237

5.1 -4.237

0.347

4.309 -4.886

4.477 -2.914

0.12
Page 65

EE 010 604

sos =

## 0.428 0.49 0.724 0.793

G = 0.347

4th (8th) order IIR Band-stop (Fs/8 - Fs/4) 0 Magnitude (dB) -10 -20 -30 -40

0.1

0.2

0.9

0.1

0.2

## 0.3 0.4 0.5 0.6 0.7 0.8 Normalized Frequency ( rad/sample)

0.9

5.14: Comparison of IIR and FIR digital filters: IIR type digital filters have the advantage of being economical in their use of delays, multipliers and adders. They have the disadvantage of being sensitive to coefficient round-off inaccuracies and the effects of overflow in fixed point arithmetic. These effects can lead to instability or serious distortion. Also, an IIR filter cannot be exactly linear phase.
EEE-2013 Page 66

EE 010 604

## Digital Signal Processing

FIR filters may be realised by non-recursive structures which are simpler and more convenient for programming especially on devices specifically designed for digital signal processing. These structures are always stable, and because there is no recursion, round-off and overflow errors are easily controlled. A FIR filter can be exactly linear phase. The main disadvantage of FIR filters is that large orders can be required to perform fairly simple filtering tasks. Problems: 5.1 Find H(z) for the following difference equations (a) y[n] = 2x[n] - 3x[n-1] + 6x[n-4] (b) y[n] = x[n-1] - y[n-1] - 0.5y[n-2] 5.2 Show that passing any sequence {x[n]} through a system with H(z) = z - 1 produces {x[n-1]} i.e. all samples are delayed by 1 sampling interval. 5.3. Calculate the impulse-response of the digital filter with 1 H(z) = 1-2z 5.4
-1

Draw the signal-flow graph for example 5.3, and plot its poles and zeros.

5.5 If discrete time LTI systems L1 and L2, with impulse responses {h 1 [n] } and {h 2 [n] } respectively, are serially cascaded as shown below, calculate the overall impulse response. Show that this will not be affected by interchanging L 1 & L 2 .

EEE-2013

Page 67

EE 010 604

x[n]

## y[n] L1 {h1[n]} L2 {h2[n]}

5.6. Design a 4th order band-pass IIR digital filter with lower & upper cut-off frequencies at 300 Hz & 3400 Hz when fS = 8 kHz. 5.7. Design a 4th order band-pass IIR digital filter with lower & upper cut-off frequencies at 2000 Hz & 3000 Hz when fS = 8 kHz. 5.8. What limits how good a notch filter we can implement on a fixed point DSP processor? In theory we can make notch sharper & sharper by reducing the -3dB bandwidth and/or increasing the order. What limits us in practice. How sharp a notch can we get in 16-bit fixed pt arithmetic? 5.9. What order of FIR filter would be required to implement a /4 notch approximately as good as a 2nd order IIR /4 notch with 3 dB bandwidth 0.2 radians/sample? 5.10. What order of FIR low-pass filter would be required to be approx as good as the 2nd order IIR low-pass filter (/4 cut-off) designed in these notes?

EEE-2013

Page 68