0% found this document useful (0 votes)
141 views

DSP Lectures

This document outlines a lecture on digital signal processing and computer networks given by Assistant Professor Dr. Hadi T. Ziboon. The first part of the lecture covers fundamentals of digital signal processing, including time and frequency domain analysis, discrete Fourier transforms, digital filtering techniques, and sampling and analog to digital conversion. The second part addresses topics in computer networks, such as the OSI model, TCP/IP protocols, physical layer technologies, and applications of the network layer. The lecture concludes with recommendations for further reading on digital signal processing and computer networks.
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
141 views

DSP Lectures

This document outlines a lecture on digital signal processing and computer networks given by Assistant Professor Dr. Hadi T. Ziboon. The first part of the lecture covers fundamentals of digital signal processing, including time and frequency domain analysis, discrete Fourier transforms, digital filtering techniques, and sampling and analog to digital conversion. The second part addresses topics in computer networks, such as the OSI model, TCP/IP protocols, physical layer technologies, and applications of the network layer. The lecture concludes with recommendations for further reading on digital signal processing and computer networks.
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 154

University of Technology

Department of Electrical Engineering

Lect 1

Fundamentals of Digital
Signal Processing

Asst. Prof. Dr. Hadi T. Ziboon


Lect. 1, Asst. Prof. Dr. Hadi T. Ziboon, Department of Electrical Eng. U.O.T

Digital Signal Processing and Computer Network

Digital Signal Processing

1.1 Introduction
Signal and systems representation, representation of signals in
time, sampling and analog to signal conversion.
1.2 Time domain analysis
Linear time invariant systems, impulse response and convolution
sum.
1.3 Frequency Domain Analysis and Z-Transform
Linear constant-coefficient difference equation, Fourier transform
and frequency response, z-transform.
1.4 Discrete Fourier Transforms (DFT) and FFT
Signal analysis and synthesis based on DFT, Fast Fourier
Transform (FFT).
1.5 Filter Analysis
Fundamental structures of digital filter.
1.6 Infinite Impulse Response (IIR) Digital filter
1.7 Finite Impulse Response (FIR) Digital Filter

1
Lect. 1, Asst. Prof. Dr. Hadi T. Ziboon, Department of Electrical Eng. U.O.T

Computer Network

2.1 Introduction
Internet architecture, OSI and TCP / IP reference models, network
history and standardization, network topology, LAN, MAN and WAN.
2.2 Physical Layer
Theoretical basis, various transmission medias, various well know
networks, multiplexing, switching.
2.3 Data link layer
Framing, error control (detection and correction), flow control.
2.4 Network layer
Routing, network control, IP protocols, routing and control protocols.
2.5 Transport layer
Reliable end – end data transfer principles, flow control, end-end
congestion control, UDP, TCP.
2.6 Application layer
WWW, FTP, Email, DNS, Multimedia.
2.7 Network security
Text Books
[1]Introduction to digital signal processing with computer application,
Paul Lynng 1993.
[2] Digital Signal Processing, Li Tan 2008.
[3] Data Communication and computer Network Behrous Feourozon,
2007.
2
Lect. 1, Asst. Prof. Dr. Hadi T. Ziboon, Department of Electrical Eng. U.O.T

1. Introduction
1.1 The scope of digital signal processing (DSP)

1.1 DSP techniques are now used to analyze and process signals and
data arising in many areas of engineering, science, medicine, economics
and the social sciences.

1.2 DSP is concerned with the numerical manipulation (treatment) of


signals and data in sampled form. Using elementary operations as digital
storage, delay, addition, subtraction and multiplication by constants, we
can produce a wide variety of useful functions. For example to extract a
wanted signal from unwanted noise, to assess the frequencies presented
in a signal.

1.3 The general purpose computer can be used for illustrating DSP
theory and application. However, if high speed real time signal
processing is required, it may use special purpose digital hardware.

Programmable microprocessors attached to a general purpose host


computer.

1.4 Various terms are used to describe signals in the DSP environment.

Discrete-time signal, we mean a signal which is defined only for a


particular set of instants in time or sampling instants.

3
Lect. 1, Asst. Prof. Dr. Hadi T. Ziboon, Department of Electrical Eng. U.O.T

1.5 Discrete time signals may be divided into two categories:-

a. Sampled data signals, which display a continuous range of amplitude


values.

b. Digital signals, in which the amplitude values are quantized in a series


of finite steps.

1.6 Signals stored or processed in a computer are digital, because each


sample value is represented by a finite length binary.

1.7 In practice, the term discrete time signal and digital are often used
interchangeably.

Fig (1.1) shows two discrete time signals

x[n] y[n]
x[n] y[n]
DSP

n=0 T nT n

fig (1.1) Input and output signal of DSP processors

x [n] is the sampled input to a digital signal processor.

y [n] is the sampled output to a digital signal processor.

T is the sample period.

n denotes the sample number or index.

4
Lect. 1, Asst. Prof. Dr. Hadi T. Ziboon, Department of Electrical Eng. U.O.T

1.8 Fig (1.2) shows a typical DSP block diagram.


Examples of input signals might be analog voltage temperature,
pressure or light intensity.
a. If the signal is not electrical, it is first converted to a proportional
voltage variation by a suitable transducer.
b. Analog filter, is used the first stage in the block diagram to limit
the frequency range of the signal prior to sampling.
c. The signal isnext sampled and converted into a binary code by an
analog to digital converter (ADC). After digital signal processing it
may be changed back into analog form by DAC. Analog filter is
used the final stage to remove sharp transitions from the DAC
output.
d. After DSP the signal may be used to drive a computer display, or it
may be transmitted in binary form to a remote terminal or location.
Fig (1.2) A typical DSP block diagram.
Analog Analog
input Analog ADC DSP DAC Analog output
filter filter

1.2. Some useful applications


If the output of a typical DSP is given by y[n] for a given input signal x
[n]
y[n]= F{x[n] + x[n-1] + x[n-2] + ……….. + x [n-N]} … (1.1a)
Constant or variable

y[n] = F { ∑𝑁
𝑘=0 𝑥[𝑛 − 𝑘]} …… (1.1b)
5
Lect. 1, Asst. Prof. Dr. Hadi T. Ziboon, Department of Electrical Eng. U.O.T

y[n]= F{x[n] + x[n-1] + x[n-2] + ……….. + x [n-N]}


y[n] = F { ∑𝑁
𝑘=0 𝑥[𝑛 − 𝑘]} ……… (1.1)
Equation (1.1):-
a) is a recurrence formula, which is used over and over again to fined successive
values of y.
b) It is also called a difference equation.
c) It is nonrecursive, because each output is computed simply form input values.
d) It is used to define filters if each term multiplied by a constant or variable
number [F].
2.2 The above algorithm described by eq(1.1) is not very efficient because of each
output value is exactly the same as the one before it, except that the most recent
input sample is included.
Eq (1.1) can be smoothed the output signal y[n] by
y[n+1] = y[n] + F {x[n+1] – x[n-N]} ….. (1.2)
Since eq (1.2) is a recurrence formula which applied for any value of n,
we may subtract (1) from each term in square brackets, giving
y[n] = y[n-1]+F{x[n] – x[n-N-1]} ….. (1.3)
Eq (1.3):-
a) Confirms that we can estimate each output sample by updating the
previous output y [n-1].
b) The equation defines a recursive version of the filter which is more
efficient, required fewer addition and subtraction.

6
Lect. 1, Asst. Prof. Dr. Hadi T. Ziboon, Department of Electrical Eng. U.O.T

1.3. Sampling and Analog to Digital Conversion


1.3.1 Suppose that an analog signal is to be represented by a set of
equally spaced samples.
Fig (1.3.a) shows a signal sampled at a rate which is clearly too low to
pick out the more rapid fluctuations.
Fig (1.3.b), sampling appears unnecessarily fast.
A great many samples values would have to be stored, processes or
transmitted.
x[n] x[n]

n
n

Fig (1.3.a)Fig (1.3.b)


Thus must choose suitable or intermediate sample rate which is
adequate, without excessive.
3.2 Shannon'S sampling theorem, which may be stated as follows:-
An analog signal containing components up to some maximum
frequency f1 Hzmay be completely represented by regularly spaced
samples, provided the sampling rate is at least 2f1 samples per second.
Thus a speech waveform having f1=3KHz should be sampled at least
6000 Hz. If we use the minimum rate specified by the theorem, then the
sampling interval T is given by
1
T= ....... (1.4)
2f1
7
Lect. 1, Asst. Prof. Dr. Hadi T. Ziboon, Department of Electrical Eng. U.O.T

1.3.3 Alternatively, if we have a digital system with sampling interval T, the maximum analog
frequency is called the Nyquist frequency and is given by
1 𝜋
𝑓1 = 2𝑇 𝐻𝑧 𝑜𝑟 𝑊1 = 2𝜋𝑓1 = 𝑇 𝑟𝑎𝑑𝑖𝑎𝑛𝑠/𝑠 ……… (1.5)
3.4 Fig (1.4a) represents the frequency distribution or spectrum of an analog speech signal. There
are no components above maximum frequency.
/ H(f) /

(a) 𝑓1 𝑓1 = 3𝐾𝐻𝑧
0 3𝑓(𝐾𝐻𝑧)
/ H(f) /
Reconstructed filter

(b) 𝑓𝑠 = 2𝑓1 = 6𝐾𝐻𝑧

0 3 6

aliasing / H(f) / 3 6a aliasing

(c)

𝑓𝑠 < 2𝑓1 = 5𝐾𝐻𝑧

f
Fig (1.4) The effects of sampling on a signal spectrum.
From fig (1.4) can be concluded:-
a) The spectrum as an even function, extending to negative frequencies. This widely used
representation results from expressing each frequency component as the sum of two
exponentials. Thus a component Acoswt may be written as
𝐴 𝐴
𝐴𝑐𝑜𝑠(𝑤𝑡) = 𝑒 𝑗𝑤𝑡 + 𝑒 −𝑗𝑤𝑡 …. (1.6)
2 2
b) Reconstructing filter is used to recover the original signal. The filter type is low pass filter.

8
Lect. 1, Asst. Prof. Dr. Hadi T. Ziboon, Department of Electrical Eng. U.O.T

1.3.5 In most electronic DSP applications, sampling is performed by an


analog to digital converter (ADC), which also transforms the stream of
samples into a binary code. The binary code N bit long
allows2𝑁 separate numbers. Thus if N=8, we may encode28 = 256,
discrete values.
1.3.6 Analog signals normally take on a continuous range of amplitudes,
so when they are sampled and binary coded small amplitude errors are
bound to be introduced as shown in fig (1.5) with 3 bite code.
Sample value 3 47 6 x[n]
Binary code 011 100 111 110 7
6
Fig (1.5) Converting an analog 5
signal into a binary code (3bite) 4
3
2
1
0 n
1.3.7 Fig (1.5) shows the following note:-

a) With 3 bit code, the separate sample values are 8. The total amplitude
range is divided into 8 quantization levels or slots.

b) The maximum error introduced into each sample value by this process
1
is± half quantization level. With 3 bite code the error ± of the total
16

available amplitude range. This error is called quantization noise.

c) Analog to digital conversion always degrades a signal to some value.

9
Lect. 1, Asst. Prof. Dr. Hadi T. Ziboon, Department of Electrical Eng. U.O.T

1.3.8 After a signal has been processed digitally, it may be converted back to an
analog voltage using a digital to analog converted (DAC).

Fig (1.6) shows digital to analog conversion:-

a) Each signal sample value, corresponding to the binary code delivered to the
DAC input, is held drawing the following sampling interval.
b) The resulting staircase waveform is suitable for many practical applications
(including the computer plots).
c) If a true analog output is required, a further smoothing filter must be employed
in order to obtain fully reconstructed signal.

Binary code 010 000 111 101


7
Sample value 5

2
n
7
5
DAC output
2
Time

Analog signal

Time

Fig (1.6) Digital to analog conversion.

10
Lect. 1, Asst. Prof. Dr. Hadi T. Ziboon, Department of Electrical Eng. U.O.T

1.4. Basic type of digital signal

Many DSP algorithms are linear. The response of a linear algorithm,


or processor, to a number of signals applied simultaneously equals the
summation of its responses to each signal applied separately. Thus if we
can define the responses to each signal applied separately. Thus we can
define the response of a linear processor to basic signals, we can
predicate its response of a linear processor to basic signals; we can
predict its response to more complication environment (summation of a
number of simpler basic signals).

1.4.1 Unit step function


The unit step function u[n] is defined as
u(n)

𝑢[𝑛]=0 𝑛<0
𝑢[𝑛]=1 𝑛≥0] … (1.7)
Fig (1.7) shows unit step

1.4.2Unite impulse function


The unit impulse function δ[n] is shown in fig (1.8) and defined as
δ[n]

𝛿 [𝑛]=0 𝑛≠0
𝛿 [𝑛]=1 𝑛=0] … (1.8)1
fig (1.8) unit impulse function n
The relationship between unite step and unite impulse is given by
𝑢[𝑛] = ∑𝑛𝑚=−∞ 𝛿 (𝑚) …. (1.9)
11
Lect. 1, Asst. Prof. Dr. Hadi T. Ziboon, Department of Electrical Eng. U.O.T

Conversely, we can easily generate δ[n] from u[n]. The recurrence


formula:
δ[n] = u[n] – u[n-1] … (1.10)
Eq(1.10) holds good for all integer values of n.

1.4.3 Unit ramp function

The unit ramp function is shown in fig (1.9) and defined as

r[n] = n u[n] …. (1.11)

since u[n] is zero for n<0 r[n]

so also ramp function is zero

for n<0
n
fig (1.9) The unit ramp function.
Ex 1.1Find expression for the following signal.x[n]
a) This is a unit step function which has been scaled
(Weighted) by of -2, it starts at n= - 4, rather than
n=0, and it is time reversed. n
-2
b) Scaling by -2gives the function -2u[n]
c) Time shifting so that it starts at n=-4
gives the function -2u[n=-4]
d) Reversal gives the function -2u[-n-4].Hence the required function is
𝑥 [𝑛] = −2𝑢[−𝑛 − 4] since 𝑢[𝑛] = 1 𝑛 > 0
= −2𝑢[−(𝑛 + 4)] = 0 𝑛 < 0
in this case reversal
12
Lect. 1, Asst. Prof. Dr. Hadi T. Ziboon, Department of Electrical Eng. U.O.T

Ex 1.2 Find expression for the following signal x[n]


Solution

a) This rectangular pulse may be considered 1


as the summation or superposition, of
a unit step at n= -3 and an equal but
opposite unite step at n= -5 n
b) ∴x[n] = u[n+3] – u[n-5]
Ex 1.3 Find an expression for the following signal
Solution
a) The signal is weighted unit impulse of
value 8, time shifted to occurat n=6 x[n]
8
b) ∴x [n] = 8 δ[n-6]n
6
Ex 1.4 Find expression for the following signal
Solution
a) This signal may be considered as x[n]
the superposition of two ramp 6 8
Function:- 4
2

1. One starts at n=-6 and has slop of 2 n


Its upward trend may be stopped by adding another ramp
2. The another ramp starting at n=-2 with slope of -2
∴ x[n]= 2r[n+6]-2r[n+2]

13
Lect. 1, Asst. Prof. Dr. Hadi T. Ziboon, Department of Electrical Eng. U.O.T

1.4.4 Exponential, sine and cosines signal


a) Exponential signals are used in analysis and often occur in the natural world and
in technology.
In the DSP context, sampled exponentials are used as a powerful set of frequency
domain techniques to analyze and process signal and to design the system.
The exponential signal is defined by

𝑥[𝑛] = 𝐴 𝑒 𝛽𝑛 …. (1.12)
Where A and β are constants.

b) Fig (1.10) shows the forms of signal for different values of 𝛽 .


x[n] x[n] x[n]
β<0 β=0 β>0

n n n
fig (1.10) Basic digital signal real exponentials.
c) Such real exponentials theoretically continue forever in both directions. In
practice, we work with defined signals in time such as
𝛽𝑛
x[n] = �Ae n≥0 …. (1.13)
0 n<0
we can make use of the fact that the unit step u[n] is zero for n<0 and unity for n ≥
0, if multiply or modulate an exponential by u[n], then x[n]
𝑥 [𝑛] = 𝐴 𝑒 𝛽𝑛 𝑢[𝑛] …. (1.14)
d) The successive sample values from a simple geometric progression each value
equals that of its neighbor, multiplied by constant βn.
∴𝑥 [𝑛] = 𝐴 𝑒 𝛽𝑛 = 𝐴𝐵𝑛 𝑤ℎ𝑒𝑟𝑒 𝐵 = 𝑒 𝛽
Hence 𝑥 [𝑛 + 1] = 𝐴𝐵𝑛+1 = [𝐴𝐵𝑛 ]𝐵 = 𝐵𝑥[𝑛] …. (1.15)
14
Lect. 1, Asst. Prof. Dr. Hadi T. Ziboon, Department of Electrical Eng. U.O.T

e) If we next allow the constant β in eq (1.12) to be purely imaginary.


Let us considerβ=jΩ ….. (1.16)
Where 𝑗 = √−1 , Ω= is a real constant.
∴𝑥1 = 𝐴 𝑒 𝛽𝑛 = 𝐴𝑒 𝑗𝛺𝑛
= A cos (Ωn) +jA sin(Ωn) …….. (1.17)
Eq (1.17) contains a cosin real part and sin imaginary part. However we
deal mainly with real signals, if we put β= -jΩ, another signal is defined
𝑥2 [𝑛] = 𝐴 𝑒 −𝑗𝛺 = 𝐴 cos(𝛺𝑛) − 𝑗𝐴𝑠𝑖𝑛(𝛺𝑛)
f) By adding 𝑥1 , 𝑥2
𝑥1 [𝑛] + 𝑥2 [𝑛] = 𝐴 cos(𝛺𝑛) + 𝑗𝐴 sin(𝛺𝑛) +
𝐴 cos(𝛺𝑛) − 𝑗𝐴 sin(𝛺𝑛)
𝑥1 [𝑛] + 𝑥2 [𝑛] = 2𝐴 cos(𝛺𝑛) …. (1.18)
1 1
𝐴 cos(𝛺𝑛) = 𝑥1 [𝑛] + 𝑥2 [𝑛]
2 2
𝐴 𝐴
= 2 𝑒 𝑗(𝛺𝑛) + 2
𝑒 −𝑗(𝛺𝑛) ….. (1.19)

This result shows that a sampled cosine signal can be made up from a
pair of sampled imaginary exponentials
g) By subtracting 𝑥1 and 𝑥2
𝑥1 − 𝑥2 = 2𝑗 sin(𝑛𝛺)
𝐴 𝐴
∴ 𝐴 sin(𝑛𝛺) = 𝑒 𝑗(𝑛𝛺) − 𝑒 −𝑗(𝑛𝛺) … (1.20)
2𝑗 2𝑗

Therefore, a real sampled, sine signal may also be made us from a


pair of imaginary exponentials.

15
Lect. 1, Asst. Prof. Dr. Hadi T. Ziboon, Department of Electrical Eng. U.O.T

 What is the difference between sampled sine and cosines and their
counterpart?
1) Analog sine and cosine signals are oscillatory and periodic sample sines and
cosines, however, are not necessarily periodic. Although their sample values lie on
a periodic envelope, the numerical values may not form a repetitive sequence. Fig
(1.11a) shows a discrete time sinusoid and fig (1.11b) shows a discrete time
cosinusoid both are periodic but fig (1.11c) shows a discrete time samples lies a
long a sinusoidal envelope, does not have repeating numerical values.
Exact repetition will only occur if the sampling interval bears some simpler
relationship to the repetition time or period of the analog signal. This means that
𝑥 [𝑛] = 𝐴 𝑒 𝑗𝑛𝛺 = 𝐴 𝑒 𝑗[𝑛+𝑁]𝛺 = 𝐴 𝑒 𝑗(𝑛𝛺) 𝑒 𝑗(𝑁𝛺) … (1.21)

But 𝑒 𝑗𝑁𝛺 =1 if NΩ is a multiple of 2π

𝛺 𝑚
NΩ = 2πm or
2𝜋
= 𝑁
…… (1.22)

𝛺
Hence x[n] is only periodic if is a rational number (the ratio of two
2𝜋
integer). Otherwise its sample values do not repeat.

2) A second difference between analog and digital sinusoidal signals


concerns the question of time and frequency scales.
If x[n] = A sine [nΩ] …. (1.23)
n is assumed to be a dimensionless integer thus Ω in radians
But one completes period corresponding to
nΩ = 2π or n = 2π / Ω …… (1.24)
thus 2π / Ω is sample/period regardless of the time or frequency.
16
Lect. 1, Asst. Prof. Dr. Hadi T. Ziboon, Department of Electrical Eng. U.O.T

x[n] x[n]

n n

(a) Sine (b) Cosine


x[n]

(c) Discrete time sample lies along a sinusoidal envelope


Fig (1.11) Basic digital signals sines and cosines.
- If the sampling instants are given by
t = n T, n=… -2,-1,0,1,2, (where n= index represents time)…. (1. 24a)
and the sampling frequency is
1
𝑓𝑠 = 𝑇 …. (1.24b)

∴ The digital signal is given by


x[n] = sin (nΩ) = sin (nwT) …. (1.25)
since nT represents time in seconds , w must be an angular frequency in rad/sec. If
f is corresponding frequency, then w = 2πf and eq (1.25) may be written as
𝑛 2𝜋𝑓
𝑥[𝑛] = sin( 𝑓𝑠
) ….. (1.26)

Thus the sample series may be generated if both f and 𝑓𝑠 are know.

17
Lect. 1, Asst. Prof. Dr. Hadi T. Ziboon, Department of Electrical Eng. U.O.T

Ex (1.5) Sketch carefully, and defined the values for each samples of the
following signals:-
𝜋𝑛
a) 𝑥 [𝑛] = exp (0.2𝑛) b) 𝑥 [𝑛] = cos( )
4
𝑛 𝜋𝑛 −𝑛
c)𝑥 [𝑛] = exp( ) sin( ) d) 𝑥 [𝑛] = exp � � cos(𝑛)𝑢[𝑛]
15 6 5

x[n](1.22)2
1.22
1
0.22
n
n
(a) (b)

n n

(c) (d)

1.5. Digital Processors


1.5.1 Processor means any system which carriers out a DSP function. It
may be a general purpose computer, microprocessor, special hardware or
a combination of these. In general the processor is a computer plus
software.
1.5.2 No particular distinction between the terms processor and system.

18
Lect. 1, Asst. Prof. Dr. Hadi T. Ziboon, Department of Electrical Eng. U.O.T

1.6. Linear Time Invariant (LTI) System Properties


1.6.1 A linear system or processor may be defined as one which obeys
the principle of superposition. If an input consisting of the sum of an
number of signals is applied to a linear system, then the output is the
sum or superposition of the system's response to each signal considered
separately.
Let as consider an input 𝑥1 [𝑛]applied to a digital processor produced
𝑦1 [𝑛]and that input 𝑥2 [𝑛] produced output 𝑦2 [𝑛]. Then the process are is
linear if its response to {𝑥1 [𝑛] + 𝑥2 [𝑛]} is {𝑦1 [𝑛] + 𝑦2 [𝑛]}.
1.6.2 Furthermore, if an input 𝑎1 𝑥[𝑛]produced output ay[n] where a is
constant coefficient or multiplier or a weighting factor.
In general the weighted sum of inputs
𝑎1 𝑥1 [𝑛] + 𝑏𝑥2 [𝑛] + 𝑐𝑥3 [𝑛] + ⋯ must produce the weighted sum of
outputs
𝑎1 𝑦1 [𝑛] + 𝑏𝑦2 [𝑛] + 𝑐𝑦3 [𝑛] + ⋯
Let us consider a system which squares each sample value applied to its
input. Thus for two different inputs applied separately, we have
𝑦1 = (𝑥1 [𝑛])2 𝑎𝑛𝑑 𝑦2 = (𝑥2 [𝑛])2 …. (1.27)
When the same two inputs are summed, and applied simultaneously, the output is
𝑦3 = {𝑥1 [𝑛] + 𝑥2 [𝑛]}2
= {𝑥1 [𝑛]}2 + {𝑥2 [𝑛]}2 + 2𝑥1 [𝑛]𝑥2 [𝑛] … (1.28)

19
Lect. 1, Asst. Prof. Dr. Hadi T. Ziboon, Department of Electrical Eng. U.O.T

Eq(1.28) is not the sum of its responses to 𝑥1 [𝑛] 𝑎𝑛𝑑 𝑥2 [𝑛] applied
separately.
1.6.3 Frequency Preservation: - It means that if we apply an input signal
containing certain frequencies to a linear system, the output can contain
only the same frequencies and no others. The property depends upon the
fact a sampled sinusoid, applied to any linear processor; produce a
similar form of output.
This property does not hold for the squaring system mentioned above.
Suppose a signal sin(nΩ) is
∴ 𝑦[𝑛] = {𝑥1 [𝑛]}2 = 𝑠𝑖𝑛2 [𝑛𝛺] …. (1.29)
1 1 1
= {1 + cos[2𝑛𝛺]} = + cos [2𝑛𝛺]
2 2 2
Thus there is no component in output at frequency = Ω.
1.6.4 Time Invariance:-A time-invariant system is one whose properties
do not vary with time. The only effect of a time shift in an input signal to
the system is a corresponding time shift in its output. The majority of
technological systems and processes are of this type.
6.5 Association and Commutation
Association property means that we may analyze a complicated LTI
system by breaking it down into a number of simpler subsystems. Also,
we can synthesize an overall system perhaps a very complicated one by
designing a number of independent subsystems.

20
Lect. 1, Asst. Prof. Dr. Hadi T. Ziboon, Department of Electrical Eng. U.O.T

The commutative property of LTI systems means that if the subsystems


are arranged in series or cascade, then they may be arranged in any order
without affecting overall performance. This property advantages to
reduce the complexity.
1.7. Other System Properties [Causality, Stability Invertibility and
Memory]
1.7.1 Causality: In a causal system, the output signal depends only on
present and/or previous values of the inputs. Most practical signal
processors are casual. However, if we record a signal on data and
subsequently process by computer, the software need not be causal.
Ex. y[n]=x[n]+x[n-1] → causal
y[n]=x[n]+x[n+1] → noncausal
7.2 Stability: A stable system is one which produces a finite or bounded
output in response to a bounded input.
1.7.3 Invertibility: If a digital processor with input x[n] gives an output
y[n], then its inverse would produce x[n], if fed with y[n]. The most
practical system is invertible. An exception in the squaring device
mentioned earliest for which
𝑦[𝑛] = {𝑥[𝑛]}2
1.7.4 Memory: A processor possesses memory if its present output y[n]
depends upon one or more previous input values x[n-1], x[n-2], …..

21
Lect. 1, Asst. Prof. Dr. Hadi T. Ziboon, Department of Electrical Eng. U.O.T

Ex (1.6) x[n] and y[n] are the input and output signals of a DSP system.
Determine which of the following properties and possessed by systems
defined by the recurrence formula (a) and (d) below:-
Linearity Invertibility Stability
Causality Time Invariance Memory
a) y[n]= 3x[n] – 4x[n-1]
b) y[n] = 2y[n-1] + x[n+2]
c) y[n] = n x[n]
d) y[n] = cos[x[n]]
Solution
a) – The output is a weighted sum of present and previous inputs
- It is bounded if the input is bounded.
- Thus the system has all six properties mentioned above.
b) – The present output depends on a future input, so the system is not causal.
- If the input signal ceases, the output goes on rising without limit, since each
output value twice the previous one. Therefore the system is unstable.
- However a possess the other properties mentioned above namely: linearity,
time-invariance, invertibility and memory.
c) – The output depends on the present input only, so the system has no
memory.
- Since it also depends on the independent variable, the system is time-variant
- But the system have the properties of linearity, causality, stability and
invertibility.

22
Lect. 1, Asst. Prof. Dr. Hadi T. Ziboon, Department of Electrical Eng. U.O.T

d) y[n] = cos[x[n]]
– A cosine function is periodic; so many different values of x[n]
would produce the same value of y[n]. Hence the system is not
invertible.
- It is not a linear because if we double x[n], we do not double y[n].
- Since y[n] depends only on x[n], the system has no memory.
- However, it is time invariant, causal and stable.
1.8. Classification of Signals
1.8.1 Deterministic and Random Signal
A signal can be classified as deterministic, meaning that there is no
uncertainty with respect to its value at any time or as random that there
is some degree uncertainty before the signal actually occurs.

1.8.2. Periodic and Nonperiodic Signal

A signal is periodic in time if there exist a constant 𝑇0 > 𝑜 such that

𝑥 (𝑡) = 𝑥(𝑡 + 𝑇0 ) where 𝑇0 defines the duration of one period.

1.8.3 Analog and Discrete signals


Analog signal x(t) is a continuous function of time, that is x(t) is defined
for all t. By comparison a discrete signal x[nT] is one that exists only at
discrete times, it is characterized by a sequence for each [nT].

23
Lect. 1, Asst. Prof. Dr. Hadi T. Ziboon, Department of Electrical Eng. U.O.T

1.8.4 Analog and Digital Signals


a) Analog signal amplitude can take on an infinite number of values.
b) Digital signals can take only a finite number of values.
c) The term continuous time and discrete time define the nature of the signal along the time
(horizontal axis).
The terms digital and analog define the nature of the signal amplitude (vertical axis).
Fig (1.11) shows examples of various types of signals.
g(t) g(t)

time time
Analog continuous time Digital continuous time

time time
Analog discrete time Digital discrete time

1.8.5 Energy and Power Signal


a) A signal is defined an energy signal if it has nonzero but finite energy (0 <
𝐸𝑥 < ∞) for all time where
𝑇/2
𝐸𝑥 = 𝑙𝑖𝑚 𝑇→∞ ∫−𝑇/2 𝑥 2 (𝑥) 𝑑𝑡 …… (1.30)

b) A signal is defined as a power signal if it has nonzero but finite power (0 <
𝑃𝑥 < ∞) for all time where
1 𝑇/2
𝑃𝑥 = 𝑙𝑖𝑚 𝑇→∞ ∫−𝑇/2 𝑥 2 (𝑥) 𝑑𝑡 …… (1.31)
𝑇

In general:-
a) Periodic and random signal are classified as power signals.
b) Deterministic and nonperiodic signal classified as energy signals.

24
University of Technology
Department of Electrical Engineering

Lect2

Time Domain Analysis

Asst. Prof. Dr. Hadi T. Ziboon


Lect. 2, Asst. Prof. Dr. Hadi T. Ziboon, Department of Electrical Eng. U.O.T

2.Time Domain Analysis


2.1 Introduction

The basic techniques for describing digital signals and processors in the time domain
are:-

a) Convolution:- allows us to find the output signal from any LTI processor in
response to any input.
b) Impulse response:- this is the response of the processor to the unit impulse
response δ(n).

The time domain methods are used for analysis and are not a great help in designing
new processor. The main reason is that the design specifications are based on
performance in the frequency domain. The convolution takes place in the time
domain, without any need to consider the frequency components of the input signal
and processor.

2.2 Describing Digital Signals with Impulse Function

The digital signal x[n] is shown in fig(2.1) and it is clear that x[n] may be considered
as the superposition or summation of the more basic impulse signals shown in parts
x[1]δ[n-1] x[n]
(e) fig(2.1) (a)

n
n
-2 -1 0 1 2 -2 -1 0 1 2
x[2]δ[n-2] x[-2]δ[n+2]
(b)
(f)
n
n
-2 -1 0 1 2n -2 -1 0 1 2
x[-1]δ[n+1]
Each of these is a unit impulse shiftedx[-1]δ[n+1]
(c)
by 'n' samples which has been weighted
n
by the value of x[n] [ i.e the value of -2 -1 0 1 2
x[0]δ[n]
x[n] for each n instant]
(d)

-2 -1 0 1 2 n

1
Lect. 2, Asst. Prof. Dr. Hadi T. Ziboon, Department of Electrical Eng. U.O.T

Thus each of these signal shown in fig(a-f) is a unit impulse which has been weighted
by the appropriate value of x[n] [ i.e the value of x[n] is shown in part a], and shifted
by a number of sampling intervals.

The complete signal x[n] can be defined as

x[n] = - - - - + x[-2]δ(n+2)+ x[-1]δ(n+1)+ x[0]δ(0)+x[1]δ(n-1)


+x[2]δ(n-2) ….. (2.1)
or

𝑥[𝑛] = ∑∞
𝑘=−∞ 𝑥 [𝑘 ]𝛿[𝑛 − 𝑘]…… (2.2)
Where the integer K takes all value between ±∞, x[n] is a completely general digital
signal.

2.3 Describing Digital LTI Processors

2.3.1 The Impulse Response


• The aim of impulse response is to examine the nature of an LTI processor's
response to an individual impulse.
• The impulse function is time limited signal δ[n]. δ[n] is finite at n=0, but zero
elsewhere.
• If we deliver δ[n] to the input of digital processor, (the excitation) is confined
to the instant n=0.
• Any output signal observed after n=0 must be characteristics of the processor
itself.
• The impulse response is given by the symbol h[n].
• If the input to a linear processor is δ[n], the output must be h[n] as shown in
fig (2.2).
• From impulse response can be determined the system properties such as
causality,stability and memory.

2
Lect. 2, Asst. Prof. Dr. Hadi T. Ziboon, Department of Electrical Eng. U.O.T

δ[n] h(n)
Digital LTI
processor

fig (2.2) the impulse response of an LTI processor

 Fig (2.3) shows four examples of impulse response:-


a) Shows a memory less system
b) Shows a noncausal, since h(n) starts before n=0.
c) Shows a unstable, because h[n] grows without limit as n increases.
d) Shows a causal, stable, system with memory.

(a) h[n] (b) h[n]

memoryless noncausal

(c)h[n] (d) h[n]

Unstable causal, stable, with memory

n n

fig(2.3) various forms of impulse response

 Digital processor is often described by a recurrence formula or difference


equation relating its input and output signals. It is easy to find the impulse
response by this equation.

Ex 2.1

Find the first three sample values of the impulse response h[n]for the system defined
by the following difference equation

y[n]= 1.5 y[n-1] - 0.85 y[n-2] + x[n] …. (2.2)


Assuming the system is a causal.

3
Lect. 2, Asst. Prof. Dr. Hadi T. Ziboon, Department of Electrical Eng. U.O.T

Solution if the system causal, then h[n]

h[n]=0 for n ˂ 0 and x[n] = δ[n]

But δ(n)= 1 for n=0 and δ(n)=0 for elsewhere

Substitute x[n]=δ[n] in eq(2.2) y[n]=1.5y[n-1]-.85y[n-2]+x[n]]

∴ ℎ[𝑛] = 1.5ℎ[𝑛 − 1] − 0.85 ℎ[𝑛 − 2] + 𝛿 [𝑛]…. (2.3)

It is simple to find the value of each term of h[n] for a given value
of n
If n=0 , substitute n=0 in eq(2.3)
∴ ℎ[0] = 1.5ℎ[−1] − 0.85 ℎ[−2] + 𝛿 [0]
=0–0+1=1
Since h[n]=0 for n˂0
If n=1, substitute n=1 in eq(2.3)
ℎ[1] = 1.5ℎ[0] − 0.85 ℎ[−1] + 𝛿 [1]
= 1.5 × 1 – 0.85 × 0 + 0 = 1.5
If n=2,
ℎ[2] = 1.5ℎ[1] − 0.85 ℎ[0] + 𝛿 [2]
= 1.5 × 1.5 – 0.85 × 1 + 0 = 1.4
and so on for other value of n
Note: that is, in this example, the input impulse only contributes at
n=0, but the value of h[n] depend entirely on previous values,
being generated recursively.
Program can be used to evaluate h[n] and their program in
appendix A1 in the reference by Lynn.

4
Lect. 2, Asst. Prof. Dr. Hadi T. Ziboon, Department of Electrical Eng. U.O.T

EX 2.2 Find the first three sample values of the impulse response h[n] for
the system shown in figure

x(n) + y(n)

-0.9
T
Solution:-

From the above figure, the Difference Equation can be written as

y[n]= -0.9 y[n-1] +x[n]

The impulse response is therefore given by:-

h[n]= -0.9 h[n-1] + δ[n]

The system is causal, so that h[n]=0 for n˂0 and zero otherwise

ℎ[0] = −0.9 ℎ[−1] + 𝛿 [0]


= 0 + 1 =1

ℎ[1] = −0.9 ℎ[0] + 𝛿 [1]


∴ ℎ[1] = −0.9 × 1 + 0 = −0.9
ℎ[2] = −0.9 ℎ[1] + 𝛿 [2]
ℎ[2] = −0.9 × −0.9 + 0 = 0.81
ℎ[3] = −0.9 ℎ[2] + 𝛿 [3]
ℎ[3] = −0.9 × 0.81 + 0 = −0.729
Thus each sample value is -0.9 times the previous one, and h[n] therefor
follows decaying real, exponential envelope, with alternate sample.

5
Lect. 2, Asst. Prof. Dr. Hadi T. Ziboon, Department of Electrical Eng. U.O.T

EXP 2.3 find the first four sample values of the impulse response h[n] for the system
defined by the following equation

𝑦 [ 𝑛 ] = 𝑥 [ 𝑛 ] + 𝑥 [ 𝑛 − 1] + 𝑥 [ 𝑛 − 2] + ⋯
Solution:-
This is a nonrecursive system, since no feedback in the equation

The impulse response is therefor given by

ℎ[𝑛] = 𝛿[𝑛] + 𝛿[𝑛 − 1] + 𝛿[𝑛 − 2] + ⋯

ℎ[0] = 𝛿[0] + 𝛿[−1] + 𝛿[−2] + ⋯

the system is causal

ℎ[0] = 1 + 0 + 0 + ⋯ = 1

ℎ[1] = 𝛿[1] + 𝛿[0] + 𝛿[−1] + ⋯

= 0+1+0… = 1

Similarly h[2] =h[3] =1 and so on. The impulse response therefor equals
the unit step.

EXP 2.4Repeat Ex. 2.3 if the equation

𝑦 [ 𝑛 ] = 𝑦 [ 𝑛 − 1] + 𝑥 [ 𝑛 ]
Solution:-this is a recursive system, since there is a feedback in the
equation

The impulse response is given by

ℎ[𝑛] = ℎ[𝑛 − 1] + 𝛿[𝑛]

Using the same procedure to find

ℎ[0] = ℎ[−1] + 𝛿[0] = 0 + 1 = 1

ℎ[1] = ℎ[0] + 𝛿[1] = 1 + 0 = 1

ℎ[2] = ℎ[1] + 𝛿[2] = 1 + 0 = 1

ℎ[3] = ℎ[2] + 𝛿[3] = 1 + 0 = 1

6
Lect. 2, Asst. Prof. Dr. Hadi T. Ziboon, Department of Electrical Eng. U.O.T

2.3.2The Step Response


The unit step function u(n) is the running sum of the unit
impulse δ[n],so the step response of a LTI processor is the
running sum of its impulse response. If the step response is
given by s[n], we have:
𝑠[𝑛] = ∑𝑛𝑚=−∞ ℎ[𝑚]…. (2.4)
or h[n] is the first order difference of s[n]:

ℎ[𝑛] = 𝑠[𝑛] − 𝑠[𝑛 − 1] …. (2.5)


 A step response gives essentially the same information as an
impulse response, but in slightly different form. Step
response are useful for several reason:-
1- The step functions occur quite often in practice.
2- The response of a system to a sudden disturbance is
evaluated by step response.
3- The process of convolution can be defined in terms of step
signals and step response.
Fig (2.4) shows unit step function and step response.
u[n] fig(2.4a)

s[n] fig(2.4b)

7
Lect. 2, Asst. Prof. Dr. Hadi T. Ziboon, Department of Electrical Eng. U.O.T

EX 2.5 Find and sketch, the first four few sample value of the impulse response and
step responses of the system shown in fig (ex 2.5). Also determine the final value of
s[n] as n ∞x(n) y(n)
+
Solution:-

0.8 (a)
T
By inspection we see that the recurrence formula is

𝑦[𝑛] = 0.8 𝑦[𝑛 − 1] + 𝑥[𝑛]


Its impulse response is therefore given by

ℎ[𝑛] = 0.8 ℎ[𝑛 − 1] + 𝛿[𝑛]


Evaluating h[n] term by term we

ℎ[0] = 1 , ℎ[1] = 0.8ℎ[0] + 𝛿[1] = 0.8

ℎ[2] = 0.8 ℎ[1] + 𝛿[2] = 0.8 × 0.8 + 0 = 0.64

ℎ[3] = 0.8 ℎ[2] + 𝛿[3] = 0.8 × 0.64 + 0 = (0.8)3 = 0.512


𝑛
and so on as shown in fig below, {𝑠[𝑛] = Σ−∞ ℎ[𝑚]} ……. (2.4)

The step response equals the running sum of h[n].Hence its first few value are [using
the above results]

𝑠[0] = ℎ[0] = 1 , 𝑠[1] = ℎ[0] + ℎ[1] = 1 + 0.8 = 1.8

𝑠[2] = ℎ[0] + ℎ[1] + ℎ[2] = 𝑠[1] + ℎ[2] = 1 + 0.8 + 0.8 × 0.8


= 2.44

𝑠[3] = 𝑠[2] + ℎ[3] = 1 + 0.8 × 0.8 × (0.8)3 = 2.952

𝑠[4] = 𝑠[3] + ℎ[4] = 3.3.616 and so on. The final value of s[n] forn
1
∞ is given by𝑢𝑠𝑖𝑛𝑔 𝑦 = 1 + 𝑥 + 𝑥2 = 𝑓𝑜𝑟 𝑥 < 1
1−𝑥

1
𝑠[∞] = 1 + 0.8 + (0.8)2 + (0.8)3 + ⋯ = =5
1−0.8
s[n] s[n]
1 0.8 0.82 5
2.44
1.8

1
n 8 n
Lect. 2, Asst. Prof. Dr. Hadi T. Ziboon, Department of Electrical Eng. U.O.T

EX 2.6 Repeat Ex2.5 find the response to rectangular pulse input


with pulse duration n=4
Solution:-
We may find the response to the rectangular pulse by consider
x[n] as summation of a unit step starting at n=0 and an equal but
opposite step starting at n=4.
The output is found by superposition two step responses
∴ 𝑦 [ 𝑛 ] = 𝑠 [ 𝑛 ] − 𝑠 [ 𝑛 − 4]
n 0 1 2 3 4 5 6
s[n] 1 1.8 2.44 2.952 3.362 3.689 3.951
-s[n-4] -1 -1.8 -2.4
y[n] 1 1.8 2.44 2.952 2.362 1.889 1.511
u[n]
y[n]

2.952
n
2.44 0

2.362 -u[n-4]

1.889

1.80 4 n
0
1.5

1 x[n]
n

n
0 4

9
Lect. 2, Asst. Prof. Dr. Hadi T. Ziboon, Department of Electrical Eng. U.O.T

2.4. correlation and convolution


Cross-Correlation function is a measure of similarities between
two signals.

Auto- Correlation is a special case from the cross correlation.


Auto correlation represents the cross correlation of the function
with itself.

Convolution represents the relation between the input and the


output of linear system or convolution represents how the input
to a system interacts with the system to produce the output.
However we clearly need a general computer based a method
for doing this a method which will work for any LTI system and
any form of input signal. It is known as digital convolution.

2.4. 1 convolution Description

The relationship between the input to a linear shift invariant


system, x[n] and the output y[n] is given by the convolution sum
according the following equation.

𝑦[𝑛] = 𝑥[𝑛] ∗ ℎ[𝑛] = ∑∞


𝑘=−∞ 𝑥 [𝑘 ]ℎ[𝑛 − 𝑘 ] ….. (2.6)

 Convolution may classify according the sequence:-


1) Circular convolution is used for periodic sequence and is
given by
𝑁−1

𝑦[𝑛] = � 𝑥[𝑘] ℎ[𝑛 − 𝑘] … . (2.6𝑎)


𝑘=0

10
Lect. 2, Asst. Prof. Dr. Hadi T. Ziboon, Department of Electrical Eng. U.O.T

2) Linear convolution is used for aperiodic sequence and is given by


𝑦(𝑛) = ∑2𝑁−1
𝑘=0 𝑥(𝑘)ℎ(𝑛 − 𝑘) …. (2.6 b)

Where N= sequence length and 𝑁 = 𝑁1 + 𝑁2 − 1

where𝑁1 =length of x[n]


and 𝑁2 =length of h[n]
• Thus N is the upper limit of the convolution sum.
Convolution properties:-
a) Commutative:- the commutative property states that the order
in which two sequence are convolved is not important.
𝑖. 𝑒 𝑥 [𝑛] ∗ ℎ[𝑛] = ℎ[𝑛] ∗ 𝑥[𝑛] …. (2.7)
From a system point view, this property states that a system
with unite impulse response h[n] and input x[n] is the same
way as a system with unit sample response x[n] and an input
h[n].
b) Associative:- the convolution operator satisfies the
associative property
{𝑥 [𝑛] ∗ ℎ1 [𝑛]} ∗ ℎ2 [𝑛] = 𝑥 [𝑛] ∗ {ℎ1 [𝑛] ∗ ℎ2 [𝑛]} ….. (2.8)
Eq(2.8) state that if two systems with impulse response ℎ1 [𝑛],ℎ2 [𝑛] are
connected in cascade an equivalent system is one that has a unit sample
response equal to the convolution of ℎ1 [𝑛] and ℎ2 [𝑛]:

ℎ𝑒𝑞 [𝑛] = ℎ1 [𝑛] ∗ ℎ2 [𝑛] …. (2.9)


c) Distributive Property:- the distributive property of the convolution
operator state that
𝑥 [𝑛] ∗ {ℎ1 [𝑛] + ℎ2 [𝑛]} = 𝑥 [𝑛] ∗ ℎ1 [𝑛] + 𝑥 [𝑛] ∗ ℎ2 [𝑛] .... (2.10)
Eq.(2.8) states that if two with impulse response ℎ1 [𝑛],ℎ2 [𝑛] are
connected in parallel an equivalent system is one that has a unit sample
response equal to the sum ℎ1 [𝑛] and ℎ2 [𝑛]

ℎ𝑒𝑞 [𝑛] = ℎ1 [𝑛] + ℎ2 [𝑛] …. (2.11)

Fig (2.5)shows the interpretation of these properties.


11
Lect. 2, Asst. Prof. Dr. Hadi T. Ziboon, Department of Electrical Eng. U.O.T

Commutation property
x[n] y[n] h[n] y[n]
h[n] x[n]
Associative property
x[n] y[n] x[n] y[n]
h1[n] h2[n] h1(n) *h2(n)

Distributive property

x[n] h1[n] y[n] x[n] y[n]


+ h1(n) +h2(n)

h2[n]
fig (2.5) the interpretation of convolution properties from a system point view.
2.4.2 Performing Convolution
a) Direct Evaluation: when the sequences that are being convolved may
be described by simple closed form mathematical expression, the
convolution can be found by direct sum given in eq (2.1).
Ex 2.7 Let us perform the convolution of two signals
𝑛
𝑛 𝑎 𝑛≥0
𝑥 [𝑛 ] = 𝑎 𝑢 [𝑛 ] = �
0 𝑛<0
And h[n]=u[n]
Solution: u(k)

k
u[k-n]

n k
u[n-k]

n k
u[k]u[n-k]

n k

12
Lect. 2, Asst. Prof. Dr. Hadi T. Ziboon, Department of Electrical Eng. U.O.T

𝑦 [𝑛 ] = 𝑥 [𝑛 ] ∗ ℎ [𝑛 ] = � 𝑥 [𝑘 ]ℎ [𝑛 − 𝑘 ]
𝑘=−∞

= � 𝑎 𝑘 𝑢 [𝑘 ]𝑢 [𝑛 − 𝑘 ]
𝑘=−∞
Because u[k]=0 for k<0 and u[n-k] is equal to zero for k>n.
when n<0, there are no nonzero terms in the sum and y[n]=0.
On the other hand if 𝑛 ≥ 0
𝑛

𝑦 [𝑛 ] = � 𝑎 𝑘 = 1 + 𝑎 + 𝑎 2 + 𝑎 3 + … + 𝑎 𝑛
𝑘=0

1 − 𝑎𝑛+1
𝑦 [𝑛 ] =
1−𝑎
1−𝑎𝑛+1
Therefore𝑦[𝑛] = 𝑢[𝑛]
1−𝑎

b) Decomposition of x[n] into a set of weighted shifted impulse


method:
1. Plot both x[n] and h[n] as function of n.
2. x[n] is decomposed into a set of weighted, shifted impulses.
3. Generate for each weighted shifted impulses (mentioned in
step 2) its own version of the system's impulse response. Each
version is weighted by the value of x[n] which cause it, and to
begin at the correct instant [this means shift h[n] by the time
corresponding each value impulse of x[n]].
4. The output y[n] is found by superposition of all these
individual response.

13
Lect. 2, Asst. Prof. Dr. Hadi T. Ziboon, Department of Electrical Eng. U.O.T

c) Slide Rule Method


Slide rule method is convenient when both x[n] and h[n] are
finite in length and short in duration.
The steps involved in the slide rule method are as follows:-
1) Write the value of x[k] a long the top of a piece of paper
and the value of h[-k] a long the top of another piece of
paper as shown in fig (2.5a).
2) Line up the two sequence value x[0] and h[0], multiply
each pair of numbers and add the produce to find the value
of y[0].
3) Slide the paper with time reversed sequence h[k] to the
right by one, multiply each pair of numbers sum the
products to find the value of y[1], and repeat for all shift to
the right by n >0 . Do the same, shifting the time reversed
sequence to the left to find the value of y[n] for n<0.
… x[-2] x[-1] x[0] x[1] x[2] …

h[2] h[1] h[0] h[-1] h[-2]


Fig (2.5a) the slide rule approaches to convolution.

14
Lect. 2, Asst. Prof. Dr. Hadi T. Ziboon, Department of Electrical Eng. U.O.T

Ex 2.7Using the decomposition of x[n] into a set of weighted, shifted impulses, to


find the output of a digital processor with impulse response h[n] is given by
h[n]=0 for n<0 and n>2 , h[0]=1 , h[1]= -1, h[2]= 2
if the input signal is given by

x[n]=0 for n<-1 and n>2 , x[0]=2 , x[1]=3, x[2]= -1 and x[-1]=1
Solution:- 𝑦[𝑛] = ∑∞
𝑘=−∞ 𝑥[𝑘] ℎ[𝑛 − 𝑘]
x[n] 3 h[n] 2
2 1
1 n
n
n
-2 -1 0 1 2 -2 -1 0 1 2 3 4
x[-1]δ(n+1) x[-1]h(n+1)

1 1 2
n n

-2 -1 0 1 2 -2 -1 1 2 3 4
1
x[0]δ(n) 2 x[0]h(n) 2

n
-2 -1 1 2 3 4 -2 -1 1 2 3 4

x[1]δ(n-1) x[1]h(n-1) 6

3 3 n n

x[2]δ(n-2) x[2]δ(n-2) -3
1

n n
y[n] -1 7 -2
-1 1 3

15
n
Lect. 2, Asst. Prof. Dr. Hadi T. Ziboon, Department of Electrical Eng. U.O.T

Ex 2.8 Find the circular convolution between


𝑥[𝑛] = 1, 2, 3,4 𝑛≥0
ℎ[𝑛] = 4 ,3 ,2 ,1 𝑛 ≥ 0
Solution:- the type of the convolution which is used the circular since the
number of n is limited [for four value] and this means periodic
h[n] 4 3
𝑦[𝑛] = ∑𝑁−1
𝑘=0 𝑥[𝑘]ℎ[𝑛 − 𝑘] k=0 2
1

𝑦[𝑛] = ∑3𝑘=0 𝑥[𝑘]ℎ[𝑛 − 𝑘] n


4 2 k=-1 [lag]
h[n-k] 1 3

𝑦[0] = ∑3𝑘=0 𝑥[𝑘]ℎ[−𝑘]n n


𝑦[0] = 𝑥[0]ℎ[0] + 𝑥[1]ℎ[−1] + 𝑥[2]ℎ[−2] + 𝑥[3]ℎ[−3]
𝑦[0] = 1 × 4 + 2 × 1 + 3 × 2 + 4 × 3 = 4 + 2 + 6 + 12 = 24
3

𝑦[1] = � 𝑥[𝑘]ℎ[1 − 𝑘]
𝑘=0

𝑦[1] = 𝑥[0]ℎ[1] + 𝑥[1]ℎ[0] + 𝑥[2]ℎ[−1] + 𝑥[3]ℎ[−2]


𝑦[1] = 1 × 3 + 2 × 4 + 3 × 1 + 4 × 2 = 3 + 8 + 3 + 8 = 22
3

𝑦[2] = � 𝑥[𝑘]ℎ[2 − 𝑘]
𝑘=0

𝑦[2] = 𝑥[0]ℎ[2] + 𝑥[1]ℎ[1] + 𝑥[2]ℎ[0] + 𝑥[3]ℎ[−1]


𝑦[2] = 1 × 2 + 2 × 3 + 3 × 4 + 4 × 1 = 2 + 6 + 12 + 4 = 24
3

𝑦[3] = � 𝑥[𝑘]ℎ[3 − 𝑘]
𝑘=0

𝑦[3] = 𝑥[0]ℎ[3] + 𝑥[1]ℎ[2] + 𝑥[2]ℎ[1] + 𝑥[3]ℎ[0]


𝑦[3] = 1 × 1 + 2 × 2 + 3 × 3 + 4 × 4 = 30
h[n-k] 4 y[n] 30
k=1 [lead]
3
2
1 1) Always select 24 24
The sample of h[n] at n=0 22
0 n=0
n
2) h[n-k]=h[-(k-n)] . This is the revere 0 1 2 3

16
Lect. 2, Asst. Prof. Dr. Hadi T. Ziboon, Department of Electrical Eng. U.O.T

Ex2.9 Find the linear convolution between


𝑥[𝑛] = 1,2,3,4 𝑛≥0
ℎ[𝑛] = 4,3,2,1 𝑛≥0
Solution:- 𝑦[𝑛] = ∑2𝑁−1
𝑘=0 𝑥[𝑘]ℎ[𝑛 − 𝑘]
𝑁1 + 𝑁2 − 1 = 2𝑁 − 1 = 2 × 4 − 1 = 7 𝑠𝑖𝑛𝑐𝑒 𝑁1 = 𝑁2 = 4
7

∴ 𝑦[𝑛] = � 𝑥[𝑘]ℎ[𝑛 − 𝑘]
𝑘=0
7

𝑦[0] = � 𝑥[𝑘]ℎ[−𝑘]
𝑘=0

y[0]= 𝑥[0]ℎ[0] + 𝑥[1]ℎ[−1] + 𝑥[2]ℎ[−2] + 𝑥[3]ℎ[−3] + 𝑥[4]ℎ[−4] +


𝑥[5]ℎ[−5] + 𝑥[6]ℎ[−6] + 𝑥[7]ℎ[−7]
𝑦[0] = 1 × 4 + 0 + 0 + 0 + 0 + 0 + 0 + 0 = 4
Since linear convolution is used for aperiodic sequence and h[n] is only
for 𝑛 ≥ 0
ℎ[−1] = ℎ[−2] = ℎ[−3] = ℎ[−4] = ℎ[−5] = ℎ[−6] = ℎ[−7] = 0
7

𝑦[1] = � 𝑥[𝑘]ℎ[1 − 𝑘]
𝑘=0

y[1]= 𝑥[0]ℎ[1] + 𝑥[1]ℎ[0] + 𝑥[2]ℎ[−1] + 𝑥[3]ℎ[−2] + 𝑥[4]ℎ[−3] +


𝑥[5]ℎ[−4] + 𝑥[6]ℎ[−5] + 𝑥[7]ℎ[−6]
𝑦[1] = 1 × 3 + 2 × 4 + 0 + 0 + 0 + 0 + 0 + 0 = 11
For the same reason using the same procedure to find y[2]=20, y[3]=30,
y[5]=11, y[6]=4, y[7]=0.
7

𝑦[4] = � 𝑥[𝑘]ℎ[4 − 𝑘]
𝑘=0

y[4]= 𝑥[0]ℎ[4] + 𝑥[1]ℎ[3] + 𝑥[2]ℎ[2] + 𝑥[3]ℎ[1] + 𝑥[4]ℎ[0] +


𝑥[5]ℎ[−1] + 𝑥[6]ℎ[−2] + 𝑥[7]ℎ[−3]
𝑦[4] = 1 × 0 + 2 × 1 + 3 × 2 + 4 × 3 + 0 = 20 .sinceh[n] is exist only
for n=0,1,2,3. In this case h[4]=h[5]=h[6]=h[7]=0

17
Lect. 2, Asst. Prof. Dr. Hadi T. Ziboon, Department of Electrical Eng. U.O.T

The Convolution Integral


If the input consists of a continuous of impulses the convolution
sum may be replaced by integral and become
∞ 𝑁

𝑦(𝑡) = � 𝑥 (𝜏)ℎ(𝑡 − 𝜏)𝑑𝜏 𝑦[𝑛] = � 𝑥 [𝑘]ℎ[𝑛 − 𝑘]


−∞ 𝑛=0

Which is known as the convolution Integral.


EX.2.11 Convolve the waveform x(t) and h(t) ((using the
convolution integral)) which are defined as follows
𝑥 (𝑡) = 3 𝑓𝑜𝑟 0 ≤ 𝑡 ≤ 3
ℎ(𝑡) = 2 𝑓𝑜𝑟 0 ≤ 𝑡 ≤ 2
Solution:-
1) Draw x(t) and h(t) as shown in fig (a)
2) The convolution integral depends on the variable τ and so
fig (a) has to be replaced by fig(b)
3) Draw the time reverse h(τ) as shown in fig(c) to form h(-
τ).
4) h(-τ) is next shift with respect to x(τ) in the direction of
positive τ. The resulting waveform h(t-τ) then over laps
x(τ) in five geometrical stage .For each of these stages
there is corresponding convolution integral.

18
Lect. 2, Asst. Prof. Dr. Hadi T. Ziboon, Department of Electrical Eng. U.O.T

+∞
Thus 𝑦(𝑡) = 𝑥(𝑡) ∗ ℎ(𝑡) = ∫−∞ 𝑥(𝜏)𝑦(𝑡 − 𝜏)𝑑𝜏 𝑥[𝑡] 𝑓𝑜𝑟 0 ≤ 𝑡 ≤ 3
Thus 𝑥(𝑡) ∗ ℎ(𝑡) exists in five stages:- ℎ[𝑡] 𝑓𝑜𝑟 0 ≤ 𝑡 ≤ 2
x(t) (a) h(t) x(τ) (b) h(τ)
3 3
2 2

ttττ
3 2 3 2
h(t-τ) 3 x(τ) h(t-τ) 3 x(τ)
h(-τ) 2 2 2

τττ
-2 -2 0 3 0 τ =t 3
(c) (d) stage(1) overlap (e) stage(2a) x(τ)
x(τ)
3 3 3 x(τ)
h(t-τ) overlap h(t-τ) overlap overlap
2 2 2 h(t-τ)

0 τ=2 3 0 τ=t-2 τ=t 3 τ=t-2 τ=t τ


(f) stage(2b) (g) stage(3) (h) stage(4)

3 x(t)
2 h(t-τ)

(i) stage(5) 5 τ
(a) Stage 1: t<0 and h(t-τ) does not overlap with x(τ) as shown in fig(d)
∴ 𝑥(𝜏) ∗ ℎ(𝑡 − 𝜏) = 0 for all t
(b) Stage 2: 0 < 𝑡 ≤ 2 and partial overlap occure between x(τ) and h(t-τ) as shown in
fig(e) and (f) y(t)
𝜏=𝑡
∴ 𝑦(𝑡) = ∫0 𝑥(𝜏)ℎ(𝑡 − 𝜏) 𝑑𝜏12
𝑡
= � 3 × 2 𝑑𝜏 = 6[𝜏]𝑡0 = 6𝑡 0<𝑡≤2
0

The geometrical stage terminates when t=2 as shown in (f) 2 t

19
Lect. 2, Asst. Prof. Dr. Hadi T. Ziboon, Department of Electrical Eng. U.O.T

(c) Stage 3: 2 ≤ 𝑡 ≤ 3 and there is complete overlap because x(t) and h(t-τ) as shown
in fig(g).
𝑡 𝑡
∴ 𝑦(𝑡) = ∫𝜏=𝑡−2 3 × 2 𝑑𝜏 = [6𝜏] 𝑡−2 y(t)
= 12 2≤𝑡≤3

2 3 t
(d) Stage 4: 3 ≤ 𝑡 ≤ 5 this is another overlap as shown in fig(h) y(t)
𝜏=3 3
∴ 𝑦(𝑡) = ∫𝜏=𝑡−2 3 × 2 𝑑𝜏 = [6𝜏] 𝑡−2 12
= 6(5 − 𝑡) = 30 − 6𝑡

3 5 t
(e) Stage 5: t>5 as shown in fig(i) there is no overlap ∴ 𝑦(𝑡) = 0
The convolution integral having a different expression for each of thethreeregion
corresponding to three stages as summarized below

0≤𝑡≤2 y(t)=6t
2≤𝑡≤3 y(t)=12
3≤𝑡≤5 y(t)=30-6t
y(t)
12
10
8
6
4
2

0 1 2 3 5 t

20
Lect. 2, Asst. Prof. Dr. Hadi T. Ziboon, Department of Electrical Eng. U.O.T

2.6 Difference equation


There are many recursive and nonrecursive recurrence formulas to
describe the operation of digital processors in the time domain, and are
also referred to a difference equations. The general form of a difference
equation with three recursive and three nonrecursiveterms is given by

𝑦[𝑛] = 𝑎1 𝑦[𝑛 − 1] + 𝑎2 𝑦[𝑛 − 2] + 𝑎3 𝑦[𝑛 − 3] +


𝑏0 𝑥 [𝑛 − 1] + 𝑏1 𝑥[𝑛 − 1] + 𝑏2 𝑥[𝑛 − 2]… (2.11)
To make the equation even more general we allow an arbitrary number of
terms and rewrite eq (2.11) as follows

𝑎0 𝑦[𝑛] + 𝑎1 𝑦[𝑛 − 1] + 𝑎2 𝑦[𝑛 − 2] + ⋯


= 𝑏0 𝑥 [𝑛] + 𝑏1 𝑥 [𝑛 − 1] + 𝑏2 𝑥 [𝑛 − 2] + ⋯ ….(2.11b)

Or

∑𝑁 𝑀
𝑘=0 𝑎𝑘 𝑦[𝑛 − 𝑘] = ∑𝑘=0 𝑏𝑘 𝑥[𝑛 − 𝑘] … (2.12)

The complexity of an LTI processor depends on


the number of terms on each side of equation.
The value of N which indicates the highest
order difference of the output signal is
generally referred to as the order of the system.

21
University of Technology
Department of Electrical Engineering

Lect3

Frequency Domain Analysis


(Discrete Fourier Series and the Fourier Transform)

Asst. Prof. Dr. Hadi T. Ziboon


Lect. 3, Asst. Prof. Dr. Hadi T. Ziboon, Department of Electrical Eng. U.O.T

3. Frequency Domain Analysis


The Discrete Fourier Series and the Fourier Transform
3.1 Introduction

 Fourier showed that periodic signals can be represented as


weight sums of harmonically related sinusoids.
Fourier also, showed that nonrepetitive or aperiodic signal can
be considered as the integral of sinusoids which are not
harmonically related. These two key ideas form the basis of the
famous, Fourier Series and Fourier Transform respectively.
Digital computers and special purpose hardware are now used
for analyzing the frequency components and the frequency
domain performance of systems by using discrete time (digital)
techniques.
 Why do we need also a frequency domain analysis (also
we need time domain convolution):-
1) Sinusoidal and exponential signals occur in the natural
word, and in the world technology. Even when a signal is
not of this type, it can be analyzed into component
frequency.
2) If an input signal is described by its frequency spectrum
and an LTI system by its frequency response, then the
output signal spectrum is found by multiplication both.
3) The design of DSP algorithms and systems often starts
with a frequency domain specification.
3.2 Discrete Fourier Series
 A periodic digital signal can be represented by a Fourier
Series and it has a line spectrum similar to analog signal.

1
Lect. 3, Asst. Prof. Dr. Hadi T. Ziboon, Department of Electrical Eng. U.O.T

 Let us consider a periodic digital signal x[n] as shown in


fig(3.1), such as
𝑥 [𝑛] = 𝑥[𝑛 + 𝑁]for all n
where N is the period of the sequence x[n].
The coefficients of its line spectrum indicate the amount of
various frequencies contained in the signal. They may fined by
the following equation
1
𝐶𝑘 = ∑𝑁−1
𝑛=0 𝑥[𝑛] 𝑒
−𝑗2𝜋𝑘𝑛/𝑁
…. (3.1)
𝑁
Where 𝐶𝑘 represents the Kth spectral components or harmonic
N is the number of number of sample values in each
period of the signal
 Eq(3.1) is known as the analysis equation of the discrete
time Fourier series (DTFS).
 If we know the coefficient 𝐶𝑘 , we may represent x[n]
using the synthesis equation:
𝑥[𝑛] = ∑𝑁−1
𝑛=0 𝐶𝑘 𝑒
𝑗2𝜋𝑘𝑛/𝑁
…. (3.2)
Note: In some texts the1/N multiplier appears in the synthesis
equation rather than in the analysis equation and this is not an
important difference since it is a scaling factor.
one period Re (𝐶𝑘 ) Im (𝐶𝑘 )
3
2 2 2 2 2

1
n k k
-0.5

-1 -1

-2 -2

Fig(3.1)
(a) Periodic digital signal (b) Real parts of 𝐶𝑘 (c) Imaginary parts of 𝐶𝑘

2
Lect. 3, Asst. Prof. Dr. Hadi T. Ziboon, Department of Electrical Eng. U.O.T

Ex(3.1)Determine the spectrum of the signals by using Fourier Series


a) 𝑥[𝑛] = cos√2𝜋𝑛
b) 𝑥[𝑛] = 1, 1, 0, 0 n>0
Solution
1
(a) 2𝜋𝑓0 = √2𝜋 ∴ 𝑓0 =
√2
Since 𝑓0 is not a rational number, the signal is not a rational
number, the signal is not periodic then the signal cannot expanded
in Fourier Series.
2𝜋𝑗𝑘𝑛
1 −
(b) 𝐶𝑘 = ∑𝑁−1
𝑛=0 𝑥[𝑛] 𝑒 𝑁 k=0, 1, 2, 3
𝑁
2𝜋𝑗𝑘𝑛
1
= ∑3𝑛=0 𝑥[𝑛] 𝑒 − 4
4
3
1
𝐶𝑘 = � 𝑥[𝑛] 𝑒 −𝑗𝜋𝑘𝑛/2
4
𝑛=0
3
1 1 1
𝐶0 = � 𝑥[𝑛] 𝑒 0 = [1 + 1 + 0 + 0] = < 0
4 4 2
𝑛=0
3 3
1 𝑗𝜋(1)𝑛 1 𝑗𝜋𝑛
𝐶1 = � 𝑥[𝑛] 𝑒 − 2 = � 𝑥[𝑛] 𝑒 − 2
4 4
𝑛=0 𝑛=0
1 𝜋 3𝜋
𝐶1 = �𝑥[0]𝑒 0 + 𝑥[1]𝑒 −𝑗 2 + 𝑥[2]𝑒 −𝑗𝜋 + 𝑥[3]𝑒 −𝑗 2 �
4
1 𝜋 1 𝜋 𝜋
𝐶1 = �1 + 1𝑒 −𝑗 2 + 0 + 0� = [1 + 𝑐𝑜𝑠 − 𝑗𝑠𝑖𝑛 ]
4 4 2 2
1 √2 𝜋
𝐶1 = [1 − 𝑗] = <−
4 4 4
√2 𝜋
In the same way fined 𝐶2 = 0 < 0 , 𝐶3 = <
4 4
|𝐶𝑘 | < 𝐶𝑘

1/2

√2/4√2/4𝜋/4

0 1 2 3 k k

−𝜋/4

3
Lect. 3, Asst. Prof. Dr. Hadi T. Ziboon, Department of Electrical Eng. U.O.T

Ex(3.2)Sketch the periodic digital signal and find its Fourier


Coefficients𝐶𝑘 and sketch their real and imaginary parts
𝜋𝑛 𝜋𝑛
𝑥[𝑛] = 1 + sin � � + 2 cos � �
4 4
Solution The values of x[n] are given in the table over one complete
period (n=0 to 7) as follows
𝜋𝑛 𝜋𝑛
n sin � � 2 cos � � x[n]
4 4
--------- ------------ ---------------- --------
0 0 2 3
1 0.707 0 1.707
2 1 -2 0
3 0.707 0 1.707
4 0 2 3
5 -0.707 0 0.293
6 -1 -2 -2
7 -0.707 0 0.293
The signal is drawn in fig (a)
x[n] can be expressed as a sum of impulses
𝑥[𝑛] = 3 + 1.707𝛿(𝑛 − 1) + 0𝛿(𝑛 − 2) + 1.707𝛿(𝑛 − 3) + 3𝛿(𝑛 − 4)
+ 0.293𝛿(𝑛 − 5) − 2𝛿(𝑛 − 6) + 0.293𝛿(𝑛 − 7)
The Fourier coefficients are
𝑗
𝐶−3 = 0, 𝐶−2 = 1, 𝐶−1 = , 𝐶0 = 1, 𝐶1 = −𝑗/2, 𝐶2 = 1, 𝐶3 = 0
2
x[n]
3 3
1.707 1.707
0.293 0.293

0 1 2 3 4 5 6 7 n
-2
R (𝐶𝑘 ) I [𝐶𝑘 ]

1 0.5
k12 k
-2 -1 1 2 -2 -0.5

4
Lect. 3, Asst. Prof. Dr. Hadi T. Ziboon, Department of Electrical Eng. U.O.T

3.3 Power and Energy of periodic signal


Parceval's theorem can be used to calculate the total power or
energy of a signal in the time and frequency domains. In the
case of a real, periodic digital signal, the theorem takes the form
1 𝑁−1 2 𝑁−1 2
∑𝑛=0 |𝑥[𝑛]| = ∑𝑛=0 |𝐶𝑘 | … (3.3)
𝑁
The average power of discrete- time periodic signal with period
N is defined as:
1 1
𝑃𝑥 = ∑𝑁−1 2
𝑛=0 |𝑥[𝑛]| = ∑𝑁−1 ∗
𝑛=0 𝑥 [𝑛]𝑥 [𝑛]… (3.4)
𝑁 𝑁
1 ∗ −𝑗2𝜋𝑘𝑛/𝑁
= ∑𝑁−1
𝑛=0 𝑥 [𝑛]𝐶𝑘 𝑒 since𝑥[𝑛] = ∑𝑁−1
𝑛=0 𝐶𝑘 𝑒
𝑗2𝜋𝑘𝑛/𝑁
𝑁
𝑁−1
1 ∗
𝑗2𝜋𝑘𝑛
− 𝑁
= � 𝐶𝑘 [ ]
(𝑥 𝑛 𝑒 )
𝑁
𝑛=0
𝑁−1 𝑁−1

= � 𝐶𝑘 ∗ 𝐶𝑘 = � |𝐶𝑘 |2
𝑛=0 𝑛=0

Theenergy of the sequence x[n] over a signal period, then

𝐸𝑁 = ∑𝑁−1 2 𝑁−1 2
𝑛=0 |𝑥[𝑛]| = 𝑁 ∑𝑛=0 |𝐶𝑘 | … (3.5)

5
Lect. 3, Asst. Prof. Dr. Hadi T. Ziboon, Department of Electrical Eng. U.O.T

3.4 Properties of the Fourier Series


 In the following discussion we use a double headed arrow to denote the
relationship between a signal and its spectrum. Thus x[n] 𝐶𝑘

indicates that the periodic digital signal x[n] has spectral coefficients 𝐶𝑘 .

 x[n] is said to transform into 𝐶𝑘 .


 𝐶𝑘 inverse transform into x[n].
 The main properties of the series:-
1) Linearity
If 𝑥1 𝑎𝑘 and 𝑥2 𝑏𝑘
Then
𝐴𝑥1 [𝑛] + 𝐵𝑥2 [𝑛] 𝐴𝑎𝑘 + 𝐵𝑏𝑘 … (3.6)
2) The time – shift
If x[n] 𝐶𝑘
Then 𝑥[𝑛 − 𝑛0 ] 𝐶𝑘 𝑒 −𝑗2𝜋𝑘𝑛0 /𝑁 ….. (3.7)
3) The differentiation
If x[n] 𝐶𝑘
𝑗2𝜋𝑘

Then x[n]-x[n-1] 𝐶𝑘 [1 − 𝑒 𝑁 ] ….. (3.8)
4) The integration
If x[n] 𝐶𝑘 and 𝐶0 = 0
𝑛
then∑𝑘=−∞ 𝑥[𝑘] 𝐶𝑘 [1 − 𝑒−𝑗2𝜋𝑘/𝑁 ]−1 … (3.9)
5) Convolution
if the digital signals 𝑥1 [𝑛] and 𝑥2 [𝑛] have the same period.
𝑥1 [𝑛] 𝑎𝑘 and 𝑥2 [𝑛] 𝑏𝑘
𝑁−1
Then ∑𝑚=0 𝑥1 [𝑚]𝑥2 [𝑛 − 𝑚] N𝑎𝑘 𝑏𝑘 … (3.10)
 The left side of the eq(3.9) expressed a convolution over one
period.
 Eq(3.10) shows that such time domain convolution is equivalent to
frequency domain multiplication.

6
Lect. 3, Asst. Prof. Dr. Hadi T. Ziboon, Department of Electrical Eng. U.O.T

6) Modulation property of the discrete Fourier Series:


𝑥1 [𝑛] 𝑎𝑘 and 𝑥2 [𝑛] 𝑏𝑘
then
𝑥1 [𝑛]𝑥2 [2] ∑𝑁−1
𝑚=0 𝑎𝑚 𝑏𝑘−𝑚 …. (3.11)

3.5 The Fourier Transform of Aperiodic Digital Sequences


 Most practical digital signals are aperiodic (e.x digital signals in
communication, heartbeat, variation of temperature, …)
 A common approach to develop the Fourier transform for a digital
sequence via the continuous time Fourier Transform. However,
since our course is DSP, we prefer a digital approach, which is
based on the discrete Fourier Series equation and modify then
The analysis equation of the discrete Fourier Series, defined by
1
𝐶𝑘 = ∑𝑁−1 𝑚=0 𝑥[𝑛] 𝑒 −𝑗2𝜋𝑘𝑛/𝑁 ….. (3.12)
𝑁
Eq(3.12) is used for periodic sequences with period between n=0 to N-1.

Now suppose that we stretch adjacent repetitions of the signal by filling


the gaps between then with zeros, as shown in fig (3.2).

7
Lect. 3, Asst. Prof. Dr. Hadi T. Ziboon, Department of Electrical Eng. U.O.T

 What happens to the spectral coefficients 𝐶𝑘 if we stretch the signal in


this way:-
(a) Coefficient of 𝐶𝑘 become smaller because of the 1/N multiplier in
equation (3.12).
(b) Coefficient of 𝐶𝑘 becomes closer in frequency because N also appears
in the denominator of the exponential.
 Thus when N ∞, the various harmonics therefore bunch together
and have vanishingly small amplitudes, the product 𝐶𝑘 remained finite.
one periodic
x[n] 5 sample x[n] one periodic 12 samples

n n

Fig (3.2) Stretchers signal


 Let us write it as X=𝑁𝐶𝑘 . We will also write (2πk/N) as Ω,
then eq.(3.12) of the discrete Fourier series as
1 𝑁−1
𝐶𝑘 = ∫ 𝑥[𝑛] 𝑒 −𝑗Ω𝑛 ………………………(3.12)
𝑁 𝑛=0
𝑋(𝛺) = 𝑁𝐶𝑘 = ∑𝑁−1
𝑛=0 𝑥[𝑛] 𝑒
−𝑗𝛺𝑛
…. (3.13)

Thus X(Ω) is a function of the frequency.


 Using similar produce, we can derive the inverse transform
of X(Ω) is given by
1 ∞
𝑥[𝑛] = ∫ 𝑋(𝛺) 𝑒 𝑗𝛺𝑛 𝑑𝛺
2𝜋 −∞
…. (3.14)
 Eq. (3.13) is an analysis equation (Fourier Transform of
aperiodic digital sequence).
 Eq. (3.14) show how x[n] can be synthesized (i.e. inverse
of Fourier transform of aperiodic digital sequence).

8
Lect. 3, Asst. Prof. Dr. Hadi T. Ziboon, Department of Electrical Eng. U.O.T

Ex(3.3)Fined the Fourier transforms of aperiodic digital signal shown in


fig below. Sketch their magnitude over the range -2π < Ω < 2π and
discuss the result.

Solutionx(n)

• 𝑋[𝛺] = ∑∞
𝑛=−∞ 𝑥[𝑛] 𝑒
−𝑗𝛺𝑛
x[n]
2𝜋𝑘
where Ω =
𝑁

0.2 n

x(Ω)
1

-2π -π 0 π 2π Ω
𝑋(𝛺) = 0.2{𝛿[𝑛 − 2] + 𝛿[𝑛 − 1] + 𝛿[𝑛] + 𝛿[𝑛 + 1] + 𝛿[𝑛 + 2]}𝑒 −𝑗𝛺𝑛
Using the shifting property of the unit impulse
∴ 𝑋(𝛺) = 0.2{𝑒 −𝑗2𝛺 + 𝑒 −𝑗𝛺 + 1 + 𝑒 𝑗𝛺 + 𝑒 𝑗2𝛺 }
= 0.2(1 + 2𝑐𝑜𝑠𝛺 + 2𝑐𝑜𝑠2𝛺)
o The spectrum is real since x[n] is an even function. It is sketched in
the lower part of fig.
o The spectrum is periodic in Ω, repeating every 2π.

Ex(3.4) Repeat Ex (3.3) for the signals shown in fig below

Solution x[n]

𝑋(𝛺) = ∑∞
𝑛=−∞ 𝑥 [𝑛] 𝑒
−𝑗𝛺𝑛
0.5

0.25

0.125 n

-2 -1 0 1 2 3 4

= 0.5 + 0.25 𝑒 −𝑗𝛺 + 0.125 𝑒 −𝑗2𝛺 + ⋯

= 0.5(1 + 0.5 𝑒 −𝑗𝛺 + 0.25 𝑒 −𝑗2𝛺 + ⋯ ]

9
Lect. 3, Asst. Prof. Dr. Hadi T. Ziboon, Department of Electrical Eng. U.O.T

1 1
𝑋(𝛺) = 0.5 1−0.5𝑒 −𝑗𝛺 ∑∞ 𝑛
𝑛=0 𝑎 = 1−𝑎if a <1
1
= ∴ X[Ω] = 0.5[1+a+a2 +….]
1−0.5𝑒−𝑗𝛺
if a=e-jΩ

0.5
|𝑥(𝛺)| =
[(1 − 0.5𝑐𝑜𝑠𝛺)2 + (0.5𝑠𝑖𝑛𝛺)2 ]1/2
0.5
=
[1 − 𝑐𝑜𝑠𝛺 + 0.25𝑐𝑜𝑠 2 𝛺 + 0.25𝑠𝑖𝑛2 𝛺]1/2

x[Ω]
1

1/3
Ω
0 π 2π
Note that:-
1- If Ω = 0, |𝑋(Ω)| = 1 and is max.
1
2- If Ω = π, |𝑋(Ω)| = and is min.
3

3- X(𝛺) is richest in low frequencies close to Ω=0.


3.6 Properties of Fourier Transfers of the aperiodic digital
1) Linearity: If 𝑥1 [𝑛] → 𝑋1 (𝛺) and 𝑥2 [𝑛] → 𝑋2 (𝛺)
Then𝐴𝑥1 [𝑛] + 𝐵𝑥2 [𝑛] 𝐴𝑋1 [𝛺] + 𝐵𝑋2 [𝛺]
2) Time shifting : x[n] X(𝛺)

Then𝑥 [𝑛 − 𝑛0 ] 𝑋(𝛺)𝑒 −𝑗𝛺𝑛0


3) Convolution: If 𝑥1 [𝑛] 𝑋1 (𝛺) , 𝑥2 [𝑛] 𝑋2 (𝛺)

Then 𝑥1 [𝑛] ∗ 𝑥2 (𝛺)𝑋 1 [𝑛] × 𝑋2 (𝛺)

10
Lect. 3, Asst. Prof. Dr. Hadi T. Ziboon, Department of Electrical Eng. U.O.T

3.7 Frequency Response of LTI Processors

3.7.1 The first method by using input signal frequency response and LTI
frequency response

• The key relationships defining an LTI system in the time domain


and frequency domain are summarized by fig (3.3)

Input Signal Digital LTI System Output Signal

Time domain x[n] h[n] y[n] = x[n] ∗ ℎ[𝑛]


Frequency domain X(Ω) H(Ω) 𝑌(Ω) = X(Ω)H(Ω)
Where h[n] is the impulse response.
H(Ω) is the system frequency response.
• In general we may write X(Ω) in the polar form:-
𝑋(Ω) = |𝑋(Ω)|𝑒 𝑗ф𝑋(Ω) … (3.15)
Also 𝐻(Ω) = |𝐻(Ω)|𝑒 𝑗ф𝐻 (Ω) … (3.15)

∴ 𝑋(𝛺)𝐻 (𝛺) = |𝑋(𝛺)||𝐻(𝛺)|𝑒 𝑗[ф𝑋 (𝛺)+ф𝐻 (𝛺)] …(3.17)


• The impulse response h[n] and frequency response H(Ω) are a
Fourier Transform pair
If x[n] = δ[n] ,
Now the spectrum of a unit impulse is unity
So X(Ω) =1 ∴ Y(Ω) =X(Ω)H(Ω)
= 1 H(Ω)
=H(Ω)System frequency response

11
Lect. 3, Asst. Prof. Dr. Hadi T. Ziboon, Department of Electrical Eng. U.O.T

Ex(3.5) The filter – impulse response is given by


ℎ[𝑛] = 0.2{ 𝛿[𝑛 − 2] + 𝛿[𝑛 − 1] + 𝛿[𝑛] + 𝛿[𝑛 + 1] + 𝛿[𝑛 + 2]}
Find the frequency response
Solution:
𝐻 (𝛺) is the frequency response given by

𝐻 (𝛺) = � ℎ[𝑛] 𝑒 −𝑗𝛺𝑛


𝑛=−∞

Using the shift property of the unit impulse [see Ex3.3]

∴ 𝐻 (𝛺) = 0.2(1 + 2𝑐𝑜𝑠𝛺 + 2𝑐𝑜𝑠2𝛺)


Ex(3.6) The filter – impulse response is given by
ℎ[𝑛] = 0.5𝛿 [𝑛] + 0.25𝛿 [𝑛 − 1] + 0.125𝛿 [𝑛 − 2] + ⋯
Find the frequency response
Solution
𝐻 (𝛺) = ∑∞
𝑛=−∞ ℎ[𝑛] 𝑒
−𝑗𝛺𝑛
[See Ex3.4]

= [0.5𝛿 [𝑛] + 0.25𝛿 [𝑛 − 1] + 0.125𝛿 [𝑛 − 2] + ⋯ ]𝑒 𝑗𝛺𝑛


1
=
1 − 0.5𝑒 −𝑗𝛺

12
Lect. 3, Asst. Prof. Dr. Hadi T. Ziboon, Department of Electrical Eng. U.O.T

3.7.2LTI Systems Characterized by Linear Constant Coefficients


Difference Equation (LCCDE) [2nd method to fined frequency response]

 In the previous section we treat LTI systems and characterized then


in terms of their impulse response.
 In this section we focus on a family of LTI systems described by
input-output relation called a difference equation with constant
coefficients.
 Systemdescribed by Linear Constant Coefficients Difference
Equation(LCCDE) are subclass of recursive and non-recursive
systems.
 Fig(3.4) shows a block diagram of a simple recursive
systemdescribed by a first order difference equation as follows
y[n] = ay[n − 1] + x[n] …. (3.18)
x[n] y[n]
where a is a constant (independent
on the frequency) +
T
a
However the system described by fig(3.4)
eq(3.19) has time variant coefficients
𝑛 𝑛
𝑦 [𝑛 ] = 𝑦 [ 𝑛 − 1] + 𝑥[𝑛]….(3.19)
𝑛+1 𝑛+1
 The system described by eq (3.18) is the simplest possible
recursive system described by LCCDE. The general form for such
an equation is

∑𝑁 𝑀
𝑘=0 𝑎𝑘 𝑦[𝑛 − 𝑘] = ∑𝑘=0 𝑏𝑘 𝑥[𝑛 − 𝑘]…. (3.20)
 The integer N is called the order of the DE or the order of the
system.

13
Lect. 3, Asst. Prof. Dr. Hadi T. Ziboon, Department of Electrical Eng. U.O.T

Ex(3.7)Fig(a) shows a high pass filter. Fined its frequency response


H(Ω).

Solution x[n] y[n]


T +

The recurrence formula relating T


the input and output signal is 0.8

𝑦[𝑛] = −0.8𝑦[𝑛 − 1] + 𝑥[𝑛] − 𝑥[𝑛 − 1]


∴ 𝑦[𝑛] + 0.8𝑦[𝑛 − 1] = 𝑥[𝑛] − 𝑥[𝑛 − 1]
Compare y[n] with general D.E form
∑𝑁 𝑀
𝑘=0 𝑎𝑘 𝑦[𝑛 − 𝑘] = ∑𝑘=0 𝑏𝑘 𝑥[𝑛 − 𝑘]…. (1)
∴ 𝑎0 = 1‚ 𝑎1 = 0.8‚ 𝑏0 = 1‚ 𝑏1 = −1
But the F.T for eq(1) is given by
𝑁 𝑀

� 𝑎𝑘 𝑌(𝛺)𝑒 −𝑗𝑘𝛺 = � 𝑏𝑘 𝑋(𝛺)𝑒 −𝑗𝑘Ω


𝑘=0 𝑘=0
𝑌(𝛺) ∑𝑀
𝑘=0 𝑏𝑘 𝑒
−𝑗𝑘𝛺
𝐻(𝛺) = =
𝑋(𝛺) ∑𝑁
𝑘=0 𝑎𝑘 𝑒
−𝑗𝑘𝛺

1𝑒 −𝑗0 + (−1)𝑒 −𝑗1𝛺 1 − 1𝑒 −𝑗𝛺


= −𝑗0 =
1𝑒 + (0.8)𝑒 −𝑗1𝛺 1 + 0.8𝑒 −𝑗𝛺
1 − 𝑐𝑜𝑠𝛺 + 𝑗𝑠𝑖𝑛𝛺
=
1 − 0.8𝑐𝑜𝑠𝛺 + 𝑗0.8𝑠𝑖𝑛𝛺
Note F.T for both sides of eq(1) is given by

𝑁 𝑀

� 𝑎𝑘 𝑌[𝛺]𝑒 −𝑗𝑘𝛺 = � 𝑏𝑘 𝑋[𝛺]𝑒 −𝑗𝑘𝛺


𝑘=0 𝑘=0

14
Lect. 3, Asst. Prof. Dr. Hadi T. Ziboon, Department of Electrical Eng. U.O.T

3.7.3 Solution of Linear Constant Coefficient Difference Equation


(LCCDE). (Third method to find frequency response)
 LCCDE describe the relationship between the input-output
of LTI system. The object of the solution is to determine
an expression to describe the output y[n] of LTI.
 There are two method for this solution:-
1) Direct method.
2) Indirect method based on Z-transform.
 The direct solution assumes that the total solution is the
sum of the two parts

𝑦[𝑛] = 𝑦ℎ [𝑛] + 𝑦𝑝 [𝑛] ... (3.21)

Where 𝑦ℎ [𝑛] is the homogenous as complementary solution


which represent the transient response.

𝑦𝑝 [𝑛]iscalled particular solution which represents the steady


state response of the system

15
Lect. 3, Asst. Prof. Dr. Hadi T. Ziboon, Department of Electrical Eng. U.O.T

3.8The Z-transform and its applications in signal processing [Fourth


method to find frequency response]
A discrete signal has values which are defined only at discrete value of
time. As discussed in previous such a continuous time signal at regular
time intervals nT, n=0, 1, … where T is the sampling period. The discrete
time signal is represented as a sequence of numbers:-
𝑥[𝑛] = 𝑛 = 0‚1‚ …
𝑥[𝑛𝑇] = 𝑛 = 0‚1‚ …
𝑥𝑛 = 𝑛 = 0‚1‚ …
Where the symbol, 𝑥[𝑛], 𝑥[𝑛𝑇], or 𝑥𝑛 indicated the value of the signal at
the discrete time n or (nT).
3.8.1 The Z-transform
 The Z-transform of a sequence, x[n], which is valid for all n, is
defined as

𝑋(𝑧) = ∑∞
𝑛=−∞ 𝑥[𝑛] 𝑧
−𝑛
…. (3.22)

where z is a complex variable.

 In causal systems, x[n] may be nonzero only in interval 0 < n < ∞


and eq(3.22) reduces to the so called one side z-transform:

𝑋(𝑧) = ∑∞
𝑛=0 𝑥[𝑛] 𝑧
−𝑛
…. (3.23)

 Clearly, the z- transform is a power series with an infinite number


of terms and so may not converge for all value of z.

 The region where the z-transform converge is known as the region


of convergence (ROC), and in this region the values of X(z) are
finite.
 The region of convergence is determined by the properties of x[n]
or by X[z].

16
Lect. 3, Asst. Prof. Dr. Hadi T. Ziboon, Department of Electrical Eng. U.O.T

 There are three main reasons for covering the z-transform


1) It offers an extremely compact and convenient notation to
description digital signals and systems.
2) Pole-Zero description of a processor is a great help in
visualizing its stability and frequency, response characteristics.
3) It is widely used by DSP designers.
 The region of convergence (ROC) of a finite duration signal is the
entire z-plane, except the point z=0 and/or z=∞. These points are
excluded, because 𝑧 𝑘 (𝑘 > 0) becomes unbounded for z=∞ and
𝑧 −𝑘 (𝑘 > 0) becomes unbounded for z=0.

Ex(3.8) Findthe z-transform and the region of converges for the discrete
time sequence given in fig(3.8)

Solutionx[n]
5

3 3

1 1

0
-6 -5 -4 -3 -2 -1 0 1 2 3 4 n

• The sequence of the signal is noncausal, since is not zero for n<0
but it is of a finite duration.
• The sequence has value x(-6)=0, x(-5), x(-3)=5, x(-2)=3, x(-1)=1
and x(0)=0.

∴ 𝑋(𝑧) = � 𝑥[𝑛] 𝑧 −𝑛 = 𝑧 5 + 3𝑧 4 + 5𝑧 3 + 3𝑧 2 + 𝑧
𝑛=−∞

X(z) becomes infinite when z=∞

∴ RCO is everywhere in the Z plane except at z=∞

17
Lect. 3, Asst. Prof. Dr. Hadi T. Ziboon, Department of Electrical Eng. U.O.T

Ex(3.9) Fined the z-transform and the region of convergence for the
discrete time sequences

x[-3]=0, x[-2]=1, x[-1]=3, x[0]=5, x[1]=3, x[2]=1 and x[3]=0.

Solution

∴ 𝑋(𝑧) = � 𝑥 [𝑛] 𝑧 −𝑛
𝑛=−∞
𝑋(𝑧) = 𝑧 + 3𝑧 + 5 + 3𝑧 −1 + 𝑧 −2
2

It is evident that the value of X(z) is infinite if z=∞ and z=0.

∴ RCO is everywhere in the Z plane except at z=0 and z=∞

Ex(3.10) Fined the z-transform and the region of convergence for the
discrete time sequence defined by
𝑥[𝑛] = 1 0≤𝑛≤∞
=0 𝑛<0
Solution The sequence is a causal sequence of infinite duration

𝑋(𝑧) = � 𝑥[𝑛] 𝑧 −𝑛
𝑛=−∞

𝑋(𝑧) = � 𝑧 −𝑛
𝑛=0

𝑋(𝑧) = 1 + 𝑧 −1 + 𝑧 −2 + 𝑧 −3 + ⋯
The series is convergence if |𝑧 −1 | < 1 or equivalently if |𝑧| > 1. Thus
we may express X(z) in closed form if |𝑧| > 1.
1 𝑧
𝑋(𝑧) = =
1 − 𝑧 −1 𝑧 − 1
- In this case, the z-transform is valid everywhere outside a circle of
unit radius whose center is at the region.

18
Lect. 3, Asst. Prof. Dr. Hadi T. Ziboon, Department of Electrical Eng. U.O.T

𝑧
𝑋(𝑧) =
𝑧−1
- The outside of the circle is the region of convergence.
- We can readily that Im
when |𝑧| > 1, X(z) coverage.
where |𝑧| < 1, X(z) diverges.
For ex. If z=2 (outside the circle) |𝑧| = 1 Re
𝑋(𝑧) = 1 + 𝑧 −1 + 𝑧 −2 + 𝑧 −3 + ⋯
𝑍
= 𝑍−1 region of convergence
1 1 1
𝑋(𝑧) = 1 + + ( )2 + ( )3 + ⋯
2 2 2
2
= =2 thus X(z) converges
2−1
1
If 𝑧 = (inside the circle)
2
1 1 1
𝑋(𝑧) = 1 + + ( )2 + ( )3 + ⋯
0.5 0.5 0.5
= 1+2+4+8+… thus X(z) diverge
3.8.2 The Inverse Z-transform
- The inverse z-transform (IZT) allows recovering the discrete time
sequence, x[n], given its transform. The IZT is particularly useful in
DSP, for example in finding the impulse response of digital filters.
The inverse z-transform is defend as
𝑥[𝑛] = 𝑍 −1 {𝑋(𝑧)} …. (3.24)

Where X(z) is the Z-transform of x[n]

𝑍 −1 is the symbol for the inverse z-transform

Assuming a causal sequence, the z-transform, X(z), can be expanded into


a power series as

𝑋(𝑧) = � 𝑥[𝑛] 𝑧 −𝑛
𝑛=0

= 𝑥 [0] + 𝑥 [1]𝑧 −1 + 𝑥 [2]𝑧 −2 + ⋯ ... (3.25)

19
Lect. 3, Asst. Prof. Dr. Hadi T. Ziboon, Department of Electrical Eng. U.O.T

Practice, X(z) is often expressed as a ratio of two polynomials in 𝑧 −1


𝑎0 +𝑎1 𝑧 −1 +𝑎2 𝑧 −2 +⋯+𝑎𝑁 𝑧 −𝑁
𝑋(𝑧) = 𝑏 −1 +𝑏 𝑧 −2 +⋯+𝑏 𝑧 −𝑀 …. (3.26)
0 +𝑏1 𝑧 2 𝑀

In this form the inverse-z transform, x[n] can be obtained using one of
several methods:-
1) Power series expansion method
2) Partial fraction expansion method
3) Residue

3.8.2.1 Power series method: Given the z-transform X(z) of a causal

sequence as in eq(3.26), it can be expanded into infinite series in 𝑧 −1 by


long division

𝑎0 + 𝑎1 𝑧 −1 + 𝑎2 𝑧 −2 + ⋯ + 𝑎𝑁 𝑧 −𝑁
𝑋 (𝑧) =
𝑏0 + 𝑏1 𝑧 −1 + 𝑏2 𝑧 −2 + ⋯ + 𝑏𝑀 𝑧 −𝑀

= 𝑥(0) + 𝑥(1)𝑧 −1 + 𝑥(2)𝑧 −2 + 𝑥(3)𝑧 −3 + ⋯

Ex(3.10) Given the following z-transform of a casual LTI system, obtain


its IZT by expanding it into power series using long division

1 + 2𝑧 −1 + 𝑧 −2
𝑋 (𝑧) =
1 − 𝑧 −1 + 0.356𝑧 −2

Solution In this method, the numerator and denominator of X(z) are first
expressed in either descending powers of Z or as ending power of Z and
the quotient is then obtained by long division

20
Lect. 3, Asst. Prof. Dr. Hadi T. Ziboon, Department of Electrical Eng. U.O.T

1 + 3𝑧 −1 + 3.6439𝑧 −2 + 2.5756𝑧 −3 + ⋯

1 + 𝑧 −1 + 0.3561𝑧 −2 1 + 2𝑧 −1 + 𝑧 −2

−1 ± 𝑧 −1 ∓ 0.3561𝑧 −2
3𝑧 −1 + 0.6439𝑧 −2

−3𝑧 −1 ± 3𝑧 −2 ∓ 1.0683𝑧 −3

3.6439𝑧 −2 − 1.0683𝑧 −3

−3.6439𝑧 −2 ± 3.6439𝑧 −3 ∓ 1.2975927𝑧 −4

2.5756𝑧 −3 − 1.2975927𝑧 −4

−2.5756𝑧−3 − 1.2975927𝑧−4

Or may be express the numerates and denominator in positive power of z,


in resending then perform the long division

1 + 2𝑧 −1 + 𝑧 −2 𝑧 2 + 2𝑧 + 1
𝑋 (𝑧) = =
1 − 𝑧 −1 + 0.356156𝑧 −2 𝑧 2 − 𝑧 + 0.3561

Either way, the z-transform is now expanded into

𝑋(𝑧) = 1 + 3𝑧 −1 + 3.6439𝑧 −2 + 2.5756𝑧 −3 + ….


The invers z-transform can now be written down directly

x[0]=1, x[1]=3, x[2]= 3.6439, x[3]=2.576, ….


Or X[n]= δ[n]+3 δ[n-1]+3.6439 δ[n-2]+2.576 δ[n-3]+ ...
Note The z-transform of common sequence is available, in closed form
and are given in the form of tables such as Table 3. Such tables are useful
in finding the inverse z-transform. For example z-transform of kδ[n] is
given by k δ[n] k

21
Lect. 3, Asst. Prof. Dr. Hadi T. Ziboon, Department of Electrical Eng. U.O.T

Partial Fraction

In many practical cases, the z-transform is given as ratio of polynomials


in z or 𝑧 −1 and has the form

𝑎0 + 𝑎1 𝑧 −1 + 𝑎2 𝑧 −2 + ⋯ + 𝑎𝑁 𝑧 −𝑁
𝑋 (𝑧) =
𝑏0 + 𝑏1 𝑧 −1 + 𝑏2 𝑧 −2 + ⋯ + 𝑏𝑀 𝑧 −𝑁

If poles of X(z) are first order and N=M , then X(z) can be expanded as

𝐶1 𝐶2 𝐶𝑀
𝑋(𝑧) = 𝐵0 + + + ⋯ +
1 − 𝑃1 𝑍 −1 1 − 𝑃2 𝑍 −2 1 − 𝑃𝑀 𝑍 −1
𝐶1 𝑍 𝐶2 𝑍 𝐶𝑀 𝑍
= 𝐵0 + + + ⋯+
𝑍 − 𝑃1 𝑍 − 𝑃2 𝑍 − 𝑃𝑀
𝐶𝑘 𝑍
= 𝐵0 + ∑𝑀
𝑘=1 … (3.27)
𝑍−𝑃𝑘

Where 𝑃𝑘 are the poles of X(z), 𝐶𝑘 are the partial fraction coefficients
and

𝐵0 = 𝑎𝑁 /𝑏𝑁 …. (3.28)

The 𝐶𝑘 are also known as the residues of X(z).

1) If N<M, then 𝐵0 will be zero.


2) If N>M, then X(z) must be reduced first, to make 𝑁 ≤ 𝑀,
by long division with the numerator polynomials written in
descending power of 𝑧 −1 .
3) The coefficient𝐶𝑘 , associated with the pole 𝑃𝑘 may be
obtained by multiplying both sides of eq(3.27) by
(𝑧 − 𝑃𝑘 )/𝑧 and then letting 𝑧 = 𝑃𝑘 .
𝑋(𝑧)
𝐶𝑘 = (𝑧 − 𝑃𝑘 )|𝑧=𝑃𝑘 … (3.28)
𝑧

22
Lect. 3, Asst. Prof. Dr. Hadi T. Ziboon, Department of Electrical Eng. U.O.T

3.8.2.2 Partial fraction expansion method


In this method, the z-transform is first expanded into a sum of simple
partial fractions. The inverse z-transform of each partial fraction is
obtained from table 3 and then summed to give the overall inverse
z-transform.
Ex(3.12) Find the inverse z-transform of the following

𝑧 −1
𝑋(𝑧) =
1 − 0.25𝑧 −1 + 0.375𝑧 −2
Solution: - for simplicity, we first express the z-transform in positive
power of z. multiply X(z) by 𝑧 2 .
𝑧 𝑧
∴ 𝑋(𝑧) = 𝑧 2 = (𝑧−0.75)(𝑧+0.5) … (1)
−0.25𝑧−0.375
𝑧 1 𝑐 𝑧
2 𝑐 𝑧
(𝑧−0.75)(𝑧+0.5)
= 𝑧−0.75
+ 𝑧+0.5
= 𝑋(𝑧)…. (2)

1) To make it easier to find the value of find the value of 𝐶1 . 𝐶2 we


dived both side of eq(2) by z, then
2) To obtain 𝐶1 , we multiply both side of Eq(2) by z-0.75 and let
z=0.75
(𝑧 − 0.75) 𝐶1 (𝑧 − 0.75) 𝐶2 (𝑧 − 0.75)
= +
(𝑧 − 0.75)(𝑧 + 0.5) (𝑧 − 0.75) (𝑧 − 0.5)
1 4
= 𝐶1 + 0 ∴ 𝐶1 =
0.75 + 0.5 5
Similarly, 𝐶2 is obtained by multiply both sides of Eq(2) by (z+0.5)
4
and let z=-0.5 ∴ 𝐶2 = −
5

23
Lect. 3, Asst. Prof. Dr. Hadi T. Ziboon, Department of Electrical Eng. U.O.T

1 𝐶 𝑧2 𝐶 𝑧
𝑋(𝑧) = 𝑧−0.75 + 𝑧−0.5 … (2)

Substitute the value of 𝐶1 and 𝐶2 in eq(2)


(4/5)𝑧 (−4/5)𝑧
𝑋(𝑧) = 𝑧−0.75 + 𝑧−0.5
form the z-transform table 3, enter 14

𝑘𝑧
form the z-transform table 𝑘 ∝𝑛 ↔ 𝑧−∝
4
� �𝑧 4(0.75)𝑛 4
𝑧 −1 5
�𝑧−0.75� = where 𝐾 = , α=0.75
5 5

4
�− �𝑧 −4(0.5)𝑛 −4
𝑧 −1 5
� 𝑧−0.5 � = where 𝐾 = , α=0.5
5 5

The desired inverse z-transform, x[n] is the sum of the two inverse
z-transform

4 4
∴ 𝑥 [𝑛] = (0.75)𝑛 − (−0.5)𝑛
5 5

Ex(3.12) Find the discrete time signal, x[n], represented by the following
z-transform using the partial fraction expansion method

1 + 2𝑧 −1 + 𝑧 −2
𝑋(𝑧) =
1 − 𝑏1 𝑧 −1 + 0.3516𝑧 −2

Solution: -First, X(z) is expressed in positive power of z:

𝑧 2 + 2𝑧 + 1
𝑋(𝑧) = 2
𝑧 − 𝑧 + 0.3561
The poles of X(z) are found by solving

𝑧 2 − 𝑧 + 0.3561 = 0

24
Lect. 3, Asst. Prof. Dr. Hadi T. Ziboon, Department of Electrical Eng. U.O.T

Using the formula

−𝑏 ∓ �(𝑏 2 − 4𝑎𝑐)
𝑃= 𝑧2 − 𝑧 + 0.3561 = 0
2𝑎
Where a and b are the coefficient of 𝑧 2 and z, and c is the coefficients
constant term (a=1, b=-1 and c=0.356)

1 + �(1 − 4 × 0.3561)
𝑃1 = = 0.5 + 𝑗0.3257 = 𝑟𝑒 𝑗𝜃
2
1 − �(1 − 4 × 0.3561)
𝑃2 = = 0.5 − 𝑗0.3257 = 𝑟𝑒 −𝑗𝜃
2
Where r=0.5967 and 𝜃 = 33.080

𝑧 2 + 2𝑍 + 1 𝐵0 𝐶1 𝐶2
∴ 𝑋 (𝑧) = = + +
𝑧(𝑧 − 𝑃1 )(𝑧 − 𝑃2 ) 𝑧 𝑧 − 𝑃1 𝑧 − 𝑃2
Using the procedure of EX. (3.12) to find
𝑎𝑁 1
𝐵0 = = = 2.8082
𝑏𝑁 0.356
𝐶1 = 6.06066 < −98.58
𝐶2 = 6.06066 < 98.58 = 𝐶1∗

𝐶1 𝑧 𝐶2 𝑧
∴ 𝑋(𝑧) = 2.8082 + +
𝑧 − 𝑃1 𝑧 − 𝑃2
Using the table to find the inverse z-transform
𝑧 1 (2.8082) = 2.8082 𝑢[𝑛] [using entry in table 3.1]
𝐶1 𝑧 𝐶2 𝑧
𝑧1 � + � = 2 × 6.066(0.5967)𝑛 cos (33.08𝑛 − 98.58)
𝑧 − 𝑃1 𝑧 − 𝑃2
∴ 𝑥[𝑛] = 2.8082𝑢[𝑛] + 12.1213(0.5967)𝑛 cos (33.08𝑛 − 98.58)
Using entry 16 in table 3.1
𝐶1 𝑧 𝐶2 𝑧
𝑧1 � + � = 2|𝐶||𝑃|𝑛 cos [𝑛 < 𝑃+< 𝑐] [select the angle of P 1 and
𝑧−𝑃1 𝑧−𝑃2
C1]

25
Lect. 3, Asst. Prof. Dr. Hadi T. Ziboon, Department of Electrical Eng. U.O.T

3.8.3 Properties of the z-transform

1) Linearity
If 𝑥1 [𝑛] ↔ 𝑋1 (𝑧)
𝑥2 [𝑛] ↔ 𝑋2 (𝑧)
Then 𝑎𝑥1 [𝑛] + 𝑏𝑥2 [𝑛] ↔ 𝑎𝑋1 (𝑧) + 𝑏𝑋2 (𝑧) … (3.29)

2) Delay or shift
If 𝑥 [𝑛] ↔ 𝑋1 (𝑧)
𝑥[𝑛 − 𝑚] ↔ 𝑧 −𝑚 𝑋(𝑧)… (3.30)
3) Convolution: Given a discrete LTI system with input, x[n], and
impulse response, h(k), the output of the system is given by

𝑦[𝑛] = � 𝑥[𝑛] ℎ[𝑛 − 𝑘]


𝑘=−∞

In term of the z-transform

Y(z)=H(z) X(z) …. (3.31)

4) Time reversal

𝑥[𝑛] ↔ 𝑋(𝑧)
𝑥[−𝑛] ↔ 𝑋(𝑧 −1 )
5) Differentiation or multiplication by n

If 𝑥[𝑛] ↔ 𝑋(𝑧)
Then the z-transform of nx[n] can obtained by differentiating X(z)

𝑑𝑋(𝑧)
𝑛𝑥 [𝑛] ↔ −𝑧
𝑑𝑧

26
Lect. 3, Asst. Prof. Dr. Hadi T. Ziboon, Department of Electrical Eng. U.O.T

3.8.4 Pole-Zero description of discrete –time system

- In most practical discrete- time systems the z-transform of the


transfer function H(z), can be expressed in terms of poles and
zeros.

Consider for example, the following z-transform representing a general,


𝑁𝑡ℎ -order discrete time filter (where N=M)

𝑁(𝑧) 𝑎0 𝑧 𝑁 +𝑎1 𝑧 𝑁−1 +𝑎2 𝑧 𝑁−2 +⋯+𝑎𝑁


𝐻 (𝑧) = = … (3.32)
𝐷(𝑧) 𝑏0 𝑧 𝑁 +𝑏1 𝑧 𝑁−1 +𝑏2 𝑧 𝑁−2 +⋯+𝑏𝑁

The 𝑎𝑘 and𝑏𝑘 are the coefficients of the filter.

- If H(z) has poles at 𝑧 = 𝑃1 , 𝑃2 , … 𝑃𝑁


And zero at 𝑧 = 𝑧1 , 𝑧2 , … 𝑧𝑁 . The H(z) can be factored and
represents as
𝑘(𝑧−𝑧1 )(𝑧−𝑧2 )… (𝑧−𝑧𝑁 )
𝐻 (𝑧) = (𝑧−𝑃1 )(𝑧−𝑃2 )… (𝑧−𝑃𝑁 )
… (3.33)

Where 𝑧𝑖 is the ith zero,𝑃𝑖 is the ith pole and K is the gain factor.

- The poles and zeros of H(z) may be real or complex.


- Fig (3.4) shows the description of a z-transform in the form of
a pole-zero diagrams, X-pole, O-zero.
- For ex. The poles are located at 𝑧 = 0.5 ∓ 0.5𝑗 and at z=0.75 and
a single zero at z=-1
- An important feature of the pole-zero diagram is unit circle, that is
the circle defined by |z|=1.
- From the location of the poles and zero we can expect the
frequency response and degree of the stability. In order to find
poles and zero's, H(z) must be factorized.
Im(z)
unit circle means pole location
0.5
1 1 means zero location
Re(z)
-0.5 0.75

Fig(3.4)

27
Lect. 3, Asst. Prof. Dr. Hadi T. Ziboon, Department of Electrical Eng. U.O.T

Ex(3.12) Plot the z-plane poles and zeros of the following z-transform

𝑧 2 (𝑧 − 1.2)(𝑧 + 1)
H(z) =
(𝑧 − 0.5 + 𝑗0.5)(𝑧 − 0.5 − 𝑗0.5)(𝑧 − 0.8)

Solution: Im

Poles: 𝑃1 = 0.5 − 𝑗0.5 0.5 + 𝑗0.5


𝑃2 = 0.5 + 𝑗0.5 0.8
𝑃3 = 0.8 Re
Zeros: 𝑧1 = −1 -1 1.2
𝑧2 = 0 0.5 − 𝑗0.5
𝑧3 = 0
𝑧4 = 1.2
Ex 3.15Plot poles and zeros of the following z-transform
𝑋(𝑧) = (𝑧 5 − 1)(𝑧 2 + 1)
Solution This function has zeros only. The five roots of 𝑧 5 − 1 = 0 are
equally spaced around the unit circle. The two roots of 𝑧 2 + 1 = 0and at
𝑧 = ±𝑗.
To find the roots of 𝑧 5 − 1 = 0 using the formula
𝑛 𝑛 ∅ 2𝜋
√𝑟𝑐𝑖𝑠∅ = √𝑟𝑐𝑖𝑠[𝑛 + 𝑘 𝑛
]wherecis(x)=cos(x)+jsin(x)
If z= r cos∅ [compare Z= r cosϕ with z5-1=0 ∴z5=1]
in this case r=1 , ∅=0 K=0,1,2,3,4 i.e k=[0,1, …. , n-1]
𝑛 2𝜋 5 2𝜋
𝑤𝑘 = √𝑟𝑐𝑖𝑠 �0 + 𝑘 � = √1𝑐𝑖𝑠 �𝑘 � = 1𝑐𝑖𝑠 [𝑘720 ]
𝑛 5
𝑤0 = 1𝑐𝑖𝑠[0] = 𝑐𝑜𝑠∅ + jsin∅ = 1
𝑤1 = 1𝑐𝑖𝑠[72] = 𝑐𝑜𝑠72 + jsin72 = 0.3 + j0.9
𝑤2 = 1𝑐𝑖𝑠[2 × 72] = 𝑐𝑜𝑠144 + jsin144 = −0.8 + j0.58
𝑤3 = 1𝑐𝑖𝑠[3 × 72] = 𝑐𝑜𝑠216 + jsin216 = −0.8 − j0.58
𝑤4 = 0.3 − j0.5
Im

Re

28
Lect. 3, Asst. Prof. Dr. Hadi T. Ziboon, Department of Electrical Eng. U.O.T

3.8.5 Frequency response estimation


- The frequency response of a system can be obtained from its z-
transform. If we set 𝑧 = 𝑒 𝑗𝑤𝑇 , we obtain the Fourier transform of
the system
𝐻 (𝑧) = ∑∞𝑛=−∞ ℎ[𝑛] 𝑧
−𝑛
|𝑧=𝑒 𝑗𝑤𝑡 …. (3.34)
= 𝐻(𝑒 𝑗𝑤𝑇 ) = ∑∞
𝑛=−∞ ℎ[𝑛] 𝑒
−𝑗𝑛𝑤𝑡
… (3.35)
- H(𝑒 𝑗𝑤𝑇 ) is referred to as the frequency response of the system.
- Eq(3.35) shows the dependence of the frequency response on the
sampling frequency.
- In the design of digital filter. It is necessary examine the spectrum
of the filter in order to ensure that the desired specifications are
satisfied.
- The frequency response may be obtained from the z-transform
using several methods.

3.8.5.1 Geometric evaluation of frequency response

- This is a simple but useful method of obtaining a rough idea of


what the frequency response of a discrete time system would look
like based on pole-zero diagram.
- If the z-transform of an LTI system is expressed as
𝑁
𝑘(𝑧−𝑧1 )(𝑧−𝑧2 )….(𝑧−𝑧𝑁 ) 𝛱𝑖=1 𝑘(𝑧−𝑧𝑖 )
𝐻 (𝑧) = (𝑧−𝑃1 )(𝑧−𝑃2 )….(𝑧−𝑃𝑁)
= 𝑁 (𝑃−𝑃 ) … (3.30)
𝛱𝑖=1 𝑖
- The frequency response is obtained by substituting 𝑧 = 𝑒 𝑗𝑤𝑇 in
eq(3.30) and evaluation H(𝑒 𝑗𝑤𝑇 ) in the interval (0 ≤ 𝑤 ≤ 𝑤𝑠 /2).

29
Lect. 3, Asst. Prof. Dr. Hadi T. Ziboon, Department of Electrical Eng. U.O.T

𝑁
𝛱𝑖=1 𝑘(𝑒 𝑗𝑤𝑇 −𝑧𝑖 )
∴ 𝐻�𝑒 𝑗𝑤𝑇 � = 𝑁 (𝑒 𝑗𝑤𝑇 −𝑃 )
𝛱𝑖=1
…. (3.31)
𝑖

Eq(3.31) with two zero and two poles is shown in fig (3.5). In this case,
the frequency response for a given point 𝑃 = 𝑍 = 𝑒 𝑗𝑤𝑇 is given by

𝑗𝑤𝑡
𝑘�𝑒 𝑗𝑤𝑇 − 𝑧1 ��𝑒 𝑗𝑤𝑇 − 𝑧2 �
𝐻�𝑒 �=
(𝑒 𝑗𝑤𝑇 − 𝑃1 )(𝑒 𝑗𝑤𝑇 − 𝑃2 )
𝑘 𝑢1 <𝜑1 𝑢1 <𝜑2
= …. (3.32)
𝑉1 <∅1 𝑉2 <∅2

Where 𝑢1 and 𝑢2 represent the distance from zeros to the point 𝑍 = 𝑒 𝑗𝑤𝑇

Where 𝑉1and 𝑉2represent the distance from poles to the point 𝑃 = 𝑍 = 𝑒 𝑗𝑤𝑇

- Thus the magnitude and phase responses for the system, from eq 3.32
𝑢 𝑢
�𝐻𝑒 𝑗𝑤𝑇 � = 𝑉1 𝑉2 𝑖𝑓 𝑘 = 1 < 𝐻�𝑒 𝑗𝑤𝑇 � = 𝜑1 + 𝜑2 − (∅1 + ∅2 ) (3.32a)
1 2

𝑢2 Im 𝑃1 𝑉1
P
∅1 𝑤𝑇 𝑢1

Re
𝑧2 𝑧1

𝑃2 𝑉2
Note 1. In general, in the geometric method, the frequency response at a given
frequency, w (at the angle wT) is determined by the ratio of the product of the
zero vectors 𝑢𝑖 < 𝜑𝑖 with the product of the pole vectors 𝑃𝑖 < 𝜑𝑖 where i= 1, 2,
… 𝑃1 𝑣1

𝑗𝑤𝑇
𝑘 𝑢1 𝑢2 𝑢3 … . . 𝑢𝑖
�𝐻𝑒 �= ∅2 𝑃1
𝑉1 𝑉2 𝑉3 … . . 𝑉𝑖
< 𝐻�𝑒 𝑗𝑤𝑇 � = 𝜑1 + 𝜑2 + ⋯ + 𝜑𝑖 − (∅1 + ∅2 + ⋯ + ∅𝑖 ) 𝑃2 𝑣2
∅1

2.Thus the complete frequency response is obtained by evaluating


H(ejwT ) as the point P mover from z=0 to z= -1

30
Lect. 3, Asst. Prof. Dr. Hadi T. Ziboon, Department of Electrical Eng. U.O.T

Ex3.16 Determine the frequency response at dc, 1/8, 1/4, 3/8, 1/2 the
sampling frequency of the causal discrete time system has the following
z-transform
𝑧+1
𝐻(𝑧) =
𝑧 − 0.7071
Sketch, the amplitude frequency response in the interval 0 < 𝑤 ≤ 𝑤𝑠 ,
where 𝑤𝑠 (rad/s) in the sampling frequency.Using the geometric method.
Solution using eq(3.32) Im
𝑘 𝑢1 <𝜑1 𝑢1 <𝜑2
𝐻(𝑒 𝑗𝑤𝑇 ) = P
𝑉1 <∅1 𝑉2 <∅2

H(Z) has a single pole and a single zero as Re


Shown in fig (a) (a) WT=0

𝑗𝑤𝑇
𝑒 𝑗𝑤𝑇 + 1
𝐻�𝑒 � = 𝑗𝑤𝑇
𝑒 − 0.707
1+cos 𝑤𝑇+𝑗 sin(𝑤𝑇)
= Im
cos 𝑤𝑇−0.7071+𝑗 sin(𝑤𝑇)
𝑤
𝑃( 𝑠 )
4

1- At dc wT=0 Re
1+1+0
𝐻�𝑒 𝑗𝑤𝑇 � = = 6.828 < 0
1 − 0.707 + 0
As shown in fig(a) (b) WT=π/4
𝑤 2𝜋𝑓𝑠 𝑇 𝜋
2- At 𝑤 = 𝑤𝑠 /8, 𝑤𝑇 = � 𝑠 � 𝑇 = =
8 8 4

the pole and zero vector is shown in fig b Im

𝜋 𝜋
1+cos� �+𝑗 sin� �
𝑗𝑤𝑇 4 4
𝐻�𝑒 �= 𝜋 𝜋 Re
cos� 4 �−0.7071+𝑗 sin� 4 �

1.8477<22.5
= = 2.6131 < −67.50 (c) WT=π/2
0.7071<90

31
Lect. 3, Asst. Prof. Dr. Hadi T. Ziboon, Department of Electrical Eng. U.O.T

ie. responses at remaining frequency, obtained in a similar way, are


summarized below.
Im Im
P

P Re P Re
(e)wT=π (d)wT=3π/4
W(rad/sec) WT (rad) |𝐻(𝑒 𝑗𝑤𝑇 )| < 𝐻(𝑒 𝑗𝑤𝑇 ) degree
0 0 6.828 0
𝑤𝑠 \8 π/4 2.6131 67.5
𝑤𝑠 \4 π/2 1.1547 -80.26
3𝑤𝑠 \8 3 π/4 0.4840 -85.93
𝑤𝑠 \2 π 0 0
|𝐻(𝑒 𝑗𝑤𝑇 )|
6 (1) A sketch of the magnitude and
4 phase responses as shown in fig
2 e and f

(e) 𝑤𝑠 \8 𝑤𝑠 \4 3𝑤𝑠 \8 𝑤𝑠 \2 w
< 𝐻(𝑒 𝑗𝑤𝑇 ) (2) The magnitude response |𝐻(𝑒 𝑗𝑤𝑇 )|
60 is symmetrical about half the sampling
40 frequency (Nyquist frequency)
20 (3) The phase response antisymmetrical
A bout the same frequency
(f) 𝑤𝑠 \8 𝑤𝑠 \4 3𝑤𝑠 \8 𝑤𝑠 \2 w
-20
-40
-60
-80
-100

32
Lect. 3, Asst. Prof. Dr. Hadi T. Ziboon, Department of Electrical Eng. U.O.T

3.8.5.2 Direct Computer evaluation of frequency response


Geometric evaluation of the frequency response is simple and
gives one basic information for the frequency response. But it is
clearly very complex if the precise response is required at many
frequencies.
3.8.5.3 Frequency response estimation via FFT
FFT may also be used to evaluate the frequency response of
discrete time systems.
In this case firstly, fined the impulse response and then to
compute the FFT of the impulse response.
C-Language is used to implement FFT with smooth frequency
response.
3.8.6 Stability Consideration
- Stability analysis is often carried out as part of the design of
discrete-time systems.
- A useful stability criterion for LTI systems is that all
bounded inputs produce bounded outputs. This is also called
BIBO (bounded input, bounded output) condition.
1) An LTI system is said to be BIBO state if and only if its
satisfies condition
∑∞
𝑛=0 |ℎ(𝑛)| < ∞… (3.33)
Where h(n) is the impulse response of the system

33
Lect. 3, Asst. Prof. Dr. Hadi T. Ziboon, Department of Electrical Eng. U.O.T

2) When a poles lies inside the unit circle the system is stable.
3) When a poles lies on or outside the unit circle the system is unstable.
Note when a pole is coincident with a zero on the unit circle so that its effects
are nullified.
- Since stability to the radius of z-plane poles, it is often helpful to express
their locations in polar co-ordinates.
- Let us consider a processor with complex conjugate pole-pair as shown in
fig(3.6). The poles are at radius (r) and make angle ∓𝜑 with the positive
real axes. These location are therefore

𝑧 = 𝑟 𝑒𝑥𝑝(𝑗𝜑)and= 𝑟 𝑒𝑥𝑝(−𝑗𝜑).

𝑌(𝑧) 1
𝐻 (𝑧 ) = =
𝑋(𝑧) (𝑧 − 𝑟𝑒 )(𝑧 − 𝑟𝑒 −𝑗𝜑 )
𝑗𝜑

𝑌 (𝑧 ) 1
=
𝑋(𝑧) [𝑧 − 𝑟(cos 𝜑 + sin 𝜑)][𝑧 − 𝑟(cos 𝜑 − sin 𝜑)]
1
=
𝑧2 − 2𝑟𝑧 cos 𝜑 + 𝑟 2

Im

𝜑 Re

Fig(3.6)

Or

𝑌(𝑧)[𝑧 2 − 2𝑟𝑧 cos 𝜑 + 𝑟 2 ] = 𝑋[𝑧]

The corresponding difference equation is


𝑦[𝑛 + 2] − 2𝑦[𝑛]𝑟 cos 𝜑 + 𝑦[𝑛]𝑟 2 = 𝑥[𝑛]
By subtracting (2) from both sides
𝑦[𝑛] = 2𝑟 cos 𝜑 𝑦[𝑛 − 1] − 𝑟 2 𝑦[𝑛 − 2] + 𝑥[𝑛 − 2]
The processor will only be stable if r <1.
34
University of Technology
Department of Electrical Engineering

Lect4

Discrete Fourier Transform (DFT) and


Fast Fourier Transform (FFT)

Asst. Prof. Dr. Hadi T. Ziboon


Lect. 4, Asst. Prof. Dr. Hadi T. Ziboon, Department of Electrical Eng. U.O.T

Discrete Fourier Transform (DFT) and Fast Fourier Transform


(FFT)

4.1 DFT

- In practice the Fourier components of data are obtained by


digital computation rather than by analog processing.
- The analog values have to be sampled at regular intervals
and the sample values are converted to a digital binary
representation by using ADC.
- A discrete time version of the Fourier Series, applicable to
periodic signals. The spectral coefficients 𝐶𝑘 represents the
harmonics of the series, producing a line spectrum.
- The DFT may be regarded as a third Fourier representation,
applicable to aperiodic digital signal of finite length.
- FFT is used to implement of DFT in order to decrease the
number of complex implementation.
- Assume that a waveform has been sampled at regular time
intervals T to produce the sample sequence x[nT] =
𝑥 [0]. 𝑥 [𝑇]. 𝑋 [2𝑇]. … . 𝑋 [𝑁 − 1]𝑇 OF N sample values where
n=0 to n=N-1.

1
Lect. 4, Asst. Prof. Dr. Hadi T. Ziboon, Department of Electrical Eng. U.O.T

- The DFT of x[nT] is then defined as the sequence of complex value


𝑋(𝑘𝛺) = 𝑋 (0). 𝑋 (𝛺). 𝑋 (2𝛺). … . 𝑋(𝑁 − 1)𝛺 in the frequency domain,
where Ω is the first harmonics frequency given by Ω=2π/NT. Thus X(Ω)
have real and imaginary components in general so that for the 𝑘𝑡ℎ
harmonic
𝑋(𝐾) = 𝑅 (𝐾) + 𝑗𝐼(𝐾) … (4.1)

and |𝑋 (𝐾)| = �𝑅2 (𝐾) + 𝐼2 (𝑘)

𝐼(𝑘)
and X(k) has a phase angle 𝜑𝑘 = 𝑡𝑎𝑛−1 … (4.2)
𝑅(𝑘)

and X(k) is used to represent X(kΩ).

- Note that N real data value (in the time domain) transform to N complex
DFT value (in the frequency domain). The value of DFT are given by
2𝜋
𝑁−1
𝑋(𝑘𝛺) = ∑𝑛=0 𝑁−1
𝑥[𝑛𝑇] 𝑒 −𝑗𝑘𝛺𝑛𝑇 = ∑𝑛=0 𝑥[𝑛𝑇] 𝑒 −𝑗 𝑁 𝑘𝑛 ..(4.3)

Where k= 0, 1, 2, 3, … N-1

K represents the harmonic number of the transform component.

- Eq (4.3) of DFT is analogous to Fourier transform F(jw) which is given by


F(jwt) = � f(t)e−jωt dt Fourier Trasform
−∞

∴ 𝑥 [𝑛𝑇] = 𝑓 (𝑡 ). Ω = 2𝜋/𝑁𝑇. 𝑘𝛺 = 𝑤 𝑎𝑛𝑑 𝑛𝑇 = 𝑡


- The relationship between DFT and Fourier transform is given by
F(jw)=T X(kΩ).
Ex 4.1 (a) Calculate the DFT of the data sequence [1, 0, 0, 1]
(b) Plot the amplitude and phase of the DFT.
Assume the data sequence had been sample at 8 kHz and represents four value
of voltage
(c) Discuss the result.

2
Lect. 4, Asst. Prof. Dr. Hadi T. Ziboon, Department of Electrical Eng. U.O.T

Solution The data represents four consecutive voltage x[0]=1, x[T]=0,


x[2T]=0, x[3T]=1, recorded at time intervals T. Thus N=4. It is required
to find the complex values X(kΩ) for k=0,1,2,3 [since N-1=3]. Using
eq(4.3).
2𝜋
𝑋(𝑘𝛺) = 𝑁−1
∑𝑛=0 𝑥[𝑛𝑇] 𝑒 −𝑗 𝑁 𝑘𝑛 where k=0,1,2,3
If k=0,
2𝜋
2𝜋
𝑋(0) = ∑3𝑛=0 𝑥[𝑛𝑇] 𝑒 −𝑗 𝑁 𝑘𝑛 𝛺=
𝑁𝑇
= 𝑥[0] + 𝑥[𝑇] + 𝑥[2𝑇] + 𝑥[3𝑇] = 1 + 0 + 0 + 1 = 2
Thus X(0)=2 is real value of magnitude 2V and ф(0)=0.
If k=1,
2𝜋
2𝜋
𝑋(1Ω) = ∑3𝑛=0 𝑥[𝑛𝑇] 𝑒 −𝑗 𝑁 (1)𝑛 𝛺=
𝑁𝑇
2𝜋 3
−𝑗 (1)(3) −𝑗 𝜋
=1+0+0+𝑒 4 =1+𝑒 2
2𝜋 2𝜋
) − 𝑗 sin � � = 1 + 𝑗
= 1 + cos(
3 3
Thus X(1Ω)=1+j is complex with magnitude √2V and phase angle
2𝜋
ф(1 Ω )=𝑡𝑎𝑛−1 1 = 450 , 𝛺 = .
𝑁𝑇
If k=2,
2𝜋
2𝜋
𝑋(2Ω) = ∑3𝑛=0 𝑥[𝑛𝑇] 𝑒 −𝑗 𝑁 (2)𝑛 𝛺=
𝑁𝑇
2𝜋
−𝑗 4 (2)(3)
=1+0+0+𝑒 = 1 + 𝑒−𝑗3𝜋
=1−1=0
Thus X(2Ω)=0 of magnitude zero and phase angle ф(2 Ω)=0.
If k=3,
2𝜋
2𝜋
𝑋(3Ω) = ∑3𝑛=0 𝑥[𝑛𝑇] 𝑒 −𝑗 𝑁 (3)𝑛 𝛺=
𝑁𝑇
9𝜋
−𝑗
=1+0+0+𝑒 2 =1−𝑗
Thus X(3Ω)=1-j is complex with magnitude √2V and phase angle
ф(3Ω)=-450 .

3
Lect. 4, Asst. Prof. Dr. Hadi T. Ziboon, Department of Electrical Eng. U.O.T

Thus the time series [1, 0, 0,1] has the DFT given by the sequence
[2,1+j,0,1-j]. x[nT] (a)
2𝜋
To fined 𝛺 = 𝑁𝑇 1
1 1 𝑇 = 8×103 = 125µ𝑆
2𝜋
= 1 125 250 375 t(𝜇𝑠)
4( )
8×103
=12.57kHz x[nT] (b)
∴ 2𝛺 = 2 × 12.57 = 25.14𝑘𝐻𝑧 2 2
3𝛺 = 3 × 12.57 = 37.71 √2 √2

12.5 25.14 37.71 50.28 𝑘𝛺(𝑘𝐻𝑧)


Fig (a) shows x[nT] versus t ф(kΩ) (c)
Fig (b) shows |𝑋(𝑘𝛺)| versus 𝑘𝛺 450
Fig (c) shows ф(kΩ) versus 𝑘𝛺
12.5 25.14 37.71 50.28 𝑘𝛺(𝑘𝐻𝑧)
450
Discussion
a) The amplitude plot of fig(b) is symmetrical about the second
harmonic components(N/2).
b) The phase angles are odd function (i.e antisymmetry).
c) The DFT is periodic with period N as shown in fig (b). If k=0 then
k+N=N i.e X(0)=X(4) in this example X(0)=2 and X(4)=2 or in
general.
𝑋(𝑘Ω) = 𝑋[(𝑘 + 𝑛)Ω]
E.x 4.2 Prove that for the DFT X(kΩ)=X[(k+N)Ω]

Solution the 𝑘𝑡ℎ component X(kΩ) is given by


𝑁−1
2𝜋
𝑋(𝑘Ω) = � 𝑥[𝑛𝑇] 𝑒 −𝑗 𝑁 𝑘𝑛
𝑛=0

𝑁−1 𝑁−1
2𝜋 2𝜋 2𝜋
−𝑗 (𝑘+𝑁)𝑛 −𝑗 𝑘𝑛 −𝑗 𝑁
𝑋(𝑘 + 𝑁)𝛺 = � 𝑥[𝑛𝑇] 𝑒 𝑁 = � 𝑥[𝑛𝑇] 𝑒 𝑁 𝑒 𝑁
𝑛=0 𝑛=0

2𝜋
−𝑗 𝑘𝑛 −𝑗2𝜋𝑛
= ∑𝑁−1
𝑛=0 𝑥[𝑛𝑇] 𝑒 𝑁 𝑒 = 𝑋(𝑘𝑁) Since 𝑒 −𝑗2𝜋𝑛 = 1

4
Lect. 4, Asst. Prof. Dr. Hadi T. Ziboon, Department of Electrical Eng. U.O.T

4.2 Inverse Discrete Fourier Transform IDFT


IDFT is used to carry out discrete transformation from the frequency to
the time domain. IDFT is given, IDFT is defined by
𝑁−11
𝑥[𝑛𝑇] = 𝑁 ∑𝑘=0 𝑋(𝑘𝛺) 𝑒 𝑗𝑘𝛺𝑛𝑇 …. (4.4)

Where n=0,1,2, …, N-1


𝑁−1
1 2𝜋
𝑗𝑘 𝑛𝑇
= � 𝑋(𝑘𝛺) 𝑒 𝑁𝑇
𝑁
𝑘=0
𝑗2𝜋𝑘
1 𝑁−1
𝑥[𝑛𝑇] = 𝑁
∑𝑘=0 𝑋(𝑘𝛺) 𝑒 𝑁 … (4.5)

E.x 4.3 Calculate the IDFT from its DFT components [2, 1+j, 0, 1-j]
𝑗2𝜋𝑘𝑛
1 𝑁−1
Solution 𝑥 [𝑛𝑇] = ∑𝑘=0 𝑋(𝑘𝛺) 𝑒 𝑁
𝑁
1
For n=0 , 𝑥 [0] = [𝑋(0) + 𝑋(1) + 𝑋(2) + 𝑋(3)]
4
1
= [2 + (1 + 𝑗) + 0 + (1 − 𝑗)] = 1
4
𝑗2𝜋𝑘
1
For n=1, 𝑥 [𝑛𝑇] = 𝑥[𝑇] = ∑𝑁−1 𝑋(𝑘) 𝑒 𝑁
𝑁 𝑘=0
3
1 𝑗𝑘𝜋
= � 𝑋(𝑘) 𝑒 2
4
𝑘=0
1 𝑗2
𝜋 3𝜋
𝑗2
( ) (
= �2 + 1 + 𝑗 𝑒 + 0 + 1 − 𝑗 𝑒 �)
4
1
= [2 + (1 + 𝑗)𝑗 + (1 − 𝑗)(−𝑗)] = 0
4
For 𝑛 = 2 → 𝑥 [2𝑇] = 0
For 𝑛 = 3 → 𝑥 [3𝑇] = 1

5
Lect. 4, Asst. Prof. Dr. Hadi T. Ziboon, Department of Electrical Eng. U.O.T

4.3 Properties of the DFT


1) Symmetry
𝑅𝑒[𝑋(𝑁 − 𝑘)] = 𝑅𝑒[𝑋(𝑘)] … (4.6)
𝐼𝑚[𝑋(𝑁 − 𝑘)] = −𝐼𝑚[𝑋(𝑘)] … (4.7)
Where 𝑅𝑒 denote the real part states the symmetry of the amplitude
spectrum.
𝐼𝑚 denote the imaginary part states the antisymmetrical of the phase
spectrum.
2) Perceval's theorem: The normalized energy in the signal is given by
either of the expressions
𝑁−11
∑𝑁−1 2
𝑛=0 𝑥 [𝑛] = ∑𝑘=0 |𝑋(𝑘)|
2
… (4.8)
𝑁

The right hand side of eq(4.8) is the mean square spectral amplitude,
while the left hand side is the sum of the squared magnitude of the time
series.
3) Delta Function
𝐹𝐷 [𝛿(𝑛𝑇)] = 1 …. (4.9)
Where 𝐹𝐷 is the Discrete Fourier Transform
4) Convolution
(a) Time Convolution
𝑥3 [𝑛] = 𝑥1 [𝑛] ∗ 𝑥2 [𝑛] = 𝐹𝐷−1 [𝑋1 (𝑘)𝑋2 (𝑘)] … (4.10)
Where ∗ denote circular convolution, and 𝑥1 [𝑛], 𝑥2 [𝑛]and 𝑥3 [𝑛] are finite
sequence of equal length.
Further more 𝑋3 (𝑘) = 𝑋1 (𝑘)𝑋2 (𝑘) … (4.11)
Where 𝑋3 (𝑘) = 𝐹𝐷 [𝑥3 [𝑛]] … (4.12)
(b) Frequency Convolution
1
𝑋1 (𝑘) ∗ 𝑋2 (𝑘) = 𝐹𝐷 [𝑥1 [𝑛]𝑥2 [𝑛]] …. (4.13)
𝑁

Where 𝑋1 (𝑘) ∗ 𝑋2 (𝑘) = ∑𝑁−1


𝑚=0 𝑋1 (𝑚)𝑋2 (𝑘 − 𝑚) …. (4.14)

6
Lect. 4, Asst. Prof. Dr. Hadi T. Ziboon, Department of Electrical Eng. U.O.T

4.4 Computational complexity of the DFT

- A large number of the multiplication and addition are required for the
calculation of the DFT.
- For an 8 point DFT the expansion for X(kΩ) becomes
𝑋(𝑘𝛺) = ∑7𝑛=0 𝑥[𝑛] 𝑒 −𝑗2𝜋𝑛𝑘/8 where k=0,1,2,…,7
2𝜋𝑘 2𝜋𝑘 2𝜋𝑘 2𝜋𝑘
𝑋(𝑘𝛺) = 𝑥[0]𝑒 −𝑗 8
0
+ 𝑥[1]𝑒 −𝑗 8
1
+ 𝑥[2]𝑒 −𝑗 8
2
+ 𝑥[3]𝑒 −𝑗 8
3

2𝜋𝑘 2𝜋𝑘 2𝜋𝑘 2𝜋𝑘


+𝑥[4]𝑒 −𝑗 8
4
+ 𝑥[5]𝑒 −𝑗 8
5
+ 𝑥[6]𝑒 −𝑗 8
6
+ 𝑥[7]𝑒 −𝑗 8
7

Eq(4.15) contains eight terms on the right hand side. Each term consists
(8) complex multiplications and seven complex addition to be calculated.
For an 8 point DFT required 82 = 64 complex multiplication

8 × 7 = 56 complex addition

For 1024 point DFT required (1024)2 complex multiplication and


1024 × 1023 addition.

- Thus amount computation involved may be reduced if we note that


there is amount of redundancy in computation of eq(4.15) due to the
rotation factor.
For e.x if 𝑘 = 1 𝑎𝑛𝑑 𝑛 = 2 𝑒 −𝑗𝑘2𝜋𝑛/8 = 𝑒 −𝑗𝜋/2
if 𝑘 = 2 𝑎𝑛𝑑 𝑛 = 1 𝑒 −𝑗𝑘2𝜋𝑛/8 = 𝑒 −𝑗𝜋/2
- The computation requirements of the DFT, in order to reduce the
amount computation, a fast algorithm for computation of the DFT.
These algorithms are known as Fast Fourier Transform (FFT).
- The basic strategy that is used in the FFT algorithm is one of
divide and conquers which involves decomposing N-point DFT
into successively smaller DFT's.

7
Lect. 4, Asst. Prof. Dr. Hadi T. Ziboon, Department of Electrical Eng. U.O.T

The N-point DFT of an N-point sequence x[n] requires 𝑁 2 complex


multiplication and complex addition [N(N-1) complex addition exactly].

- If x[n] is decimated (divide) into two sequences of length (N/2),


computing the 𝑁/2 point DFT requires (N/2)2 multiplication and the
same number of addition. Thus the two DFT's required
1
2(N/2)2 = 𝑁 2 multiplication and add. Thus, it is possible to fined
2

the N-point DFT of x[n] from these two N/2 point DFT with
1
reduction of the number of multiplies and add by factor 𝑁 2 .
2

- The equation (4.3) will be written


2𝜋
−𝑗 𝑘𝑛 𝑘𝑛
𝑋(𝑘𝛺) ∑𝑁−1
𝑛=0 𝑥 [𝑛] 𝑒 𝑁 = ∑𝑁−1
𝑛=0 𝑥[𝑛] 𝑊𝑁 … (4.15)

2𝜋
Where 𝑊𝑁 = 𝑒 −𝑗 𝑁 is called twiddle factor, k=0,1,2, …. ,N-1

𝑗2𝜋
2𝜋 2 2𝜋2 − 𝑁
−𝑗 𝑁 −𝑗 𝑁
𝑊𝑁2 = �𝑒 � =𝑒 =𝑒 2 = 𝑊𝑁
2

𝑁 2𝜋 𝑁
𝑁/2
𝑊 (𝑘+ 2 ) = 𝑊𝑁𝑘 𝑊𝑁 = 𝑊𝑁𝑘 𝑒 −𝑗( 𝑁 )( 2 )

= 𝑊𝑁𝑘 𝑒 −𝑗𝜋 = −𝑊𝑁𝑘

Summarizing the useful results concerning𝑊𝑁 :-

2𝜋
𝑊𝑁 = 𝑒 −𝑗 𝑁 … (4.16a)

𝑊𝑁2 = 𝑊𝑁/2 …. (4.16b)

𝑁
(𝑘+ 2 )
𝑊𝑁 = −𝑊𝑁𝑘 …. (4.16c)

8
Lect. 4, Asst. Prof. Dr. Hadi T. Ziboon, Department of Electrical Eng. U.O.T

4.5 Decimation in Time FFT

The decimation in time FFT algorithm is based on splitting (decimating)


x[n] into smaller sequence and finding X(k) from the DFT's of these
decimated sequences. Let x[n] be a sequence of length N=2𝑃 (i.e Radix -
2) and suppose that x[n] is split (decimated) into two subsequence each of
length (N/2) as shown in fig (4.1), the first sequence, is found from the
even index terms
𝑁
𝑔[𝑛] = 𝑥[2𝑛] 𝑛 = 0. 1. 2. … . −1
2
an the second sequence, h[n] is formed from, the odd index
𝑁
ℎ[𝑛] = 𝑥[2𝑛 + 1] 𝑛 = 0.1.2. … . −1
2
In terms of these sequence the N-point DFT of x[n] is
𝑁−1

𝑋(𝑘) = � 𝑥[𝑛] 𝑊𝑁𝑛𝑘 𝑤ℎ𝑒𝑟𝑒 𝑊 = 𝑒 −𝑗2𝜋/𝑁


𝑛=0

x[n] fig(4.1)

x[2] x[4] x[7]

x[0] 1 x[3] x[5] 6

-2 -1 0 x[1] 2 3 4 5 x[6] 7 k

𝑋(𝑘) = ∑𝑛 𝑒𝑣𝑒𝑛 𝑥[𝑛] 𝑊𝑁𝑛𝑘 + ∑𝑛 𝑜𝑑𝑑 𝑥[𝑛] 𝑊𝑁𝑛𝑘 …. (4.17a)


𝑁 𝑁
−1 −1 (2𝑙+1)𝑘
𝑋(𝑘) = ∑𝑙=0 𝑔(𝑙) 𝑊𝑁2𝑙𝑘
2
+ ∑𝑙=0 ℎ(𝑙) 𝑊𝑁
2
…. (4.17b)
𝑗2𝜋 𝑗2𝜋
(1𝑙)𝑘 −� �2𝑙𝑘 −� �𝑙𝑘 𝑙𝑘
Because 𝑊𝑁2𝑙𝑘 = 𝑊𝑁/2 =𝑒 𝑁 =𝑒 𝑁/2 = 𝑊𝑁/2
𝑁 𝑁
−1 𝑙𝑘 −1 𝑙𝑘
∴ 𝑋(𝑘) = ∑𝑙=0 𝑔(𝑙) 𝑊𝑁/2
2
+ 𝑊𝑁𝑘 ∑𝑙=0 ℎ(𝑙) 𝑊𝑁/2
2
… (4.18)
Note that the first term is the N/2 point DFT of g(n) and the second is the N/2 point
DFT of h(n)
𝑗2𝜋
(2𝑙+1)𝑘 𝑙𝑘 � �𝑘 𝑙𝑘
𝑊𝑁 = 𝑊𝑁2𝑙 𝑊𝑁𝑘 = 𝑊𝑁/2 𝑒 𝑁 = 𝑊𝑁/2 𝑊𝑁𝑘

∴ 𝑋(𝑘) = 𝐺(𝑘) + 𝑊𝑁𝑘 𝐻(𝑘) … (4.19)


9
Lect. 4, Asst. Prof. Dr. Hadi T. Ziboon, Department of Electrical Eng. U.O.T

Although the N/2 point DFT's of g[n] and h[n] are sequences of length
N/2, the periodicity of the complex exponentials allows us to write:-
𝑁 𝑁
𝐺(𝑘) = 𝐺(𝑘 + ) …. (4.20a) 𝐻(𝑘) = 𝐻(𝑘 + ) … (4.20b)
2 2

Therefore, X(k) may be computed from the N/2 point DFT's G(k) and
H(k) because
𝑘+𝑁/2 𝑁/2
𝑊𝑁 = 𝑊𝑁𝑘 𝑊𝑁 = −𝑊𝑁𝑘 … (4.21a)
𝑁
𝑘+ 𝑁
𝑊𝑁 2
𝐻 �𝑘 + � = −𝑊𝑁𝑘 𝐻(𝑘) …. (4.21b)
2

Fig(4.2) shows the block diagram of the computations that are necessary
for the first stage of 8 point DIT-FFT.
Using Eq(4.19) and eq(4.20) to draw fig (4.2) where G(k)=DFT of g(𝑙)
𝑋(𝑘) = 𝐺(𝑘) + 𝑊𝑁𝑘 𝐻(𝑘) … (4.19) H(k)=DFTof h(𝑙)
Fig(4.2)
x(0) X(0)
4-point
x(2) X(1)
DFT
x(4) X(2)

x(6) X(3)

x(1) X(4)
4-point
x(3) DFT X(5)

x(5) X(6)

x(7) X(7)

2) If N/2 is even g[n] and h[n] may again be decimated.


For example G(k) may be evaluated as follows
𝑁 𝑁 𝑁
−1 𝑛𝑘 −1 𝑛𝑘 𝑛𝑘−1
𝐺(𝑘) = ∑𝑛=0
4
𝑔[𝑛] 𝑊𝑁/2 = ∑𝑛=𝑒𝑣𝑒𝑛
4
𝑔[𝑛] 𝑊𝑁/2 + ∑𝑛=𝑜𝑑𝑑
4
𝑔[𝑛] 𝑊𝑁/2 … (4.22)
As before G(k) can be simplified to
𝑁 𝑁
−1 𝑛𝑘 𝑘 −1 𝑛𝑘
𝐺(𝑘) = ∑𝑛=0 𝑔[2𝑛] 𝑊𝑁/4
4
+ 𝑊𝑁/2 ∑𝑛=0
4
𝑔[2𝑛 + 1] 𝑊𝑁/4 ….. (4.23)

10
Lect. 4, Asst. Prof. Dr. Hadi T. Ziboon, Department of Electrical Eng. U.O.T

𝑁 𝑁
−1 𝑛𝑘 𝑘 −1 𝑛𝑘
𝐺(𝑘) = ∑𝑛=0 𝑔[2𝑛] 𝑊𝑁/4
4
+ 𝑊𝑁/2 ∑𝑛=0
4
𝑔[2𝑛 + 1] 𝑊𝑁/4 ….. (4.23)

Where the first term is the N/4 point DFT of the even samples of g[n] and
the second term is the N/4 point DFT of the odd sample

Fig (4.3) shows the decimation of 4 point DFT into two point DFT's in
the decimation in time FFT.

3) If N is a power of 2 (Radix-2), the decimation may be continued until


there are only two point DFT's of form shown in fig(4.4)

Fig(4.3)
x(0) 2 point G(0)
x(4) DFT G(1)
x(2) 2 point
G(2)
x(6) DFT
G(3)

Fig(4.4)
q[0] Q(0)=q(0)+q(1)
q[1] Q(0)=q(0)-q(1)
- The basic computational unit of the FFT, shown in fig(4.5a) is called
butterfly. This structure may be simplified by factoring out a term 𝑊𝑁𝑟
from the lower branch as shown in fig (4.5b). the factor remain is
𝑁/2
𝑊𝑁 = −1.
Fig(4.5)

𝑟+𝑁/2
𝑊𝑁 𝑊𝑁𝑟 -1
a) The butterfly which is the basic computational element of the FFT
algorithm.
b) A simplified butterfly, with only one complex multiplication.

11
Lect. 4, Asst. Prof. Dr. Hadi T. Ziboon, Department of Electrical Eng. U.O.T

Computing an N-point DFT using a radix-2 decimation in time FFT is


much more efficient then calculating the DFT directly. For example if
𝑁 = 2𝑃 , there are log 2 𝑁 = 𝑃 stages of computation. Because each
requires N/2 complex multiplication by the twiddle factors 𝑊𝑁𝑟 and N
1
complex addition, these are a total of 𝑁𝑙𝑜𝑔2 𝑁 complex multiplications
2

and 𝑁𝑙𝑜𝑔2 𝑁 complex addition. Thus big saving in time for execution the
DFT by using FFT.
A Complete 8-point radix-2 decimation in time FFT is shown in fig (4.6)

4.6 Data Shuffling and Bit Reversal


- In the decimination in time FFT, the order for the output sequence be
in natural order [i.e X(k), k=0,1,2,…., N-1], the input sequence to
store in a shuffled order.
- The required order of the input sequence was x[0], x[1], x[2], x[3],
x[4], x[5], x[6] and x[7].
- Table 2.2 shows in the first column the required ordering of the data
for input. Each value is assumed to be stored in a binary memory
address. These addresses are given in the second column. The third
column shows these memory addresses bit reversed. The fourth
column shows the original sequence.
Required Binary addresses Bit-reversal Original data
sequence for required sequence addresses sequence
butterfly
𝑥0 000 000 𝑥0
𝑥4 100 001 𝑥1
𝑥2 010 010 𝑥2
𝑥6 110 011 𝑥3
𝑥1 001 100 𝑥4
𝑥5 101 101 𝑥5
𝑥3 011 110 𝑥6
𝑥7 111 111 𝑥7

12
Lect. 4, Asst. Prof. Dr. Hadi T. Ziboon, Department of Electrical Eng. U.O.T

Pass1 pass2 G1 pass3


x[0] X(0)

W80 𝐺2
x[4] X(1)
-1
G3
x[2] X(2)

W80 𝐺4
x[6] X(3)
-1
W80
x[1] X(4)
-1 H0 -1
W80 W81
x[5] X(5)
-1 -1 H1 -1
W82
x[3] X(6)
-1 H2 -1
W80 W83
x[7] X(7)
-1 -1 H3 -1
fig (4.6) A complete eight point radix-2 decimation in time FFT
4.7 Decimation in Frequency FFT
Another class of FFT algorithms may be derived by decimating the output sequence
X(k) into smaller and smaller subsequences. These algorithm are called decimation in

13
Lect. 4, Asst. Prof. Dr. Hadi T. Ziboon, Department of Electrical Eng. U.O.T

frequency FFT may be derives as follows: Let N be a power of 2(Radix2)N=2𝑃 and


consider separately evaluating the even and odd index samples of X(k).
The even samples are
2𝑛𝑘
𝑋(2𝑘) = ∑𝑁−1
𝑛=0 𝑥[𝑛] 𝑊𝑁 … (4.24)
Separating this sum into the first N/2 points and the last N/2 points
𝑁/2−1 𝑛𝑘 𝑛𝑘
𝑋(2𝑘) = ∑𝑛=0 𝑥[𝑛] 𝑊𝑁/2 + ∑𝑁
𝑁/2−1 𝑥[𝑛] 𝑊𝑁/2 … (4.25)
𝑛𝑘
Because 𝑊𝑁2𝑛𝑘 = −𝑊𝑁/2
With a change in the indexing on the second sum we have
𝑁
𝑁/2−1 𝑛𝑘 𝑁 (𝑛+ )𝑘
𝑋(2𝑘) = ∑𝑛=0 𝑥[𝑛] 𝑊𝑁/2 + ∑𝑁
𝑁/2−1 𝑥[𝑛 + 2 ] 𝑊𝑁/2
2

𝑁
(𝑛+ )𝑘 𝑛𝑘
Finally because 𝑊𝑁/2 2
= −𝑊𝑁/2
𝑁/2−1 𝑁𝑛𝑘
∴ 𝑋(2𝑘 + 1) = ∑𝑛=0 [𝑥[𝑛] − 𝑥 �𝑛 + 2 �] 𝑊𝑁/2 … (4.26)

Which is the N/2 point DFT of the sequence that is formed by adding the first N/2
points of x[n] to the last N/2.
Using the same procedure for the odd sample of X(k) we have
𝑁/2−1 𝑛𝑘 𝑁
𝑋(2𝑘 + 1) = ∑𝑛=0 𝑊𝑁𝑛 [𝑥[𝑛] − 𝑥 �𝑛 + 2 �]𝑊𝑁/2 … (4.27)

Fig (4.7) an eight point decimation in frequency FFT of the first stage
x[0] X(0)

x[1] 4-point X(2)

x[2] DFT X(4)

x[3] X(6)
W80
x[4] X(1)
-1 W81
x[5]
4-point X(3)
-1 W82
x[6] DFT X(5)
-1 W83
x[7] X(7)
-1

14
Lect. 4, Asst. Prof. Dr. Hadi T. Ziboon, Department of Electrical Eng. U.O.T

Ex.4.4 Calculate the FFT of the data sequence (1,0,0,1) and plot the
amplitude and phase spectra if the decimation in time is used.
Solution fig(4.4) Flow graph of the FFT
x[0] G(0) X(0)

x[2] W20 G(1) X(1)

x[1] H(0) W40 X(2)


W20 W41
x[3] H(1) X(3)
The flow graph of the FFT is given in fig (4.4)
𝑋(0) = 𝐺(0) + 𝑊40 𝐻(0) = 𝐺(0) + 𝐻(0)
𝐺(0) = 𝑥(0) + 𝑊20 𝑥(2) = 𝑥[0] + 𝑥[2]
𝐻(0) = 𝑥(1) + 𝑊20 𝑥(3) = 𝑥[1] + 𝑥[3]
Since 𝑊𝑁0 = 1 substituting values gives
∴ 𝑋(0) = 𝑥[0] + 𝑥[1] + 𝑥[2] + 𝑥[3] = 1 + 0 + 0 + 1 = 2
𝑋(1) = 𝐺(1) + 𝑊41 𝐻(1)
𝐺1 (1) = 𝑥(0) − 𝑊20 𝑥(2) = 𝑥[0] − 𝑥[2]
𝐻1 (1) = 𝑥(1) − 𝑊20 𝑥(3) = 𝑥[1] − 𝑥[3]
Since 𝑊41 = 𝑒 −𝑗2𝜋/4 = 𝑒 −𝑗𝜋/2
𝑗𝜋
X(1) = x[0] − x[2] + 𝑒 − 2 �𝑥[1] − 𝑥[3]�
𝜋 𝜋
= 1 − 0 + �cos − 𝑗 sin � [0 − 1]
2 2
∴ 𝑋(1) = 1 − 0 + [0 − 𝑗][−1] = 1 + 𝑗
𝑋(2) = 𝐺(0) − 𝑤40 𝐻(0) = 𝐺(0) − 𝐻(0)
∴ 𝑋(2) = 𝑥[0] + 𝑥[2] − �𝑥[1] + 𝑥[3]� = 1 + 0 − 0 − 1 = 0
𝑗𝜋
𝑋(3) = 𝐺(1) − 𝑤41 𝐻(1) = x[0] − x[2] − 𝑒 − 2 �𝑥[1] − 𝑥[3]�
𝜋 𝜋
𝑋(3) = 1 − 0 − �cos + 𝑗 sin � [0 − 1] = 1 − 𝑗
2 2
15
Lect. 4, Asst. Prof. Dr. Hadi T. Ziboon, Department of Electrical Eng. U.O.T

Ex.4.4 Calculate the FFT of the data sequence (1.5,1,1,0.5) and plot the
amplitude and phase spectra if the decimation in time is used.
Solution Flow graph of the FFT
x[0] G(0) X(0)

x[2] 𝑊20 G(1) X(1)

x[1] H(0) W40 X(2)


W20 Type equation here . W41
x[3] 𝑊20 H(1) X(3)
𝑋(0) = 𝐺 (0) + 𝑊40 𝐻(0) = 𝐺 (0) + 𝐻(0)
𝐺 (0) = 𝑥(0) + 𝑊20 𝑥(2) = 𝑥 [0] + 𝑥[2]
𝐻 (0) = 𝑥(1) + 𝑊20 𝑥(3) = 𝑥 [1] + 𝑥[3]
Since 𝑊𝑁0 = 1 substituting values gives
∴ 𝑋(0) = 𝑥[0] + 𝑥[1] + 𝑥[2] + 𝑥[3] = 0.5 + 1 + 1 + 0.5 = 3
𝑋(1) = 𝐺 (1) + 𝑊41 𝐻(1)
𝐺1 (1) = 𝑥[0] − 𝑊20 𝑥[2] = 𝑥[0] − 𝑥[2]
𝐻1 (1) = 𝑥(1) − 𝑊20 𝑥(3) = 𝑥 [1] − 𝑥[3]
Since 𝑊41 = 𝑒 −𝑗2𝜋/4 = 𝑒 −𝑗𝜋/2
𝑗𝜋
X(1) = x[0] − x[2] + 𝑒 − 2 �𝑥[1] − 𝑥[3]�
𝜋 𝜋
= 0.5 − 1 + �cos − 𝑗 sin � [1 − 0.5]
2 2
∴ 𝑋(1) = 0.5 − 1 + [0 − 𝑗][0.5] = −0.5 − 𝑗0.5
Using the same steps to fined
𝑋(2) = 0
𝑋(3) = −0.5 + 𝑗0.5
Ex 4.6 Find the relationship between DFT and Fourier Transform.

16
University of Technology
Department of Electrical Engineering

Lect5

A framework for digital filter design

Asst. Prof. Dr. Hadi T. Ziboon


Lect. 5, Asst. Prof. Dr. Hadi T. Ziboon, Department of Electrical Eng. U.O.T

A framework for digital filter design


- The framework provided to the designer valuable information from
specifications to implementation.
5.1 Structures for the Realization of Linear Time Invariant (LTI) System.
- Let us consider the first order system is given by
𝑦[𝑛] = −𝑎1 𝑦[𝑛 − 1] + 𝑏0 𝑥[𝑛] + 𝑏1 𝑥[𝑛 − 1] … (5.1)
Which is realized as in fig (5.1a).
- This realization uses separate delays (memory) for both the input and
output signals samples and it is called a direct form I structure.
- This system can be viewed as two LTI systems in cascade. The first is
nonrecursive system described by
𝑣[𝑛] = 𝑏0 𝑥[𝑛] + 𝑏1 𝑥[𝑛 − 1] … (5.2)
- The second is a recursive system described by
𝑦[𝑛] = −𝑎1 𝑦[𝑛 − 1] + 𝑣[𝑛] … (5.3)
Fig (5.1)
x[n] 𝑏0 v[n] y[n] x[n] w[n] 𝑏0 y[n]
+ + + +

𝒛 𝒛 𝒛 𝒛
𝑏1 −𝑎1 −𝑎1 𝑏1
(a) (b)

x[n] w[n] 𝑏0 y[n]


+ +

−𝑎1 w(n-1) 𝑏1 (c)

- As we have seen the main properties of the LTI system are the
association and commutation as shown in fig (5.2).
x[n] y[n] h[n] y[n] x[n] x[n] y[n]
h[n] x[n] ℎ1 [n] ℎ2 [n] ℎ
y[n]
commutation association
- If we interchange the order of the cascaded LTI system, the overall
response remains the same due to the association property. Thus of
we change the order of the recursive and nonrecursive system, we
obtain another structure.

1
Lect. 5, Asst. Prof. Dr. Hadi T. Ziboon, Department of Electrical Eng. U.O.T

For the realization of the system described by(5.1). The resulting system
is shown in fig (5.1b). From this figure we obtained the two difference
equations.

𝑤[𝑛] = −𝑎1 𝑤[𝑛 − 1] + 𝑥[𝑛] … (5.4)

𝑦[𝑛] = 𝑏0 𝑤[𝑛] + 𝑏1 𝑤[𝑛 − 1] … (5.5)

- Thus the two difference eq(5.4) and (5.5) are equivalent to single
difference equation (5.1).
- Thus new realization shown in fig (5.1c) required only one delay for
w[n] and hence it is more efficient in terms of memory requirements.
It is called the direct from II structure.
- These structures can be generalized for the general LTI recursive
system described by the difference equation
𝑦[𝑛] = − ∑𝑁 𝑀
𝑘=1 𝑎𝑘 𝑦[𝑛 − 𝑘 ] + ∑𝑘=0 𝑏𝑘 𝑥[𝑛 − 𝑘]… (5.6)
- Fig (5.2) shows the direct form I structure for this system. This
structure requires M+N delays and N+M+1 multiplication.
- Using the previous steps to define the nonrecursive system by

𝑣[𝑛] = ∑𝑀
𝑘=0 𝑏𝑘 𝑥[𝑛 − 𝑘] … (5.7)

And a recursive system

𝑦[𝑛] = − ∑𝑁
𝑘=1 𝑎𝑘 𝑦[𝑛 − 𝑘 ] + 𝑣[𝑛] … (5.8)

2
Lect. 5, Asst. Prof. Dr. Hadi T. Ziboon, Department of Electrical Eng. U.O.T

By reversing the order of these two systems, as was previously done for
the first order system, we obtain the direct form II structure shown in fig
(5.3). This structure is the cascade of a recursive system

𝑤[𝑛] = − ∑𝑁
𝑘=1 𝑎𝑘 𝑤(𝑛 − 𝑘) + 𝑥[𝑛] … (5.9)

For nonrecursive system

𝑦[𝑛] = ∑𝑀
𝑘=0 𝑏𝑘 𝑤(𝑛 − 𝑘) … (5.10)

x[n] 𝑏0 v[n] y[n] x[n] w[n] 𝑏0 y[n]


+ + + +

𝒛 𝒛 𝒛
+ + + +
𝑏1 −𝑎1 −𝑎1 𝑤𝑛−1 𝑏1

𝑏𝑀−1 −𝑎𝑁−1 −𝑎𝑁−1 𝑏𝑀−1


+ +
+ +
𝑤𝑛−𝑀−1
𝒛 𝒛
𝑏𝑀 −𝑎𝑁
𝒛
−𝑎𝑁 𝑤0 𝑏𝑀

Fig (5.2) Direct form I structure of Fig(5.3) Direct form II structure of


the system the system
- We observe that if 𝑁 ≥ 𝑀, this structure requires a number of delays
equal to the order N of the system. However if M > N, the required
memory is specified by M.

3
Lect. 5, Asst. Prof. Dr. Hadi T. Ziboon, Department of Electrical Eng. U.O.T

- Linear time- invariant systems described by a second order difference


equation are an important subclass of the more general systems
described by eq(5.6)
𝑦[𝑛] = − ∑𝑁 𝑀
𝑘=1 𝑎𝑘 𝑦[𝑛 − 𝑘] + ∑𝑘=0 𝑏𝑘 𝑥[𝑛 − 𝑘] … (5.6)
- The second order systems are usually used as basic building blooks
for realizing higher order systems.
- The most general second order system is described by the difference
equation, with N=M=2, eq[5.6] becomes
𝑦[𝑛] = −𝑎1 𝑦[𝑛 − 1] − 𝑎2 𝑦[𝑛 − 2] + 𝑏0 𝑥[𝑛] + 𝑏1 𝑥[𝑛 − 1] +
𝑏2 𝑥[𝑛 − 2] …. (5.11)
- The direct form II structure for realizing this system is shown in fig
(5.4a). If we set 𝑎1 = 𝑎2 = 0 then reduced to
𝑦[𝑛] = 𝑏0 𝑥[𝑛] + 𝑏1 𝑥[𝑛 − 1] + 𝑏2 𝑥[𝑛 − 2] …. (5.12)
Eq(5.12) represents special case of FIR system.
- If we set 𝑏1 = 𝑏2 = 0 , we obtain purely recursive second order
system described by difference equation
𝑦[𝑛] = −𝑎1 𝑦[𝑛 − 1] − 𝑎2 𝑦[𝑛 − 2] + 𝑏0 𝑥[𝑛] …. (5.13)
- Eq (5.12) and (5.13) are shown in fig (5.4b) and fig (5.4c).

x[n] x[n] w 𝑏0 y[n]


𝒛 𝒛 + +
𝒛
𝑏0 𝑏1 b2 y[n] −𝑎1 𝑏1
+ + + +

(b) 𝒛

x[n] 𝑏0 y[n] −𝑎2 𝑏2


+ +
(a)
−𝑎2 −𝑎1

𝒛 𝒛
(c)
Fig (5.4) structure for the realization of second order systems for
(a) General second order
(b) FIR system
(c) Purely recursive system

4
Lect. 5, Asst. Prof. Dr. Hadi T. Ziboon, Department of Electrical Eng. U.O.T

The notation that is used for these elements [adders, multipliers and
delay] which are used to implement the digital network as shown in
fig(5.5). A network is also represented by a signal flowgraph, which is a
network of directed branches that are connected at nodes. Each branch
has an input and output with direction indicated by an arrowhead. The
nodes in a flowgraph correspond to either adders or branch points.
Finally, there are two special type of nodes:-
1) Source nodes: These are nodes that have no incoming branches and
are used for sequences that are input to the filter.
2) Sink nodes: These are nodes that have only entering branches and are
used to represent output sequence.
Fig (5.5)

x[n] x[n]+w[n] x[n] a ax[n] x[n] x[n-k]


+
w[n] (b) Multiplier (c) A unit delay

(a) Adder Node j Node k

𝑥𝑗 [𝑛] 𝑥𝑘 [𝑛]
(d) Signal flowgraph consisting of nodes, branches, and node variable.
Node j represents adder and Node k is a branch node.

Ex 5.1 Draw the block diagram and signal flowgraph for the first order
discrete system described by the difference equation

𝑦[𝑛] = 𝑏0 𝑥[𝑛] + 𝑏1 𝑥[𝑛 − 1] + 𝑎1 𝑦[𝑛 − 1]

Solution

x[n] 𝑏0 y[n] x[n] 𝑏0 y[n]


+ +

𝑧 −1
𝑧

−𝑎1 𝑏1
−𝑎1 𝑏1
Block diagram
Using the same procedure in fig (5.1)

5
Lect. 5, Asst. Prof. Dr. Hadi T. Ziboon, Department of Electrical Eng. U.O.T

5.2 Introduction to digital filter


- A filter is essentially a system or network that selectively changes the
wave shape, amplitude and or phase-frequency characteristics of
a signal in a desired manner.
- Common filtering objectives are to improve the quality of a signal ….
(to remove or reduce noise), to extract information from signals or to
separate two or more signals previously combined to make, for
example, efficient use of an a available communication channel.
- A digital filter is a mathematical algorithm implemented in hardware
and /or software that operate on a digital input signal to produce a
digital output signal of achieving a filter objective.
- A simplified block diagram of a real time digital filter with analogue
input and output signals is shown in fig (5.6).
Fig (5.6)
input x[n] y[n] y(t)
Input ADC Digital DAC Output
filter process
x(t) filter
Analogue input Analogue o/p
Advantage of Digital filters:-
1) Digital filter have truly linear phase response.
2) The performance of digital filter does not vary with environment
(thermal variation)
3) The frequency response of a digital filtered can be adjusted if it is
implemented using a programmable processor.
4) Several input signals or channels can be filtered by one digital filter
without the need to change the hardware.
5) Both filtered and unfiltered data can be saved for further use.
6) High precision achieved by digital filter and depend on word length.
7) The performance of digital filter is repeatable from unit to unit.
8) Digital filter is very wide also can be used for low frequency.

6
Lect. 5, Asst. Prof. Dr. Hadi T. Ziboon, Department of Electrical Eng. U.O.T

Limitation of digital filter

1) Speed limitation: The maximum bandwidth of signals that digital filters


can handle, in real time, is much lower than for analogue filters. The
conversion time of ADC and the settling time of DAC and the speed of
the digital processor are the main reasons of the speed limitation.
2) Finite word length effects. Digital filters are subject to ADC noise
resulting from quantizing continuous signal.
3) Long design and development time are required to develop the hardware
and software of the digital filters.
5.2 Type of digital filter: FIR and IIR
- Digital filters are broadly divided into two classes:-
1) Infinite impulse response (IIR)
2) Finite impulse response (FIR)
- Either type of filter can be represented by its impulse response
sequence, h(k) (k=0, 1, 2, …) as shown in fig (5.7).
- The input and output signals to the filter are related by the convolution
sum
𝑦[𝑛] = ∑∞
𝑘=0 ℎ(𝑘) 𝑥(𝑛 − 𝑘) …. (5.14) for IIR
𝑦[𝑛] = ∑𝑁−1
𝑘=0 ℎ(𝑘) 𝑥(𝑛 − 𝑘) …. (5.15) for FIR

Fig (5.7)
h(k), k=0,1,2
x[n] y[n]
Impulse response
- For IIR filters, the impulse response is finite duration whereas for FIR
it is of finite duration, since h(k) for FIR has only N values. In practice
it is not feasible to compute the output of the IIR filter using Equation
(5.14) because the length of its impulse response to long (infinite in
theory). Instead, the IIR filtering eq(5,14) is expressed in a recursive
form.

7
Lect. 5, Asst. Prof. Dr. Hadi T. Ziboon, Department of Electrical Eng. U.O.T

𝑦[𝑛] = � ℎ(𝑘) 𝑥(𝑛 − 𝑘)


𝑘=0

= ∑𝑁 𝑀
𝑘=0 𝑎𝑘 𝑥[𝑛 − 𝑘] − ∑𝑘=1 𝑏𝑘 𝑦[𝑛 − 𝑘] … (5.16)

Where 𝑎𝑘 and 𝑏𝑘 are the coefficients of the filter.


- Alternative representations for the FIR and IIR filters are given in
equation (5.17a) and (5.17b). These are the transfer functions for these
filters are very useful in evaluating their frequency responses
𝐻(𝑘) = ∑𝑁−1
𝑘=0 ℎ(𝑘) 𝑧
−𝑘
… (5.17a) FIR
∑𝑁
𝑘=0 𝑎𝑘 𝑧
−𝑘
𝐻(𝑧) = … (5.17b) IIR
1+∑𝑀
𝑘=0 𝑏𝑘 𝑧
−𝑘

5.3 Choosing between FIR and IIR

The choice between FIR and IIR filters depends on the relative advantages
of the two filters

1) FIR has linear phase response and this is important for data transition,
biomedicine, digital audio and image processing. However, the phase
responses of IIR filters are nonlinear.
2) FIR filters realized nonrecursively are always stable. The stability of
IIR cannot always be guranted, since IIR filters realized recursively.
3) FIR requires more coefficients for sharp cutoff than IIR. Thus for a
given amplitude response specification, more processing time and
storage will be required for FIR implantation.
4) Analogue filters can be readily transformed into equivalent IIR digital
filters meeting similar specifications. This is not possible with FIR
filters as they have no analogue counterpart. However, with FIR it is
easier to synthesize filters of arbitrary frequency responses.

8
Lect. 5, Asst. Prof. Dr. Hadi T. Ziboon, Department of Electrical Eng. U.O.T

5) In general, FIR is algebraically more difficult to synthesize, if CAD


support is not available.
- From the above, a broad guideline on when to use FIR and IIR would
be as follows:-
a) Use IIR when the only important requirements are sharp cutoff
filters and high through put.
b) Use FIR, if number of filter coefficients is not too large and if little
or no phase distortion is desired.

Note Newer DSP processors have architectures that are tailored to FIR
filtering, and some are designed specifically for FIR.

Ex.5.2 The following difference equations represent two different


filters

1) 𝑦[𝑛] = −𝑎1 𝑦[𝑛 − 1] − 𝑎2 𝑦[𝑛 − 2] + 𝑏0 𝑥[𝑛] + 𝑏1 𝑥[𝑛 − 1] +


𝑏2 𝑥[𝑛 − 2]

2) 𝑦[𝑛] = ∑11
𝑘=0 𝑎𝑘 𝑥[𝑛 − 𝑘]

For each filters:-

a) State whether it is an FIR or IIR filter


b) Draw the block diagram
c) Determine and discus the computational and storage requirements.
Solution
To draw the block diagram for filter using the same procedure of
the second order system (draw the difference equation and
simplify the system based on eq(5.9), (5.10) and (5.11).

9
Lect. 5, Asst. Prof. Dr. Hadi T. Ziboon, Department of Electrical Eng. U.O.T

The corresponding set of difference equations for M=N=2


𝑤[𝑛] = 𝑥[𝑛] − 𝑎1 𝑤[𝑛 − 1] − 𝑎2 𝑤[𝑛 − 2] … (5.9)
𝑦[𝑛] = 𝑏0 𝑤[𝑛] + 𝑏1 𝑤[𝑛 − 1] + 𝑏2 𝑤[𝑛 − 2] … (5.10)
y[n]=-a 1 y[n-1]-a 2 y[n-2]+b 0 [x]+b 1 x[n-1]+b 2 x[n-2] … (5.11)
Note: see fig(5.1), fig(5.4a)
x[n] w[n] 𝑏0 y[n]
+ +

𝑧
−𝑎1 𝑏1 (1) (IIR)
+ +

𝑧
−𝑎2 𝑏2

x[n] x[n-1] x[n-2] x[n-11]


𝑧 𝑧 𝑧

𝑎0 𝑎1 𝑎2 𝑎11

+
y[n] (2) (FIR)
1) Filters (1) and (2) are IIR and FIR respectively.
2) The block diagrams are shown in figs (1) and (2).
3) From examination of the two difference equations and storage requirements
for both filters are summarized below.
FIR IIR
Number of multiplication 12 5
Number of addition 11 4
Storage locations (coeffients and data) 24 8

It is clear that IIR filter is more economical in both computational and storage
requirements than FIR.

10
Lect. 5, Asst. Prof. Dr. Hadi T. Ziboon, Department of Electrical Eng. U.O.T

5.4 Filter design steps


The design of a digital filter involves five steps:-
1) Specification of the filter requirements.
2) Calculation of suitable filter coefficients.
3) Representation of the filter by suitable structure (realization).
4) Analysis of the effects of finite wordlength on filter performance.
5) Implementation of filter in software and/or hardware.

The five steps are not necessarily, independent, nor are they always
performed in the order given.

1) Specification of the filter requirements:-


a) Signal characteristics (types of signal, I/O, interface, data rates,
highest frequency)
b) Characteristic of the filter (the desired amplitude and/or phase
responses, tolerances, speed of operation).
c) The method of implementation.
- The characteristics of digital filters are often specified in frequency
domain. Fig (5.8) shows frequency response for low pass filter. The
following are the main parameters:- fig (5.8)
H(f)
1 + 𝛿𝑃
1 − 𝛿𝑃

𝛿𝑃 = passband deviation. …
𝛿𝑠 = stopband deviation. F s /2
𝑓𝑃 = passband edge frequency. 𝛿𝑠 𝑓𝑃 𝑓𝑠
𝑓𝑠 = stopband edge frequency. Pass band transition band stopband
f norm
- The edge frequencies are often given in normalized form, that is as
a fraction of the sampling frequency (𝑓/𝐹𝑠 ).
- Passband and stopband deviations may be expressed as ordinary
numbera are in decibels when they specify the passband ripple and
minimum stopband attenuation respectively
𝐴𝑠 (𝑠𝑡𝑜𝑝𝑏𝑎𝑛𝑑 𝑎𝑡𝑡𝑒𝑛𝑢𝑎𝑡𝑖𝑜𝑛) = −20𝑙𝑜𝑔10 𝛿𝑠 …. (5.18a)
𝐴𝑃 (𝑝𝑎𝑠𝑠𝑏𝑎𝑛𝑑 𝑟𝑖𝑝𝑝𝑙𝑒) = 20log (1 + 𝛿𝑃 ) …. (5.18b)

11
Lect. 5, Asst. Prof. Dr. Hadi T. Ziboon, Department of Electrical Eng. U.O.T

Ex 5.3 An FIR bandpass filter is to be designed to meet the following


frequency response specifications:-
passband = 0.18-0.33 (normalized)
Trainsition width = 0.04 (normalized)
Stopband deviation= 0.001
passband deviation= 0.005
1) Sketch the tolerance scheme for the filter
2) Express the filter band edge frequencies in the standard unite of
kilohertz, assuming a sampling frequency of 10kHz and the
stopband and passband deviation in decibels.

Solution (1) The tolerance scheme for the filter is given in fig (5.3)

(2) The band edge frequency at a sampling frequency of 10kHz and the
stopband and passband deviation are given below:-

passband = 1.8-0.33 [10 × 0.18 − 10 × 0.33]


Stopband 0-1.4kHz(0-0.14×10) and 3.7-5kHz [10 × 0.37 − 10 × 0.5]
Stop band attenuation −20𝑙𝑜𝑔10 (0.001) = 60𝑑𝐵
passband ripple =20 log (1+0.05)=0.42 dB
H(f)
1 + 𝛿𝑃
1
1 − 𝛿𝑃
transition width
0.04 0.04 F s/2
𝛿𝑠

0.14 0.18 0.33 0.37 0.5 fnormalized


2. Coefficient calculation
- The coefficient of the digital filters are h(k) for FIR, 𝑎𝑘 𝑎𝑛𝑑𝑏𝑘 for IIR.
- Calculations of IIR filter coefficients are based on the transformation
of known analogue filter characteristics into equivalent digital filters.
The two basic methods are used
(1) The impulse invariant (2) The bilinear transformation

12
Lect. 5, Asst. Prof. Dr. Hadi T. Ziboon, Department of Electrical Eng. U.O.T

3. Representation of a filter by a suitable structure (Realization)

- Realization involves converting a given transfer function H(z) into


a suitable filter structure.
1. For IIR filters, three structures are used:-
(a) Direct form (b) cascade form (c) parallel form
- The direct form is simply a straight forward representation of the IIR
transfer function.
- In the cascade form, the transfer functions of the IIR filter. [Given by
the eq (5.17b)], is factored and expressed as the product of the second
order.
- In the parallel form, H(z) is factored using partial fractions, as the
sum of second order sections.
- Fig (5.4) shows the block diagrams for a fourth order filter (N=4) IIR
filter represented in the direct, cascade and parallel structures with
corresponding the difference equations and transfer functions.
- The parallel and cascade structures are the most widely used for IIR
became they lead to simpler filtering algorithms and are far less
sensitive to the effects of a finite number of bits than the direct
structure.
x[n] y[n]
+ +
𝑎0

𝑧 𝑧
∑4𝑘=0 𝑎𝑘 𝑧 −𝑘
𝑎1 + −𝑏1 H(z)=
+ 1+∑4𝑘=1 𝑏𝑘 𝑧 −𝑘

𝑧 𝑧 𝑦[𝑛] = ∑4𝑘=0 𝑎𝑘 𝑥[𝑛 − 𝑘]


− ∑4𝑘=1 𝑏𝑘 𝑦[𝑛 − 𝑘]
+ +
𝑎2 −𝑏2

𝑧 𝑧

𝑎3 −𝑏3 fig (5.4a) Direct realization


+ +
a fourth order IIR filter

𝑧 𝑧
13
Lect. 5, Asst. Prof. Dr. Hadi T. Ziboon, Department of Electrical Eng. U.O.T

𝑎4 −𝑏4
x[n] 𝑤1 (𝑛) 𝑦1 [𝑛] 𝑤2 (𝑛) y[n]
+ + + +
𝑎01 𝑎02

𝑧 𝑧
+ + + +
−𝑏11 𝑎11 −𝑏12 𝑎12

𝑧 𝑧
−𝑏21 𝑎21 −𝑏22 𝑎22
Fig (5.4b) cascade realization of a fourth order IIR filter
1+𝑎1𝑘 𝑧 −1 +𝑏2𝑘 𝑧 −2
𝐻(𝑧) = 𝐶 ∏2𝑘=1 Transfer function
1+𝑏1𝑘 𝑧 −1+𝑏2𝑘 𝑧 −2
𝑤1 [𝑛] = 𝐶𝑥[𝑛] − 𝑏11 𝑤1 [𝑛] − 𝑏21 𝑤1 [𝑛 − 2] Difference
𝑦1 [𝑛] = 𝑎01 𝑤1 [𝑛] + 𝑎11 𝑤1 [𝑛 − 1] + 𝑎21 𝑤1 [𝑛 − 2] equation
𝑤2 [𝑛] = 𝑦1 [𝑛] − 𝑏12 𝑤1 [𝑛] − 𝑏22 𝑤2 [𝑛 − 2]
𝑦[𝑛] = 𝑎02 𝑤2 [𝑛] + 𝑎12 𝑤2 [𝑛 − 1] + 𝑎22 𝑤2 [𝑛 − 2]
𝑤1 [𝑛] 𝑦1 [𝑛] fig (5.4c) parallel realization
+ +
𝑎01 of a fourth order IIR filter

𝑎0𝑘 +𝑎1𝑘 𝑧 −1
𝑧 𝐻(𝑧) = 𝐶 + ∑2𝑘=1
1+𝑏1𝑘 𝑧 −1 +𝑏2𝑘 𝑧 −2
+ −𝑏11 𝑎11

𝑧
−𝑏21
x[n] 𝑤2 [𝑛] 𝑦2 [𝑛] y[n]
+ + +
𝑎02
𝑤1 [𝑛] = 𝐶𝑥[𝑛] − 𝑏11 𝑤1 [𝑛] − 𝑏21 𝑤1 [𝑛 − 2]
𝑤2 [𝑛] = 𝑦1 [𝑛] − 𝑏12 𝑤1 [𝑛] − 𝑏22 𝑤2 [𝑛 − 2]
𝑧 𝑦1 [𝑛] = 𝑎01 𝑤1 [𝑛] + 𝑎11 𝑤1 [𝑛 − 1]
+ 𝑦2 [𝑛] = 𝑎02 𝑤2 [𝑛] + 𝑎12 𝑤2 [𝑛 − 2]
−𝑏12 𝑎12 𝑦3 [𝑛] = 𝐶𝑥 [𝑛]
𝑧
−𝑏22 𝑦3 [𝑛]
C 𝑦[𝑛] = 𝑦1 [𝑛] + 𝑦2 [𝑛] + 𝑦3 [𝑛]

14
Lect. 5, Asst. Prof. Dr. Hadi T. Ziboon, Department of Electrical Eng. U.O.T

2. For FIR filter three structure are used:-


(1) Direct form (or transversal) (2) Frequency sampling
(3)Fast convolution.
a. For most widely used structure for FIR is the direct form as shown in fig
(5.5a) because it is simple to implement. In this form, the FIR is
sometimes called a tapped delay line as transferal.
Fig (5.5a) Direct (Transversal) realization
x[n]
𝑧 𝑧 𝑧

h[0] h[1] h[2] h[N-1]

+
y[n]
𝑀−1

𝑦[𝑛] = � 𝑏𝑘 𝑥[𝑛 − 𝑘]
𝑘=0
𝑀−1

𝐻(𝑧) = � 𝑏𝑘 𝑧 −𝑘
𝑘=0
b. Frequency-sampling realization is an alternative structure for an
FIR filter in which the parameters that characterize the filter are the
values of the desired frequency response instead of the impulse
response h[n]. To derive the frequency sampling structure, we
specify the desired frequency response at a set of equally spaced
frequencies. This structure required fewer computations
(multiplications and additions) than corresponding direct form Fig
(5.5b) shows this structure.
Fig (5.5b) Frequency Sampling structure
x[n] H(1)
+ +

𝑧 -1 𝑧
+ H(2) y[n]
+

H(N-1)
𝑧
+

15
𝑧
Lect. 5, Asst. Prof. Dr. Hadi T. Ziboon, Department of Electrical Eng. U.O.T

c. Fast convolution realization: The fast convolution realization uses the


computational advantage of the Fast Fourier Transform (FFT) and is
particularly attractive in situations where the power spectrum of the signal
is required. Fig (5.5c) shows the fast convolution.

x[n] Segment input 𝑥𝑖 (𝑛) Obtained 𝑋𝑖 (𝑘) Fig(5.5c) Fast convolution


FFT of
Sequence into each
input blocks blocks
sequence 𝑋𝑖 (𝑘) 𝐻𝑖 (𝑘)
Form
Obtained
output
IFFT of
sequence
𝑋𝑖 (𝑘) 𝐻𝑖 (𝑘) from IFFT
h[n] Obtained
FFT of h[n]
filter coefficient 𝐻𝑖 (𝑘)

d. There are many other practical structures for digital filters, but most of
these are popular only in specific application areas. An example is the
lattice structure which finds use in speech and linear predication
application. The lattice structure may be used to represent FIR and IIR
filters. The basic lattice structure is characterized by a single input and a
pair of output as shown in fig (5.6a). A lattice structure is derived from
the basic structure in fig (5.6a)

𝑦1 [𝑛]
+
x[n] 𝑘1
+
𝑤1 [𝑛]
Fig (5.6a) basic lattice structure.

stage1 𝑦1 [𝑛] stage2 𝑦2 [𝑛]


+ +
x[n]

+ 𝑤1 [𝑛] 𝑧− + 𝑤2 [𝑛]
𝑧−
Fig (5.6b) 2-stage FIR

x[n] stage1 𝑦1 [𝑛] stage2 𝑦[𝑛]


+ +
𝑘2
+ 𝑧− +
16 𝑧−
Lect. 5, Asst. Prof. Dr. Hadi T. Ziboon, Department of Electrical Eng. U.O.T

𝑤2 [𝑛] 𝑤1 [𝑛] 𝑘2 Fig (5.6b) 2-stage IIR

5.4 Finite world length effects

In actual implementation, represents the filter coefficients by limited


number of bits, typically 8 to 16 bits, and the arithmetic operations
indicated in the difference equation are performed using finite precision
arithmetic. The effects of using a finite number of bits are to degrade the
performance of the filter and in some cases to make it unstable. The
designer must analyze these effects and choose suitable wordlengths
(number of bits) for the filter coefficients, filter variable (input and output
sample).

The main sources of performance degradation are:-

1) Input/ output signal quantization due to ADC noise.


2) Coefficient quantization, this leads deviation in the frequency
response of both FIR and IIR filters.
3) Arithmetic round off errors. The use of
4) Overflow, this occurs when the result of an addition exceeds
permissible world length.
Ex. 5.4 The transfer function for an FIR filter is given by
𝐻(𝑧) = 1 − 1.3435𝑧 −1 + 0.9025𝑧 −2
Draw the realization block diagram for each of the following cases.
1) Transversal structure
2) Two stage lattice structure
Calculate the values of the coefficients for both transversal and lattice
structures.
Solution
1) From the transfer function, the diagram for the transversal structure is
given in fig (5.4a).
The difference equation of the transversal is given by

17
Lect. 5, Asst. Prof. Dr. Hadi T. Ziboon, Department of Electrical Eng. U.O.T

𝑦[𝑛] = 𝑥[𝑛] + ℎ[1]𝑥[𝑛 − 1] + ℎ[2]𝑥[𝑛 − 2] … (2) by using IZT

But 𝐻(𝑧) = 1 − 1.3435𝑧 −1 + 0.9025𝑧 −2 … (1)

∴ ℎ[0] = 1 , ℎ[1] = −1.3435 , ℎ[2] = 0.9025

x[n]
𝑧 𝑧
ℎ[1] = −1.3435 ℎ[2] = 0.9025

+
y[n] fig (5.4a)FIR using Transversal
2) A two stage lattice structure for the filter is given in fig (5.4b). The
output of the structure are related to the input as
stage1 𝑦1 [𝑛] stage2
+
𝑦2 [𝑛]
+
x[n] 𝑘1 𝑘2
𝑘1 𝑘2
𝑧 − + 𝑧− +
Fig (5.4b) 𝑤1 [𝑛] 𝑤2 [𝑛]

𝑦2 [𝑛] = 𝑦1 + 𝑘2 𝑤1 [𝑛 − 1] 𝑤1 [𝑛] = 𝑥[𝑛 − 1] + 𝑘1 𝑥[𝑛]

𝑤1 [𝑛 − 1] = 𝑥 [𝑛 − 2] + 𝑘1 𝑥[𝑛 − 1]

= 𝑥[𝑛] + 𝑘1 𝑥[𝑛 − 1] + 𝑘2 {𝑥[𝑛 − 2] + 𝑘1 𝑥[𝑛 − 1]}

𝑦2 [𝑛] = 𝑥[𝑛] + 𝑘1 𝑥[𝑛 − 1] + 𝑘2 𝑥[𝑛 − 2] + 𝑘1 𝑘2 𝑥[𝑛 − 1]

𝑦2 [𝑛] = 𝑥[𝑛] + 𝑘1 (1 + 𝑘2 )𝑥[𝑛 − 1] + 𝑘2 𝑥[𝑛 − 2]… (3)

𝑦[𝑛] = 𝑥[𝑛] + ℎ[1]𝑥[𝑛 − 1] + ℎ[2]𝑥[𝑛 − 2] ….. (2)


Comparing eq (2) and (3) and equation coefficients

𝑘1 (1 + 𝑘2 ) = ℎ[1]
ℎ[1]
∴ 𝑘1 = , 𝑘2 = ℎ[2]
1 + ℎ[2]
−1.3425
∴ 𝑘1 = = −0.706 , 𝑘2 = 0.9025
1 + 0.9025

18
Lect. 5, Asst. Prof. Dr. Hadi T. Ziboon, Department of Electrical Eng. U.O.T

Ex 5.5
Discuss the five main steps involved in the design of digital filters, using
the following design problem to illustrate your answer.
A digital filter is required for real time noise reduction (in medical
application). The filter should meet the following amplitude response
specifications:
Passband 0 – 10 Hz
Stopband 20 – 64 Hz
Sampling frequency 128Hz
Maximum passband deviation < 0.036 dB
Stopband attenuation > 30dB

Solution:

1)Requirement specification.

2) Calculation of suitable coefficient.

3) Selection of filter

4) Analysis of finite word length

5) implementation

19
University of Technology
Department of Electrical Engineering

Lect6

Finite Impulse response (FIR) filter design

Asst. Prof. Dr. Hadi T. Ziboon


Lect. 6, Asst. Prof. Dr. Hadi T. Ziboon, Department of Electrical Eng. U.O.T

Finite Impulse response (FIR) filter design

Filter design starts from specifications and includes the coefficient


calculation, analysis of finite wordlength effects and implementation.

6.1 Summary of key characteristic features of FIR filter

a) The basic FIR filter is characterized by the following two equations

𝑦[𝑛] = ∑𝑁−1
𝑘=0 ℎ[𝑘] 𝑥[𝑛 − 𝑘] … (6.1a)
k=0,1,2,… N

𝐻(𝑧) = ∑𝑁−1
𝑘=0 ℎ(𝑘) 𝑧
−𝑘
… (6.1b)
Where h(k) :The impulse response coefficient of the filter.
H(z) : The transfer function of the filter
N: The filter length that is the number of the filter coefficients.
b) FIR filters can have an exactly linear phase response.

c) FIR filters are very simple to implement.

- Recursive FIR filters also exist and may offer significant


computational advantages.

6.2 Linear phase response and its implication

- When a signal passes through a filter, it is modified in amplitude


and/or phase.
- The phase delay or group delay of the filter provide a useful measure
of how the filter modifies the phase characteristics of the signal.
- If we consider a signal consists of several frequency components
(such as speech or modulated signal)

a) The phase delay of the filter is the amount of time delay for each
frequency components (𝑇𝑃 ).

b) The group delay is the average time delay of the composite signal
suffer at each frequency 𝑇𝑔

The phase delay is the negative of the phase angle divide by frequency
where the group delay is the negative of the derivative of the phase with
respect to 𝑤.

1
Lect. 6, Asst. Prof. Dr. Hadi T. Ziboon, Department of Electrical Eng. U.O.T

𝑇𝑃 = −∅(𝑤)/𝑤 …. (6.2a)
where 𝑇𝑃 = time or phase delay for each frequency component.
𝑑∅(𝜔)
𝑇𝑔 = − …. (6.2a)
𝑑𝜔

where 𝑇𝑔 = group delay (is the time delay of the composite signal at each
frequency.
A filter with a nonlinear phase characteristic will cause a phase distortion
in the signal that passes through it.

- A filter is said to have a linear phase response if its phase response


satisfied one of the following relationship:
∅(𝑤) = −∝ 𝑤 … (6.3a)
∅(𝑤) = 𝛽−∝ 𝑤 … (6.3b)

Where 𝛽 𝑎𝑛𝑑 ∝ are constant.

- It can show that for condition (6.3a) to be satisfied the impulse


response of the filter must have positive symmetry. The phase
response in this case is simply a function of the filter length
ℎ[𝑛] = ℎ[𝑁 − 𝑛 − 1] …. (6.4a)
where n=0,1,2, … (N-1)/2 if N odd
n=0,1,2, … (N/2)-1 if N even
𝛼 = (𝑁 − 1)/2 … (6.4b)
- When the condition given in eq (6.3b) only is satisfied the filter will
have a constant group delay line. In this case, the impulse response of
the filter has negative symmetry
ℎ[𝑛] = −ℎ[𝑁 − 𝑛 − 1] …. (6.5a)
𝛼 = 𝑁 − 1/2 … (6.5b)
𝛽 = 𝜋/2 …. (6.5c)
Ex. 6.1 (1) Discuss briefly the conditions necessary for a realizable
digital filter to have a linear phase characteristics, and the advantage
of filters with such characteristics.

2
Lect. 6, Asst. Prof. Dr. Hadi T. Ziboon, Department of Electrical Eng. U.O.T

(2) FIR digital filter has impulse response, h(n) defined over the interval
0 ≤ 𝑛 ≤ 𝑁 − 1. Show that if N=7 and h[n] satisfies the symmetry
condition h[n]= h[N-n-1] the filter has a linear phase characteristic.
(3) Repeat (2) if N=8.
Solution
(1) The necessary and sufficient condition for a filter to have a linear
phase response must be symmetrical
ℎ[𝑛] = ℎ[𝑁 − 𝑛 − 1]
or ℎ[𝑛] = −ℎ[𝑁 − 𝑛 − 1]
For nonrecursive FIR filters, the storage space for coefficients and the
number of arithmetic operations are reduced by nearly a factor of 2.
For recursive FIR filters the coefficient can be made to be simple
integers, leading to increased speed of processing.
In linear phase filters, all frequency components experience the same
amount of delay through the filter that is no phase distortion.
(2) Using the symmetry condition we find that for N=7
ℎ[𝑛] = ℎ[𝑁 − 𝑛 − 1]
ℎ[0] = ℎ[7 − 0 − 1] = ℎ[6]

Using the same way to fined ℎ[1] = ℎ[5]. ℎ[2] = ℎ[4]. ℎ[3] = ℎ[3].

ℎ[4] = ℎ[2]. ℎ[5] = ℎ[1]. ℎ[6] = ℎ[0]

The frequency response H(w) for the filter is given by

𝐻 (𝑤) = ∑6𝑛=0 ℎ[𝑛] 𝑒 −𝑗𝑤𝑛 Substitute 𝑧 = 𝑒 𝑗𝑤 𝑖𝑛 𝐻(𝑧)

𝐻(𝑧) = ∑𝑁−1
𝑛=0 ℎ(𝑛) 𝑧
−𝑛

= ℎ[0] + ℎ[1]𝑒 −𝑗𝑤 + ℎ[2]𝑒 −𝑗2𝑤 + ℎ[3]𝑒 −𝑗3𝑤 + ℎ[4]𝑒 −𝑗4𝑤


+ ℎ[5]𝑒 −𝑗5𝑤 + ℎ[6]𝑒 −𝑗6𝑤

3
Lect. 6, Asst. Prof. Dr. Hadi T. Ziboon, Department of Electrical Eng. U.O.T

𝐻(𝑤) = 𝑒 −𝑗3𝑤 [ℎ[0]𝑒 𝑗3𝑤 + ℎ[1]𝑒 𝑗2𝑤 + ℎ[2]𝑒 𝑗𝑤 + ℎ[3] + ℎ[4]𝑒 −𝑗𝑤
+ ℎ[5]𝑒 −𝑗2𝑤 + ℎ[6]𝑒 −𝑗3𝑤 ]
Using the summitry condition we can group terms whose coefficients are
numerically equal
𝐻(𝑤) = 𝑒 −𝑗3𝑤 [ℎ[0](𝑒 𝑗3𝑤 + 𝑒 −𝑗3𝑤 ) + ℎ[1](𝑒 𝑗2𝑤 + 𝑒 −𝑗2𝑤 )
+ ℎ[2](𝑒 𝑗𝑤 + 𝑒 −𝑗𝑤 ) + ℎ[3]
𝐻(𝑤) = 𝑒 −𝑗3𝑤 [2ℎ[0] cos(3𝑤)
+ 2ℎ[1] cos(2𝑤) + 2ℎ[2] cos(𝑤) + ℎ[3]]
7−1
Since we have n=7, ∴ symmetrical at n= =3
2
- If we let a[0]=2h[3] and a[n]=2h[3-n],a[1]=2h[2],a[2]=2h[1],
a[3]=2h[0] n=0,1,2,3

h[n]

0 1 2 3 4 5 6 n
3 −𝑗3𝑤
∴ 𝐻(𝑤) = ∑𝑛 𝑎[𝑛] cos 𝑤(𝑛) 𝑒 … (1a)
−𝑗𝜑(𝑤)
= ±|𝐻(𝑤)|𝑒 …. (1b)
3

𝑤ℎ𝑒𝑟𝑒 ± |𝐻(𝑤)| = � 𝑎(𝑛) cos 𝑤𝑛


𝑛=0
∅(𝑤 ) = −3𝑤 by comparison q(1a) and q(1b) also cos(wn)=cos(-wn)

Thus, the phase response is linear, since ∅(𝑤) = −𝛼𝑤


3) Using the save procedure in part (2) but N-8
8
∴ symmetrical n=2 − 1 = 3
In this case the symmetry conditions lead to
h[0]=h[7], h[1]=h[6], h[2]=h[5], h[3]=h[4]
by using h[n]=h[N-n-1]
𝑗7𝑤 𝑗7𝑤 𝑗7𝑤 𝑗5𝑤 𝑗5𝑤 −𝑗3𝑤 𝑗3𝑤
𝐻(𝑤) = 𝑒 − 2 �ℎ[0] �𝑒 2 + 𝑒− 2 �+ ℎ[1] �𝑒 − 2 +𝑒 2 � + ℎ[2] �𝑒 2 +𝑒 2 �

𝑗𝑤 𝑗𝑤
+ ℎ[3] �𝑒 − 2 + 𝑒 2 ��

𝑗7𝑤 7𝑤 5𝑤 3𝑤 𝑤
= 𝑒− 2 [2ℎ[0] cos � � + 2ℎ[1] cos � � + 2ℎ[2] cos � � + 2ℎ[3] cos � �]
2 2 2 2
𝑗∅(𝑤)
= ±|𝐻(𝑤)|𝑒
1
Where ±|𝐻(𝑤)| = ∑4𝑛=1 𝑏[𝑛] cos[𝑤 �𝑛 − 2�]
7 𝑁
∅(𝑤) = − 𝑎𝑛𝑑 𝑏[𝑛] = 2ℎ � − 𝑛�
2𝑤 2
Thus also the phase response is linear.

4
Lect. 6, Asst. Prof. Dr. Hadi T. Ziboon, Department of Electrical Eng. U.O.T

6.2 FIR filter design


As discussed before, the design of a digital filter involve:-
1. Filter specification
2. Coefficient calculation
3. Realization
4. Analysis of finite worldlength effects
5. Implementation
Note there are four types of linear phase FIR filters depending on whether
N is even or odd and whether h[n] has positive or negative symmetry.
6.3 FIR filter specification
- For the phase response we need only state whether positive symmetry
or negative symmetry is required.
- The amplitude-frequency response of an FIR filters is often in the
form of tolerance scheme as shown in fig (6.1) (also discussed before)
- The following parameters are:-
a) 𝛿𝑃 peak passband deviation or ripple
b) 𝛿𝑠 stopband deviation
c) 𝑓𝑃 passband edge frequency
d) 𝑓𝑠 stopband edge frequency
- 𝛿𝑃 and 𝛿𝑠 in decibels.
- For example the specification for physiological noise reduction are

Passband edge frequency = 10 Hz


Stopband edge frequency ≤ 20 Hz
Stopband attenuation > 30dB
Passband ripple < 0.026 dB
Sampling frequency 256Hz H(f)
1 + 𝛿𝑃
1 − 𝛿𝑃
Fig (6.1)

𝛿𝑠
Pass band 𝑓𝑃 transition 𝑓𝑠 stopband f
band

5
Lect. 6, Asst. Prof. Dr. Hadi T. Ziboon, Department of Electrical Eng. U.O.T

6.4 FIR coefficient calculation methods


The object of most FIR coefficient calculation methods is to obtain values
of h[n] such that the resulting filter meets the design specifications, such
as amplitude-frequency response. Several methods are available for
obtaining h[n]
a) Window method
b) Optimal method
c) Frequency sampling method
6.4.1 Window Method
- The frequency response of a filter,𝐻𝐷 (𝑤) and the corresponding
impulse response,ℎ𝐷 [𝑛] are related by the inverse FT.
1 𝜋
ℎ𝐷 [𝑛] = ∫ 𝐻 (𝑤) 𝑒 𝑗𝑤𝑛 𝑑𝑤
2𝜋 −𝜋 𝐷
…. (6.8)
The subscript D is used to distinguish between the ideal and practical impulse
response.
Let us consider to design a low pass filter with cutoff frequency 𝑤𝑐 as shown in fig
(6.2).
1 𝑤𝑐 𝑗𝑤𝑛 1 𝑤𝑐 𝑗𝑤𝑛
ℎ𝐷 [𝑛] = � 𝑥 𝑒 𝑑𝑤 = � 𝑒 𝑑𝑤
2𝜋 −𝑤𝑐 2𝜋 −𝑤𝑐
1 1 𝑗𝑤 𝑛 −𝑗𝑤 𝑛
2 𝑒 𝑗𝑤𝑐 𝑛 − 𝑒 −𝑗𝑤𝑐 𝑛 𝑤𝑐 𝑒 𝑗𝑤𝑐𝑛 − 𝑒 −𝑗𝑤𝑐𝑛
= �𝑒 𝑐 − 𝑒 𝑐 � = =
2𝜋 𝑗𝑛 2𝜋 2𝑗𝑛 𝜋 2𝑗𝑤𝑐 𝑛
𝑠𝑖𝑛𝑤𝑐 𝑛
= 2𝑓𝑐 for −∞ < 𝑛 < ∞ … (6.9)
𝑤𝑐 𝑛
= 2𝑓𝑐 for n=0 using Hopital transform
Hopital transform for n ≅ 0
𝑑
(sin 𝑤𝑐 𝑛) 𝑤𝑐 cos 𝑤𝑐 𝑛
ℎ𝐷 [𝑛] = 2𝑓𝑐 𝑑𝑛
𝑑 = 2𝑓𝑠 = 2𝑓𝑐 cos 𝑤𝑐 𝑛 = 2𝑓𝑠 𝑖𝑓 𝑛 = 0
(𝑤𝑐 𝑛) 𝑤𝑐
𝑑𝑛
𝐻𝐷 (𝑤)

Fig (6.2) 2π −𝑤𝑐 𝑤𝑐 2π w


ℎ𝐷 [𝑛]

6
Lect. 6, Asst. Prof. Dr. Hadi T. Ziboon, Department of Electrical Eng. U.O.T

The impulse response for the ideal highpass, bandpass and bandstop
filters are obtained from the lowpass case of eq (6.9).
- From fig (6.2), an obvious solution to truncate the ideal response by
setting ℎ𝐷 (𝑛) = 0 for n > M (where M is the length of the window).
However, this introduce undesirable ripples and overshoots the so
called Gibb's phenomenon , Direct truncation of ℎ𝐷 [𝑛] as described
above is equivalent to multiplying the ideal impulse response by a
rectangular window of the form
𝑤 [𝑛]=1. 𝑛=0.1.2.…𝑀−1
=0 𝑒𝑙𝑠𝑒𝑤ℎ𝑒𝑟𝑒 } … . (6.10)
- In the frequency domain this is equivalent to convolving
𝐻𝐷 (𝑤)𝑎𝑛𝑑 𝑊(𝑤)𝑤ℎ𝑒𝑟𝑒 𝑊(𝑤) is the Fourier transform of w[n].
- A practical approach is to multiply the ideal impulse response, ℎ𝐷 (𝑛),
by a suitable window function, w[n], whose duration is finite, as
shown in fig (6.3).
𝐻𝐷 (𝑤) ℎ𝐷 [𝑛]

w n

W(w) w(n)

w n
|𝐻(𝑤)| ℎ[𝑛] = ℎ𝐷 [𝑛] w[n]

w n

Fig (6.3) An illustration of how the filter coefficients, h[n], are


determined by the window method.

7
Lect. 6, Asst. Prof. Dr. Hadi T. Ziboon, Department of Electrical Eng. U.O.T

- The corresponding frequency response shows that the ripples and


overshoots are much reduced. However, the transition width is wider
than for the rectangular case.
- Several window functions have been proposed. One of the most
widely used window functions are Hamming window which is
defined by:
𝑁−1 𝑁−1
2𝜋𝑛 − 2 ≤ 𝑛 ≤ 2 , 𝑁 𝑜𝑑𝑑
𝑤[𝑛] = 0.54 + 0.46 cos � �� (6.11)
𝑁 𝑁 𝑁
𝑎𝑛𝑑 − ≤ 𝑛 ≤ , 𝑁 𝑒𝑣𝑒𝑛
2 2
=0 𝑒𝑙𝑠𝑤ℎ𝑒𝑟𝑒
Fig (6.4) compares the time and frequency domain characteristics of
common window functions (a) Rectangular (b) Hamming (c) Blackman.
- In the time domain, the Hamming window function decrease sharply
to ward zero. But the side lobe levels are smaller than the main lobe
by -40 dB.
- The appropriate relationship between the transition width for filter
designed with the Hamming window and filter length is given by
3.3
∆𝑓 = … (6.12)
𝑁
Where N is the filter length and ∆𝑓 the normalized transition width
(from passband to stopband). fig(6-4)
w[n] W(f)
-14db
(a) Rectangular

n f
w[n] W(f)

-43db
(b) Hamming

n f
w[n] W(f)
-55db

(c)Blackman
n f

8
Lect. 6, Asst. Prof. Dr. Hadi T. Ziboon, Department of Electrical Eng. U.O.T

Ex.6.2 Determine the coefficient of an FIR low pass filter for n=0, 1,2,-- 26
to meet the specification given below using the Hamming window
method
Passband edge frequency 1.5KHz
Transition width 0.5KHz
Stopband attenuation 50 dB
Sampling frequency 8KHz
Solution The ideal impulse response for low pass filter is given by
eq (6.9)
sin(𝑛𝑤𝑐 )
ℎ𝐷 [𝑛] = 2𝑓𝑐 𝑛≠0
𝑛𝑤𝑐
ℎ𝐷 [𝑛] = 2𝑓𝑐 if n=0 if n=0
0.5
∆𝑓 = = 0.0625 [The normalized transition bandwidth]
8
Using eq (6.12) to find N
3.3 3.3
But 𝑁 = = 0.0625 = 52.8 ≅ 53 𝑓𝑖𝑙𝑡𝑒𝑟 𝑙𝑒𝑛𝑔𝑡ℎ
∆𝑓
The filter coefficients are obtained from [ℎ𝐷 [𝑛] 𝑤[𝑛]]
2𝑓𝑐 sin(𝑛𝑤𝑐 )
Where ℎ𝐷 [𝑛] = 𝑖𝑓 𝑛≠0
𝑛𝑤𝑐
ℎ𝐷 [𝑛] = 2𝑓𝑐 if n=0
Hamming window is given by
2𝜋𝑛
𝑤[𝑛] = 0.54 + 0.46 cos( ) − 26 ≤ 𝑛 ≤ 26
53
Because of the smearing effect of the window on the filter response, the
cutoff response of the resulting filter will be different from that given in
the specifications. To solve the problem, we will use an 𝑓𝑐 that is centered
on the transition band
∆𝑓 0.5
𝑓𝑐 = 𝑓𝑐 + = 1.5 + = 1.75𝐾𝐻𝑧
2 2

9
Lect. 6, Asst. Prof. Dr. Hadi T. Ziboon, Department of Electrical Eng. U.O.T

1.75
The normalized 𝑓𝑐′ = = 0.21875
8
Not that h[n] is symmetrical, thus we need only compute values for h[0],
h[1], ….. , h[26]
- n=0, ℎ𝐷 = 2𝑓𝑐 = 2 × 0.21875 = 0.4375
𝑤 [0] = 0.54 + 0.46 cos(0) = 1
∴ ℎ[0] = ℎ𝐷 [0]𝑤[0] = 0.4375 × 1 = 0.4375
sin(𝑛𝑤𝑐 ) 2×0.21875
- n=1, ℎ𝐷 [𝑛] = 2𝑓𝑐 = sin(2𝜋 × 0.21875)
𝑛𝑤𝑐 2𝜋×0.21875
sin[360 × 0.21875]
ℎ𝐷 [ 1 ] = = 0.31219
𝜋
2𝜋𝑛
𝑤 [𝑛] = 0.54 + 0.46 cos � �
53
2𝜋
𝑤[1] = 0.54 + 0.46 cos( ) = 0.98713
53
ℎ(1) = ℎ(−1) = ℎ𝐷 [1] 𝑤(1) = 0.31219 × 0.98713
= 0.31119
- Using the same procedure to find
ℎ(2) = ℎ(−2) = ℎ𝐷 [2] 𝑤[2] = 0.06012
ℎ(26) = ℎ(−26) = ℎ𝐷 [26] 𝑤[26] = 0.000913
- We note that the indices of the filter coefficients run from -26 to +26.
To make the filter causal, necessary for implementation, we add 26 to
each index so that indices start at zero.
- Advantage and disadvantage of the window method
1) An important advantage of the window method is its simplicity. It
is simple to apply and simple to understand. It involves a
minimum of computation.
2) The major disadvantage is its lack of flexibility. Both the peak
passband and stopband ripples are approximately equal, so that the
designer may end up.

10
Lect. 6, Asst. Prof. Dr. Hadi T. Ziboon, Department of Electrical Eng. U.O.T

6.4.2 The optimal method


- The optimal method of calculating FIR filter coefficients is very
powerful, very flexible, because of the existence of an excellent
design program.
- Basic concepts of the optimal method:-
1) The peak ripple of filters designed by the window method occur
near the band edges, and decreased away from the band edges as
shown in fig (6.5a).
2) The peak ripple of filter designed by the optimal method has the
same peaks (equiripple) in the passband or stopband as shown in
fig (6.5b). A better approximation of the desired frequency
response can be achieved when equiripple is satisfied.
3) The optimal method is based on the minimization of the maximum
weight error |E(w)| which is given by
|E(w)| = 𝑊(𝑤)[𝐻𝐷 (𝑤) − 𝐻(𝑤)]
Where 𝐻𝐷 (𝑤) is the ideal or desired response.
𝑊(𝑤) is a weighting function
𝐻(𝑤) is a practical frequency response
4) A Fortran program that implements the above process is available
and is now widely used.

Fig (6.5a) fig(6.5b)


Using window method Using optimal method
H(w) H(w) 𝐻𝐷 (𝑤) ideal Response

1 1
0.8 H(w) practical

w w

11
Lect. 6, Asst. Prof. Dr. Hadi T. Ziboon, Department of Electrical Eng. U.O.T

6.4.3 Frequency Sampling method


- The frequency sampling method allows us to design nonrecursive
FIR filters for both standard frequency selective filters (lowpss,
highpass, bandpass filters) and filters with arbitrary frequency
response. A main attraction of the frequency sampling method is that
it also allows recursive implementation of FIR filters.
4.4.3.1 Nonrecursive frequency sampling filters
- Suppose we wish to obtain the FIR coefficients of the filter whose
frequency response as shown in fig (6.6a).
- We could start by taking N samples of the frequency response at interval of
𝑓
𝑘 𝑠 . 𝑘 = 0.1. … . 𝑁 − 1
𝑁
- The filter coefficients h[n] can be obtained by inverse DFT of the
frequency samples
2𝜋
1 𝑗( )𝑛𝑘
ℎ[𝑛] = ∑𝑁−1
𝑘=0 𝐻(𝑘) 𝑒 𝑁 … (6.13)
𝑁
where H(k), k=0,1, … ,N-1 are samples of the ideal or target frequency
response.
- For linear phase filters, with positive symmetrical impulse response, we
can write (for N even)
𝑁
1 −1 2𝜋𝑘(𝑛−𝛼)
ℎ[𝑛] = [∑𝑘=1 2|𝐻(𝑘)| cos |[
2
]| + 𝐻(0)]……(6.14)
𝑁 𝑁
where 𝛼 = (𝑁 − 1)/2. For N odd the upper limit in the summation is
(𝑁 − 1)/2. The resulting filter will have a frequency response that is
exactly the same as the original response at the sampling instant as shown
in fig (6.6c).
|𝐻(𝑘)| fig (6.6)
(a)

w
𝐹𝑠
H(k)

(b)

4 5 6 7 8 9 10 12 14 k
̭
|𝐻(𝑘)|

(c)
W

12
Lect. 6, Asst. Prof. Dr. Hadi T. Ziboon, Department of Electrical Eng. U.O.T

- An alternative frequency sampling filter, known type 2, results if we


take frequency sample at intervals of
1 𝑓𝑠
𝑓𝑘 = �𝑘 + � 𝑘 = 0,1,2 , … , 𝑁 − 1 … . (6.15)
2 𝑁
- For a give filter specification, both methods will lead to somewhat
different frequency responses.
Ex 6.3 (1) show that the impulse response coefficient of a linear phase
FIR filter with positive symmetry for N even, can be expressed as
𝑁
−1
2
1 2𝜋𝑘(𝑛 − 𝛼)
ℎ[𝑛] == [� 2|𝐻(𝑘)| cos |[ ]| + 𝐻(0)]
𝑁 𝑁
𝑘=1
where 𝛼 = (𝑁 − 1)/2, 𝑓𝑠 =sampling frequency and H(k) are the samples
of the frequency response of the filter taken at interval 𝑘𝑓𝑠 /𝑁.
Using sampling method

(2)Calculate the filter coefficients using the frequency sampling method


to satisfy the following specification

Passband 0-5 kHz


Sampling frequency 18 kHz
Filter length 9
Solution using inverse DFT to find h[n]
𝟏
𝒉[𝒏] = ∑𝑵−𝟏
𝒌=𝟎 𝑯(𝒌) 𝒆
𝒋(𝟐𝝅/𝑵)𝒏𝒌
but H(k)=|H(k)|𝒆−𝒋𝜽
𝑵
𝟏
𝜽 = 𝟐𝝅𝒇𝒕 = ∑𝑵−𝟏
𝒌=𝟎 |𝑯(𝒌)| 𝒆
−𝒋[𝟐𝝅𝜶𝒌/𝑵] 𝒋(𝟐𝝅𝒏𝒌/𝑵)
𝒆
𝑵
𝒋𝟐𝝅𝒌(𝒏−𝜶)
𝟏
𝒆−𝒋𝜽 = 𝒆−𝒋𝟐𝝅𝒇𝒕 = ∑𝑵−𝟏
𝒌=𝟎 |𝑯(𝒌)| 𝒆
𝑵
𝑵
𝒌𝒇𝒔 𝒌
𝒇= =
𝑵 𝑵𝑻𝒔
𝟏 𝟐𝝅𝒌(𝒏−𝜶) 𝟐𝝅𝒌(𝒏−𝜶)
= ∑𝑵−𝟏
𝒌=𝟎 |𝑯(𝒌)| [𝐜𝐨𝐬 � � + 𝒋 𝐬𝐢𝐧 � �]
𝑵 𝑵 𝑵
(𝑵−𝟏)𝑻𝒔
t= Since h[n] is real value, the imajinary part =0
𝟐
𝟏 𝟐𝝅𝒌(𝒏−𝜶)
Due to symmetry = ∑𝑵−𝟏
𝒌=𝟎 |𝑯(𝒌)| 𝐜𝐨𝐬 � �
𝑵 𝑵
𝒌 𝑵−𝟏
𝒇𝒕 = ( )𝑻𝒔
𝑵𝑻𝒔 𝟐
𝒌 𝑵−𝟏
𝒇𝒕 = ( )
𝑵 𝟐
𝒌
𝒇𝒕 = 𝜶
𝑵
𝒌
𝜽 = 𝟐𝝅 𝜶
𝑵

13
Lect. 6, Asst. Prof. Dr. Hadi T. Ziboon, Department of Electrical Eng. U.O.T

- For the important case of linear phase h[n] will be symmetrical and so we can
write (for N even)
𝑵
−𝟏
⎡𝟐 ⎤
𝟏
𝒉[𝒏] = ⎢ � 𝟐|𝑯(𝒌)| 𝐜𝐨𝐬[𝟐𝝅𝒌(𝒏 − 𝜶)/𝑵 + 𝑯(𝟎)]⎥ … (𝟔. 𝟏𝟒)
𝑵⎢ ⎥
𝒌=𝟏
⎣ ⎦
- For n odd, the upper limit in the summation is (N-1)/2.
2)The ideal frequency response is shown in fig (6.7a). The frequency samples are
taken at intervals of 𝒌𝒇𝒔 /𝑵, that is at intervals of multiple of 18kHz /9 = 2kHz for
each interval. Thus the frequency are given by
H(k)=1 k=0,1,2
=0 k=3,4
𝑵−𝟏 𝒈−𝟏
Using eq(6.14) to find α= 𝟐
= 𝟐
≅ 𝟒 to find the impulse response coefficients as
shown in table
𝟒
𝟏 𝟐𝝅𝒌(𝒏 − 𝜶)
𝒉[𝟎] = �� 𝟐 𝑯(𝒌) 𝐜𝐨𝐬 � � + 𝑯(𝟎)�
𝟗 𝟗
𝒌=𝟏

𝟏 −𝟒 −𝟒
= [𝟐𝑯(𝟏) 𝐜𝐨𝐬[𝟐𝝅 × 𝟏 × ( ) + 𝟐𝑯(𝟐) 𝐜𝐨𝐬[𝟐𝝅 × 𝟐 × ( ) + 𝟎 + 𝟎 + 𝟏
𝟗 𝟗 𝟗
𝟏
= [𝟐 × 𝟏 × (−𝟎. 𝟗𝟑𝟓) + 𝟐 × 𝟎. 𝟕𝟔𝟔 + 𝟏] = 𝟕. 𝟐 × 𝟏𝟎−𝟐
𝟗
But positive symmetry h(n)=h(N-1-n)
Using the same procedure to find h[1], h[2], h[3], …, h[8]
h[0] = 0.07252262 =h[8] H(k) fig(6.7)
h[1] = -0.11111 =h[7]
h[2] = -0.059120 =h[6]
h[3] = 0.3199 =h[5] 0 1 2 2.5 3 4 5 6 7 8 9 k
h[4] = 0.555 =h[4] [ this mean each value of step =2kHz,

∴ 𝐭𝐡𝐞 𝐢𝐝𝐞𝐚𝐥 𝐩𝐚𝐬𝐬𝐛𝐚𝐧𝐝 = 𝐤 × 𝟐 = 𝟐. 𝟓 × 𝟐 =


𝟓𝒌𝑯𝒛
Notes (1)The coefficient are positive symmetrical for this reason

h[n]=h[N-1-n], h[0]=h[8-0]=h[0], h[1]= h[8-1]=h[7], h[2]= h[8-2]=h[6]

(2)The ideal frequency response in fig (6.7) shown that

The passband=k (interval sampling=2.5×2 = 5 kHz.

14
University of Technology
Department of Electrical Engineering

Lect 7

Design of infinite impulse response


(IIR) digital filter

Asst. Prof. Dr. Hadi T. Ziboon


Lect. 7, Asst. Prof. Dr. Hadi T. Ziboon, Department of Electrical Eng. U.O.T

7.1 Design of infinite impulse response (IIR) digital filter


Realization IIR digital filters are characterized by the following recursive
difference equation

∞ 𝑁 𝑀

𝑦[𝑛] = � ℎ[𝑘] 𝑥[𝑛 − 𝑘] = � 𝑎𝑘 𝑥[𝑛 − 𝑘] − � 𝑏𝑘 𝑦[𝑛 − 𝑘] … (7.1)


𝑘=0 𝑘=0 𝑘=1

Where h[k] is the impulse response of the filter, 𝑎𝑘 and 𝑏𝑘 are the
coefficients of the filter, and x[n] and y[n] are the input and output of the
filter. The transfer function for the IIR filter is

𝑎0 + 𝑎1 𝑧 −1 + ⋯ + 𝑎𝑁 𝑧 −𝑁 ∑𝑁
𝑘=0 𝑎𝑘 𝑧
−𝑘
𝐻(𝑧) = = … (7.2)
1 + 𝑏1 𝑧 −1 + ⋯ + 𝑎𝑀 𝑧 −𝑀 1 + ∑𝑀
𝑘=1 𝑏𝑘 𝑧
−𝑘

- An important part of the IIR filters design to find the values of 𝑎𝑘 and
𝑏𝑘 to satisfy the required filter characteristics. Eq (7.1) and (7.2) are
the characteristics equation for IIR filter.
- As shown in eq (7.1), the current output y[n] is a function of past
output y[n-k] as well as present and past input samples x[n-k].
- The strength of IIR filters comes from the flexibility the feedback
arrangement.
- IIR filters normally require fewer coefficients than FIR for the same
applications, which is why IIR filters are used when sharp cutoff and
high throughput are important requirements.
- The main problem of the IIR filter is the stability.
- The transfer function of IIR filter H(z) given in eq (7.2) can be
factored as
𝑘(𝑧 − 𝑧1 )(𝑧 − 𝑧2 ) … (𝑧 − 𝑧𝑁 )
𝐻(𝑧) = … (7.3)
(𝑧 − 𝑃1 )(𝑧 − 𝑃2 ) … (𝑧 − 𝑃𝑀 )

1
Lect. 7, Asst. Prof. Dr. Hadi T. Ziboon, Department of Electrical Eng. U.O.T

7.2 Design stages for digital IIR filters


- The design of IIR filters can be broken into five stages:-
1) Filter specification :( Type of the filter and specification).
2) Approximation or coefficient calculation.
3) Realization, which is simply converting the transfer function into a
suitable filter structure.
4) Analysis of errors due to the calculation of coefficients and using a
finite number of bits.
5) Implementation, which involves building the hardware and/or
software.
7.3 Stage1: Performance Specification. include the following
1) Signal characteristics (2) Frequency response
(3) The manner of implementation (4) Cost.
- For frequency selective filters, such as lowpass and bandpass filters,
the frequency response specifications are often in the form of a
tolerance schemes shown in fig (7.2) for an IIR parameters are used to
specify the frequency response:-
𝜖 2 passband ripple parameter where the passband ripple is
𝛿𝑃 passband deviation 𝐴𝑝 = 20 Log10 (1 + 𝜖 2 )
𝛿𝑠 stopband deviation = −20 Log(1 − 𝛿𝑝
𝑓𝑃1 and 𝑓𝑃2 passband edge frequency and the stopband ripple is
𝑓𝑠1 and 𝑓𝑠2 stopband edge frequency 𝐴𝑠 = −20 Log10 𝛿𝑠
- Passbnad and stopband deviations may be expressed as ordinary
number as in decibels.
|H(f)|
1
𝛿𝑃 passband ripple
1
√1 + 𝜖 2

𝛿𝑠

𝑓𝑠1 𝑓𝑃1 𝑓𝑃2 𝑓𝑠2 𝐹𝑠 /2 f

2
Lect. 7, Asst. Prof. Dr. Hadi T. Ziboon, Department of Electrical Eng. U.O.T

Fig (7.1) Tolerance scheme for an IIF bandpass filter.

7.3 Stage 2: Calculation of IIR filter coefficients

The task of this stage to select one of approximation method and calculate
the value of 𝑎𝑘 and 𝑏𝑘 in eq (7.2). The main two methods are:

1) Pole-Zero method: This method is based on place poles and zero in


z-plane. This method is used for simple filter such as notch filter.
2) Design an analogue filter satisfying the desired specifications and
then to convert it onto an equivalent digital filter. Most digital IIR
filters are designed this way.
They are two common approaches used to convert analogue filters into
equivalent digital filters: (a) The impulse invariant
(b) Bilinear z-method
7.3.1 Pole-Zero placement method
a) When a zero is placed at a given point on the z-plane, the frequency
response will be zero at the corresponding point.
b) A pole on the other position will produce a peak at the corresponding
frequency point as shown in fig (7.2).
c) Thus, by placing poles and zeros on z-plane, we obtain simple
lowpass on other selective frequency response.

Im 𝐹𝑠 /4 |H(f)|

𝐹𝑠 /2 0 Re

3𝐹𝑠 /4
𝐹𝑠 𝐹𝑠 3𝐹𝑠
0 𝐹𝑠 f
4 2 4
(a) (b)

Fig (7.2) (a) Pole-Zero diagram of simple bandpass filter


(b) Frequency response of simple bandpass filter
Note The radius r of the poles is determined by the desired (BW) and
𝐵𝑊
is given by 𝑟 ≅ 1 − 𝜋.
𝐹𝑠

3
Lect. 7, Asst. Prof. Dr. Hadi T. Ziboon, Department of Electrical Eng. U.O.T

Ex. 7.1 A bandpass digital filter is required to meet the following


specifications:

1) Complete signal rejection at dc and 250 Hz


2) Narrow passband centered at 125 Hz
3) 3dB bandwidth of 10 Hz.
Assuming a sampling frequency of 500Hz, obtain the transfer function of
the filters (by using pole-zero placement method) and its difference
equation. Draw block diagram of this digital filter.
Solution (1) First, we must determine where to place the poles and zeros
on the z-plane. Since a complete signal rejection at dc and 250Hz, we
need to place zeros at corresponding points at angles of 0𝑜 and
250
360 × = 180𝑜 the unit circle.
500
(2) To have the passband centered at 125Hz requires us to place poles at
125
±360 × = ±90𝑜 .
500
(3) To ensure that the coefficients are real, it is necessary to have
complex conjugate pole pain.
(4) The radius, r, of the poles is determined by the desired bandwidth
(BW). There is an approximated equation between r (for r > 0.9) and
bandwidth (BW) is given by
𝐵𝑊
𝑟 ≅1− 𝜋
𝐹𝑠
10
𝑟 ≅1− 𝜋 = 0.937
500
- The pole- zero diagram as shown in fig (7.1a).
- From the pole-zero diagram, the transfer function is
(𝑧 − 1)(𝑧 + 1) 𝑧2 − 1
𝐻(𝑧) = 𝑗𝜋 𝑗𝜋
= 2 (∗)
− 𝑧 + 0.877969
�𝑧 − 𝑟𝑒 2 � �𝑧 − 𝑟𝑒 2 �
1 − 𝑧 −2
= (𝑚𝑢𝑙𝑡𝑖𝑝𝑙𝑦 𝑒𝑞(∗)𝑏𝑦 𝑧 −2 )
1 + 0.877969𝑧 −2
Im

0.937
Re

-0.937

4
Lect. 7, Asst. Prof. Dr. Hadi T. Ziboon, Department of Electrical Eng. U.O.T

To find the difference equation, using the IZT


𝑌(𝑧) 1 − 𝑧 −2
=
𝑋(𝑧) 1 + 0.877969𝑧 −2
𝑌(𝑧)[1 + 0.877969𝑧 −2 ] = 𝑋(𝑧)[1 − 𝑧 −2 ]
Take IZT
∴ 𝑦[𝑛] = −0.87796𝑦[𝑛 − 2] + 𝑥[𝑛] − 𝑥[𝑛 − 2] ......... (1)
The block diagram is shown in fig (7.1b)
1
x[n] 𝑧 𝑧 + y[n]
-1
comparing the difference equation 𝑧
(1) with the general equation of IIR (2)
𝑎0 = 1. 𝑎1 = 0. 𝑎2 = −1 𝑧
𝑏1 = 0. 𝑏2 = 0.87796
-0.87796
Note:
The general equation of 2nd order is given by
2 2

𝑦[𝑛] = � 𝑎𝑘 𝑥[𝑛 − 𝑘] − � 𝑏𝑘 𝑦[𝑛 − 𝑘]


𝑘=0 𝑘=1
= 𝑎0 𝑥[𝑛] + 𝑎1 𝑥[𝑛 − 1] + 𝑎2 𝑥[𝑛 − 2] − 𝑏1 𝑦[𝑛 − 1] + 𝑏2 𝑦[𝑛 − 2]..... (2)
Ex. 7.2 Find the transfer function and difference equation of a simple IIR digital notch
filter that meets the following specifications
Notch frequency =50 Hz
3dB width of notch=±5Hz
Sampling frequency=500Hz
Using the pole-zero placement method nnn |H(f)|

Fig (7.2a)
f
Solution 50Hz
1) To reject the component at 50Hz, we place a pair of complex zeros at points on
50
the unit circle correspond 50Hz that is at angle 360 × 500 = ±36𝑜 as shown in fig
(7.2b).
2) To achieve a sharp notch filter and improved Im
response on either side of notch frequency,
a pair of complex conjugate poles is placed at a radius.
Fig(7.2b) -1 R

5
Lect. 7, Asst. Prof. Dr. Hadi T. Ziboon, Department of Electrical Eng. U.O.T

𝐵𝑊 ±5 10
𝑟 =1− =1− 𝜋 =1− 𝜋 = 0.937 [𝐵𝑊 = 2 × 5 = 10𝐻𝑧]
𝐹𝑠 500 500

3) The pole-zero diagrams in fig (7.2a). From the figure, the transfer
function of the filter is given by
0 0
(𝑧−𝑒 −𝑗36 )(𝑧−𝑒 𝑗36 )
𝐻(𝑧) = where the angle of poles
(𝑧−0.937𝑒 −𝑗39.6 )(𝑧−0.937𝑒 𝑗39.6 )

𝑧 2 −1.6180𝑧+1 1−1.6180𝑧 −1 +𝑧 −2 (50+5)


= = 360 × = 39.60
𝑧 2 −1.5161𝑧+0.87 1−1.5161𝑧 −1 +0.87𝑧 −2 500

The difference equation is determines by using IZT as mentioned in Ex.7.1


𝑦[𝑛] = 𝑥[𝑛] − 1.6180𝑥[𝑛 − 1] + 𝑥[𝑛 − 2] + 1.5161𝑦[𝑛 − 1] − 0.878𝑦[𝑛 − 2]
Comparing y[n] with general equation
𝑎0 = 1, 𝑎1 = −1.618, 𝑎2 = 1, 𝑏1 = −1.5161, 𝑏2 = 0.8780
7.3.2 Impulse invariant method (first method of converting analogue filters
into equivalent digital filter)
- In this method, starting with a suitable analogue transfer function H(s),
the impulse response h(t) is obtained using the inverse of the Laplace
transform.
- The h(nT) is the sampled impulse response can be obtained by using
sampling to h(t) where T is the sampling interval.
- H(z) can be obtained by z-transform.
Ex. 7.3 Describe and derive the relationsship how to convert the
analogue filter into equivalent digital filter .Using the impulse invariant
method. Assume the transfer function of the analogue
RC low pass filter is given by
𝐶
𝐻(𝑠) = 𝑆−𝑃 … (7.4)

6
Lect. 7, Asst. Prof. Dr. Hadi T. Ziboon, Department of Electrical Eng. U.O.T

Solution (1) The impulse response, h(t), is given by the inverse Laplace
transform. Assume the transfer function of the analogue lowpass filter RC
𝐶
is given by 𝐻(𝑠) = .
𝑆−𝑃
𝐶
ℎ(𝑡) = 𝐿−1 [𝐻(𝑠)] = 𝐿−1 � � = 𝐶𝑒 𝑃𝑡
𝑆−𝑃
where 𝐿−1 is the inverse Laplace transform
P is the pole of H(s)
(2) According to the impulse invariant method, the impulse response of the
equivalent digital filter, h(nT), is equal to h(t) at the discrete time t=nT,
n=0, 1, 2, … that is
ℎ(𝑛𝑇) = ℎ(𝑡)|𝑡=𝑛𝑇 = 𝐶𝑒 𝑃𝑛𝑇
The transfer function of H(z) is obtained by z-transforming of h(nT)
∞ ∞
𝐶
𝐻(𝑧) = � ℎ(𝑛𝑇) 𝑧 −𝑛 = � 𝐶 𝑒 𝑃𝑛𝑇 𝑧 −𝑛 =
1 − 𝑒 𝑃𝑇 𝑧 −1
𝑛=0 𝑛=0
𝑘𝑧 𝑘
Since [z-transform of 𝑘𝑒 −𝛼𝑛 is given by
𝑧−𝑒 −𝛼
= 1−𝑒 −𝛼𝑧 −1 ]
Thus, form the result above, we can write
𝐶 𝐶
→ … . (7.5)
𝑆−𝑃 1 − 𝑒 𝑃𝑇 𝑧 −1
(3) To apply impulse invariant method to high order (for ex, Mth.order) IIR
filter with simple poles, the transfer function, H(s) is first expanded using
partial fractions as the sum of single pole filters
𝐶1 𝐶2 𝐶𝑀
𝐻(𝑠) = + + ⋯. … . (7.6)
𝑠 − 𝑃1 𝑠 − 𝑃2 𝑠 − 𝑃𝑀
𝑀
𝐶𝑘
=�
𝑠 − 𝑃𝑘
𝑘=1
Where the 𝑃𝑘 are the poles of H(s)
𝑀 𝑀
𝐶𝑘 𝐶𝑘
∴� →� … (7.7)
𝑠 − 𝑃𝑘 1 − 𝑒 𝑃𝑇 𝑧 −1
𝑘=1 𝑘=1

7
Lect. 7, Asst. Prof. Dr. Hadi T. Ziboon, Department of Electrical Eng. U.O.T

High order IIR filters are normally realized as cascaded parallel


combinations of standard second order filter section. Thus the case when
M=2 is of particular interest
𝐶1 𝐶2 𝐶1 𝐶2
+ → + … (7.8)
𝑠 − 𝑃1 𝑠 − 𝑃2 1 − 𝑒 𝑃1𝑇 𝑧 −1 1 − 𝑒 𝑃2𝑇 𝑧 −1
𝐶1 + 𝐶2 − (𝐶1 𝑒 𝑃2 𝑇 + 𝐶2 𝑒 𝑃1 𝑇 )𝑧 −1
=
1 − (𝑒 𝑃1 𝑇 + 𝑒 𝑃2 𝑇 )𝑧 −1 + 𝑒 𝑃1 𝑇+𝑃2 𝑇 𝑧 −2
If the poles 𝑃1 , 𝑃2 are complex conjugates, then 𝐶1 𝑎𝑛𝑑 𝐶2 will be also
be complex conjugates
𝐶1 𝐶1∗ 2𝐶𝑟 −[𝐶𝑟 cos(𝑃𝑖 𝑇)+𝐶𝑖 sin(𝑃𝑖 𝑇)]2𝑒 𝑃𝑟 𝑇 𝑧 −1
∴ −1 + ∗ → .(7.9)
1−𝑒 𝑃1 𝑇 𝑧 1−𝑒 𝑃1 𝑇 𝑧 −1 1−2𝑒 𝑃𝑟 𝑇 cos(𝑃𝑖 𝑇)𝑧 −1 +𝑒 𝑃𝑟 𝑇 𝑧 −2
Where 𝐶𝑟 and 𝐶𝑖 are the real and imaginary of 𝐶1 .
𝑃𝑟 and 𝑃𝑖 are the real and imaginary of 𝑃1 .
* Symbolizes a complex conjugate.

For most practical impulse invariant IIR filters, the transformation given in
eqs(7.7), (7.8) and (7.9) are only transformations required to obtain the
coefficient.

Ex. 7.4 Design a digital filter to approximate the following normalized


analogue transfer function

1
𝐻(𝑠) =
𝑠 2 + √2 𝑠 + 1

Using the impulse invariant method obtain the transfer function, H(z), of
the digital filter, assuming a 3 dB cutoff frequency of 150Hz and sampling
frequency 1.28kHz.

Solution Firstly, we need to frequency scale the normalized transfer


function. This is achieved by replacing s by 𝑠/𝛼, where 𝛼 = 2𝜋 × 150 =
942.4778 to ensure that the resulting filter has the desired response . Thus

8
Lect. 7, Asst. Prof. Dr. Hadi T. Ziboon, Department of Electrical Eng. U.O.T

1 𝛼2
𝐻− (𝑠) = 𝐻(𝑠)|𝑠= 𝑠 = =
𝛼 𝑠 2 𝑠 𝑠 2 + √2 𝛼 𝑠 + 𝛼 2
�𝛼 � + √2 𝛼 + 1

𝐶1 𝐶2
= +
𝑠 − 𝑃1 𝑠 − 𝑃2

Where 𝑃1 and 𝑃2 can be find by set 𝑠 2 + √2 𝛼 𝑠 + 𝛼 2 = 0

−√2 𝛼 ± √2𝛼 2 − 4 × 1 × 𝛼 2 −√2 𝛼(1 ± 𝑗)


∴𝑃= = = −666.4324(1 ± 𝑗)
2 2
∴ 𝑃1 = 666.4324(1 + 𝑗), 𝑃2 = 𝑃1∗ = −666.4324(1 + 𝑗)
𝛼
𝐶1 = 𝑗 = −666.4324𝑗 , 𝐶2 = 𝐶1∗ = 666.4324𝑗
√2
- Since the poles are complex conjugate, the transformation in eq (7.8) is
used to obtain the discrete time transfer function H(z)
Using the same procedure in Ex.3.12, 3.13 to find 𝐶1 and 𝐶2 . (Using partial
fraction)
𝐶𝑟 = 0. 𝐶𝑖 = −666.43
𝑃𝑖 𝑇 = 0.5207. 𝑃𝑟 𝑇 = −0.5207, 𝑒 𝑃𝑟 𝑇 = 0.5944
sin(𝑃𝑖 𝑇) = 0.4974. cos(𝑃𝑖 𝑇) = 0.8675
𝑒 𝑃𝑖 𝑇 = 0.3530. Substitution these values into eq (7.9)
393.9264 𝑧 −1
𝐻(𝑧) =
1 − 1.0308 𝑧 −1 + 0.3530 𝑧 −2
To keep the gain down and to avoid overflow when the filter is implemented
1 1
in practice H(z) is multiplied by 𝑇𝑠 = = = 0.78 𝑚𝑠𝑒𝑐
𝑓𝑠 1.28𝑘𝐻𝑧
−1
0.3078 𝑧
∴ 𝐻(𝑧) =
1 − 1.0308 𝑧 −1 + 0.35 𝑧 −2
Using the same procedure in ex. [7.1, 7.2] to find DE and coefficients

x[n]
𝑧 0.308
+
y[n]
𝑧
1.0308
𝑎 =0 𝑏1 =−1.03
{𝑎01=0.307 𝑏2 =0.3530 𝑧
−0.3530

9
Lect. 7, Asst. Prof. Dr. Hadi T. Ziboon, Department of Electrical Eng. U.O.T

Summary of the impulse invariant method procedure for calculating IIR filter
coefficients
1) Determine a normalization analogue filter, H(s), that satisfies the
specifications for the desired digital filter.
2) If, necessary, expand H(s) using partial functions.
3) Obtain the z-transform of each partial fraction.
4) Obtain H(z). If the actual sampling frequency is used then multiply H(z) by
𝑇𝑠 (sampling period= 1/𝐹𝑠 ).
Remarks on the impulse invariant method
1) The impulse response of the discrete filter, h[n] is identical to that of the
analogue filter, h(t), at the discrete time instants t=nT, n=0, 1, 2, … as
shown in fig (7.7a). It is for this reason this method is called the impulse
invariant method.
2) The sampling frequency affects the frequency response of the impulse
invariant discrete filter. High sampling frequency is necessary for
frequency response to be close to that of the equivalent analogue filter.
3) As in the case with sampling data systems, the spectrum of the impulse
invariant filter corresponding to H(z) would be the same that of the
analogue H(s), but repeats at multiplies of the sampling frequency as
shown in fig(7.8 a, b), leading to aliasing.
Fig (7.7a) |H(f)| fig(7.8 a)
h(t)

Time H(f) Aliasing fig(7.8 b)


(continuous)
h(nT)

𝐹𝑠 2𝐹𝑠 f
(a) Spectrum of an analogue filter
(b) Spectrum of an equivalent impulse
2T 4T 6T 8T 10T Time invariant digital filter showing effects
fig(7.7b) (nT interval) of aliasing.
10
Lect. 7, Asst. Prof. Dr. Hadi T. Ziboon, Department of Electrical Eng. U.O.T

7.3.3 Bilinear z-transform (BZT) method (second method of converting


analogue filter into equivalent digital filter)
BZT is the more important method of obtaining IIR filter coefficient. In the
BZT method, the basic operation required to convert an analogue filter H(s)
into an equivalent digital is to replaces as follow
𝑧−1 2
𝑆=𝑘 , 𝑘 = 1 𝑜𝑟 (7.9𝑎)
𝑧+1 𝑇
- The above transformation maps the analogue transfer, H(s), from the s-
plane into discrete transfer function H(z) in the z-plane as shown in Figs
(7.9 a,b). Notice that :-
a) In the figure the entire (jw) axis in the s-plane is mapped into the unit
circle.
b) The left half s-plane is mapped inside the unit circle.
c) The right half s-plane is mapped outside the unit circle.
d) The stable filter, with poles on the left half of the s-plane, will lead to a
digital filter with poles inside the unit circle.
Im(jw) Im

Re Re

Fig(7.9a) s-plane Fig(7.9b) z-plane

The procedure for calculating digital filter coefficients by BZT method


1) Using the digital filter specification to determine a suitable normalized
transfer function H(s).
2) Determine the cutoff frequency (or passband edge frequency) of the
digital filter 𝑤𝑃 .

11
Lect. 7, Asst. Prof. Dr. Hadi T. Ziboon, Department of Electrical Eng. U.O.T

3) Obtain an equivalent analogue filter cutoff frequency (𝑤′𝑃 ) using the


relation (prewarped) to obtain the desirable response (without this step the
digital filter has undesirable filter).
𝑤𝑝 𝑇 𝑇
𝑤′𝑃 = 𝑘 tan( ) , 𝑘 = 1 𝑜𝑟 (7.9𝑏)
2 2
4) Denormalize the analogue filter by frequency scaling H(s). This is
𝑠
achieved by replacing 𝑠 by .
𝑤′𝑃
5) Applying the bilinear transformation to obtain the desired digital filter
𝑧−1
transfer function H(z) by replacing 𝑠 𝑏𝑦 . 𝑤𝑝 ′ (analogue)
𝑧+1
Note 𝑠 = 𝜎 + 𝑗Ω = 𝜎 + 𝑗𝑤𝑃−
𝑧 = 𝑟𝑒 𝑗𝑤𝑃
(𝑧−1)
𝑠= 𝑤𝑝 (digital)
(𝑧+1)
Ex. 7.5 Determine the transfer function and difference equation for the
digital equivalent of resistance – capacity (RC) filter. Assume a sampling
frequency of 150Hz and a cutoff frequency of 30Hz. Using the BZT
method. Draw the block diagram of the digital filter.
1
Solution 𝐻(𝑠) = … . (7.5.1)
𝑠+1
1) The cutoff frequency 𝑤𝑃 = 2𝜋𝑓 = 2𝜋 × 30 red/sec. (for digital)
2) The equivalent analogue filter cutoff 𝑤′𝑃 is given by
𝑤′𝑃 = tan 𝑤𝑃 𝑇/2 where T=1/150 Hz
2𝜋 × 30 𝜋
𝑤′𝑃 = tan = tan = 0.7265
150 × 2 5
3) The denormalized analogue filter transfer function is obtained from H(s)
as (using 7.5.1)
1 0.7265
𝐻′ (𝑠) = 𝐻(𝑠)|𝑠= 𝑠 = 𝑠 =
0.7265 + 1 𝑠 + 0.7265
0.7265
4) Using BZT
0.7265
𝐻′ (𝑠) = 𝐻(𝑠)|𝑠=𝑧−1 =
𝑧+1 𝑧−1
+ 0.7265
𝑧+1
0.7265(𝑧 + 1) 0.7265(𝑧 + 1)
= =
𝑧 − 1 + 0.7265(1 + 𝑧) 𝑧(1 + 0.7265) + 0.7265 − 1

12
Lect. 7, Asst. Prof. Dr. Hadi T. Ziboon, Department of Electrical Eng. U.O.T

0.4208(1+𝑧 −1 )
H(z) = 1−0.1584𝑧 −1
0.4208
x(n) 𝑧 + y(n)

x[t] R y[t] 𝑧

0.1584

Fig (Ex. 7.5)


𝑌 (𝑧 ) 0.4208�1+𝑧−1 �
𝑋 (𝑧 )
= 1−0.1584𝑧−1
Using IZT
∴ The difference equation is
𝑦[𝑛] = 0.1584𝑦[𝑛 − 1] + 0.4208[𝑥[𝑛] + 𝑥[𝑛 − 1]]
The block diagram representation as shown in the fig (Ex.7.5)
Ex.7.6 Determine the transfer function H(z) and difference equation to
approximate the analogue transfer function
1
𝐻 (𝑠) =
𝑠 2 + √2 𝑠 + 1
Using the BZT method obtain the transfer function H(z). Assuming a 3dB cutoff frequency
of 150Hz and a sampling frequency of 1.28 kHz. Draw the block diagram of the digital
filter.
Solution The critical frequency (or passband edge frequency) of the digital
filter is 𝑤𝑃 = 2𝜋 × 150 .The prewarped analogue frequency is given by
𝑤𝑃 𝑇
𝑤𝑃′ = 𝑡𝑎𝑛 � � = 0.3857
2
The prewarped analogue filter is given by
1
𝐻 ′ (𝑠) = 𝐻 (𝑠)|𝑠= 𝑠 =
𝑤𝑃𝑠 2
′ 𝑠
� ′ � + √2 ′ + 1
𝑤𝑃 𝑤𝑃
′( )
(𝑤𝑃′ )2 0.1488
𝐻 𝑠 = =
𝑠 2 + √2𝑤𝑃′ 𝑠 + (𝑤𝑃′ )2 𝑠 2 + 0.5455 𝑠 + 0.1488
Applying the BTZ gives
0.0878(1 − 2𝑧 −1 + 𝑧 −2 )
𝐻 (𝑧) =
1 − 1.0048𝑧 −1 + 0.356𝑧 −2
See Ex 7.5 for the DE and block diagram.

13
Lect. 7, Asst. Prof. Dr. Hadi T. Ziboon, Department of Electrical Eng. U.O.T

7.4 Comments on the bilinear transformation method


- The BZT involves two separate transformation:-
1) The normalized analogue transfer function is frequency scaled by replacing s as
follows

𝑠 ′
𝑤𝑃 𝑇 2
𝑠= 𝑤ℎ𝑒𝑟𝑒 𝑤𝑃 = 𝑘 tan 𝑘 = 1 𝑜𝑟
𝑤𝑃′ 2 𝑇
2) The BZT is applied by replacing s in the new transfer function as
𝑧−1
𝑠=𝑘
𝑧+1
3) It is common practice in many texts to use the factor k=2/T.
It should be mentioned that both k=1 and k=2/T lead to the same results because k is
cancelled out anyway. To illustrate this consider the following simple filter

1
𝐻(𝑠) =
𝑠+1
Assuming that the digital filter is to have a cutoff frequency of 𝑤𝑃 , then we must
frequency scale H(s) with the following frequency

𝑤𝑃 𝑇
𝑤𝑃′ = 𝑘 tan( )
2
Then the transfer function is

1
𝐻′ (𝑠) = 𝐻(𝑠)|𝑠= 𝑠 = 𝑠
𝑤 𝑇 +1
𝑤𝑃′

𝑘 tan( 𝑃 )
2
𝑘(𝑧−1)
Now we replace 𝑠 =
(𝑧+1)

∴ 𝐻(𝑧) = 𝐻′ (𝑠)|𝑠=𝑘𝑧−1
𝑧+1
1 1
= =
𝑘(𝑧 − 1) 𝑤 𝑇 (𝑧 − 1)
� 𝑧+1 � cot � 2𝑃 � +1
(𝑧 + 1)
𝑤 𝑇 + 1
[𝑘𝑡𝑎𝑛 � 2𝑃 �]

From the above we see that the factor k is cancelled out it would not have
mattered whether k=1 or 2/T.
4) For more computation efficiency, the two transformation can be
𝑤 𝑇 𝑧−1
combined into one transformation 𝑠 = [cot � 𝑃 �][ ].
2 𝑧+1

14
Lect. 7, Asst. Prof. Dr. Hadi T. Ziboon, Department of Electrical Eng. U.O.T

7.5 Use of classical analogue filters to design IIR digital filters


For standard frequency selective filtering tasks, H(s), can be derived from the
classic Butterworth, chebyshev or elliptic functions. Only low pass filter will
be considered, since it is straight forward to obtain other filter types
(bandpass, bandstop and so on) from normalized low pass filter.
7.5.1 Butterworth filter
The low pass Butterworth filter is characterized by the following squared
frequency response
1
|𝐻(𝑤 ′ )|2 = ′ ′ 2𝑁 … . (7.11) |H(f)|
1+(𝑤 /𝑤𝑃 )

Where N is the order of the filter 1 Buttefly response

𝑤𝑃′ is the 3dB cutoff frequency 0.707

- The stopband attenuation =−20𝑙𝑜𝑔10 𝛿𝑠 𝛿𝑠


- The filter order is
𝑤𝑃 𝑤𝑠′ f
1
𝑙𝑜𝑔10 �� � − 1�
𝛿𝑠
𝑁≥ … (7.12)
𝑤′
20𝑙𝑜𝑔10 � ′ �
𝑤𝑃
7.5.2 Chebyshev Filter
𝑘
|𝐻(𝑤 ′ )|2 = … (7.13)
𝑤′
1+ 𝜖 2 𝐶𝑁2 � ′�
𝑤𝑃
𝑤′
Where 𝐶𝑁 � ′ � is the chebyshev polynomial and N order of the filter
𝑤𝑃
𝜖 determine the passband ripple in decibel
Passband ripple ≤ 10𝑙𝑜𝑔10 [1 + 𝜖 2 ] = −20𝑙𝑜𝑔10 [1 − 𝛿𝑃 ] … (7.14)
|H(f)|
1 Chebyshev
1 − 𝛿𝑃 response

𝛿𝑠
𝑤𝑃′ 𝑤𝑠′ f

- The transfer function, H(s), for the Chebyshev response depends On the
desired passband ripple and the filter order, N. The attenuation in decibles
and the filter order N are given by

15
Lect. 7, Asst. Prof. Dr. Hadi T. Ziboon, Department of Electrical Eng. U.O.T

Stopband attenuation ≥ −20𝑙𝑜𝑔10 (𝛿𝑠 )


𝛿
𝑐𝑜𝑠ℎ−1 � �
𝑁≥ 𝜖 … . (7.15)
𝑤′
𝑐𝑜𝑠ℎ−1 � 𝑠′ �
𝑤𝑃
1
Where 𝛿𝑠 = , 𝑤𝑠′ is the stopband frequency, 𝜖 and 𝛿𝑠 are the
√1+𝛿 2
passband and stopband ripple parameters and 𝑤𝑠′ specifies the frequency
above which the stopband and attenuation is satisfied.
7.6 Designing highpass, bandpass and bandstop filter
7.6.1 Calculating IIR filter coefficients (method 1)
The steps involved in the first method are:-
(1) Use the digital filter specifications to determine a suitable normalized, low
pass filter H(s).
(2) Determine the critical frequency of the digital filter:-
(a) For lowpass or highpass is just one critical frequency. The band edge or
cutoff frequency𝑤𝑠′ .
(b) For bandpass or bandstop filters, we have the lower and upper band edge
frequencies, 𝑤1′ 𝑎𝑛𝑑 𝑤2′ .
(3) Replace S in the transfer function, H(s) using one of the following
transformations, depending on the type of the filter required
𝑆 = 𝑠/𝑤𝑃′ ... (7.18a) low pass to low pass
𝑆 = 𝑤𝑃′ /𝑠 ... (7.18b) low pass to high pass
𝑠 2 +𝑤02
𝑆= ... (7.18c) low pass to band pass
𝑊𝑆
𝑊𝑆
𝑆 = 𝑠2 +𝑤 2 ... (7.18d) low pass to band stop
0
𝑤ℎ𝑒𝑟𝑒 𝑤02 = 𝑤1′ 𝑤2′ 𝑊 = 𝑤2′ − 𝑤1′
𝑇
𝑤1′ = tan (𝑤1 2)
𝑇
𝑤2′ = tan (𝑤2 2)
(4) Apply BZT to the new H(s)
𝑧−1
𝑠=
𝑧+1

16
Lect. 7, Asst. Prof. Dr. Hadi T. Ziboon, Department of Electrical Eng. U.O.T

Ex. 7.7 Convert the simple low pass filter (RC filter) into equivalent digital
high pass filter. Assume a sampling frequency of 150 Hz and a cutoff
frequency of 30Hz.
Determine the transfer function and difference equation.
Draw the block diagram of the high pass filter
Solution The critical frequency for the digital filter is 𝑤𝑃 = 2𝜋 × 30 𝑟𝑎𝑑
𝑤𝑃 𝑇
and for analogue filter 𝑤𝑃′ = tan( ), with T=1/50
2
2𝜋 × 30
∴ 𝑤𝑃′ = tan = 0.7265
2 × 150
- The s-plane transfer function of the low pass filter is given by
1
𝐻(𝑠) = 𝑠+1 …(7.8.1)
Using the LPF to HPF transformation of equation (7.18b), the
denormalized analog transfer function is obtains as
1 1 𝑠
𝐻 ′ (𝑠) = 𝐻 (𝑠)| 𝑤′ = = =
𝑤𝑃′ 0.7265
𝑠= 𝑃
𝑠 +1 + 1 𝑠 + 0.7265
𝑠 𝑠
The z-plane transfer function is obtained by applying the BZT
(𝑧−1)/(𝑧+1) 𝑧−1
𝐻 (𝑧) = 𝐻′ (𝑠)|𝑠=𝑧−1 = 𝑧−1 =(
𝑧+1 +0.7265 𝑧−1)+(𝑧+1)0.7265
𝑧+1
1 − 𝑧−1 1 − 𝑧−1
𝐻(𝑧) = =
(1 − 𝑧−1 ) + (𝑧−1 + 1)0.7265 1.7265 − 0.2735𝑧−1
1 − 𝑧 −1
𝐻 (𝑧) = 0.5792
1 + 0.1584𝑧 −1
𝑌(𝑧) 1−𝑧 −1
To fined DE
𝑋(𝑧)
= 0.5792 1+0.1584𝑧 −1
𝑌(𝑧)[1 + 0.1584𝑧 −1 ] = 0.5792(1 − 𝑧 −1 )𝑋(𝑧)
Using IZT
∴ 𝑦[𝑛] = −0.158 𝑦[𝑛 − 1] + 0.5791 𝑥 [𝑛] − 0.5791 𝑥[𝑛 − 1]
Compare y[n] with eq (7.1)
𝑁 𝑀

𝑦[𝑛] = � 𝑎𝑘 𝑥[𝑛 − 𝑘] − � 𝑏𝑘 𝑦[𝑛 − 𝑘]


𝑘=0 𝑘=1

𝑏1 = 0.158 , 𝑎0 = 0.592 , 𝑎1 = −0.592


17
Lect. 7, Asst. Prof. Dr. Hadi T. Ziboon, Department of Electrical Eng. U.O.T

Ex. 7.8 A discrete band pass filter with Butterworth characteristics meeting
the following specifications is required. Determine the transfer function H(z)
with pole-zero diagram. Using BZT. Starting with first order low pass filter.
Pass band =200-300Hz, sampling frequency=2000Hz and filter order=2.
Solution The prewarped pass band edge frequencies are given by
𝑤1 𝑇 2 × 200𝜋
𝑤1′
= tan � � = tan = 0.3249
2 2000 × 2

𝑤2 𝑇 2 × 300𝜋
𝑤2 = tan � � = tan = 0.5095
2 2000 × 2
𝑤02 = 𝑤1′ 𝑤2′ = 0.3249 × 0.5095 = 0.1655
𝑊 = 𝑤2− − 𝑤1− = 0.5095 − 0.3249 = 0.1846
A first order normalized analogue filter is
1
𝐻 (𝑠) = (𝐸𝑥. 7.8.1)
𝑠+1
Using the low pass to band pass filter eq(7.18c)
′(
1
𝐻 𝑠) = 𝐻(𝑠)| 𝑠 2 +𝑤02 = 2
𝑠= 𝑠 + 𝑤02
𝑊𝑠 + 1
𝑊𝑠

𝑊𝑆
= 2 … [𝐸𝑥. 7.8.2]
𝑠 + 𝑊𝑆 + 𝑤02
Applying the BZT to the analogue band pass filter
𝑊 (𝑧 − 1)
𝐻 ′ (𝑠) = 𝐻 (𝑠)| (𝑧−1) = 𝑧+1
𝑠= 𝑊 (𝑧 − 1)
(𝑧+1) [(𝑧 − 1)/(𝑧 + 1)]2 + + 𝑤02
𝑧+1
𝑊(𝑧 2 − 1)/(1 + 𝑊 + 𝑤02 )
=
2 2(𝑤02 − 1) 2 2
𝑧 +� 2 � 𝑧 + (1 − 𝑊 + 𝑤0 )/(1 + 𝑊 + 𝑤0 )
1 + 𝑊 + 𝑤0
Substituting the value of 𝑤02 and W and simplifying we have
1 − 𝑧 −2
𝐻 (𝑧) = 0.1367 … (𝐸𝑥. 7.8.3)
1 − 1.2362𝑧 −1 + 0.7265𝑧 −2

18
Lect. 7, Asst. Prof. Dr. Hadi T. Ziboon, Department of Electrical Eng. U.O.T

The pole-zero diagrams of the normalized LPF, the analogue band


pass filter and the discrete band pass filter are shown in fig (ex. 7.8).
using transfer function H(s), 𝐻′ (𝑠) and H(z) according eqs.
Ex.[7.8.1, 7.8.2, 7.8.3].
s-plane Im s-plane Im

R R

(a) (b)
Im

z-plane
R

(c)
a) Pole-zero diagrams for a reference LPF eq(7.8.1)
b) Intermediate analogue band pass filter eq(7.8.2)
c) Discrete band pass filters by BZT eq(7.8.3)
1
𝐻(𝑠) = … (7.8.1)
𝑠+1
1
𝐻 − (𝑠) = … (7.8.2)
𝑠 2 +𝑊𝑠+𝑤02
1−𝑧 −2
𝐻(𝑠) = … (7.8.3)
1−1.2362 𝑧 −1 +0.7265 𝑧 −2

19

You might also like