0% found this document useful (0 votes)
129 views154 pages

Lecture Notes ٠٧٢٨٣٢

This document discusses fundamentals of digital signal processing and computer networks. For digital signal processing, it covers topics like time and frequency domain analysis, discrete Fourier transforms, digital filter design including IIR and FIR filters. For computer networks, it discusses the OSI model, TCP/IP model, physical layer, data link layer, network layer, transport layer and application layer. It also lists some textbooks 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)
129 views154 pages

Lecture Notes ٠٧٢٨٣٢

This document discusses fundamentals of digital signal processing and computer networks. For digital signal processing, it covers topics like time and frequency domain analysis, discrete Fourier transforms, digital filter design including IIR and FIR filters. For computer networks, it discusses the OSI model, TCP/IP model, physical layer, data link layer, network layer, transport layer and application layer. It also lists some textbooks 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

Fundamentals of Digital

Signal Processing
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
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
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
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
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 { } …… (1.1b)
5
y[n]= F{x[n] + x[n-1] + x[n-2] + ……….. + x [n-N]}
y[n] = F { } ……… (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
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.4)

7
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.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) =3
0 3 ( )
/ H(f) /
Reconstructed filter

(b) =2 =6

0 3 6

aliasing / H(f) / 3 6a aliasing

(c)

<2 =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)
b) Reconstructing filter is used to recover the original signal. The filter type is low pass filter.

8
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 encode2 = 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

is± half quantization level. With 3 bite code the error ± of the total

available amplitude range. This error is called quantization noise.

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

9
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
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)

Fig (1.7) shows unit step

1.4.2Unite impulse function

n]

1
fig (1.8) unit impulse function n
The relationship between unite step and unite impulse is given by
…. (1.9)
11
recurrence
formula:
– 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
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) -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
-

13
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]

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

[ ] = Ae 0 …. (1.13)
0 <0
we can make use
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

[ ]= = =
Hence [ + 1] = =[ ] = [ ] …. (1.15)
14
e) If we 1.12) to be purely imaginary.
Let us consider 1.16)
Where = 1,
= =
…….. (1.17)
Eq (1.17) contains a cosin real part and sin imaginary part. However we
-
[ ]= = cos( ) ( )
f) By adding ,
[ ]+ [ ]= cos( )+ ( )+
cos( ) ( )
[ ]+ [ ]=2 cos( ) …. (1.18)
1 1
cos( )= [ ]+ [ ]
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 and
=2 ( )
( ) ( )
( )= … (1.20)

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


pair of imaginary exponentials.

15
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.22)

Hence x[n] is only periodic if is a rational number (the ratio of two

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.

But one completes period corresponding to

16
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.24b)

The digital signal is given by

since nT represents time in seconds , w must be an angular frequency in rad/sec. If

….. (1.26)

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

17
Ex (1.5) Sketch carefully, and defined the values for each samples of the
following signals:-
a) [ ] = (0.2 ) b) [ ] = cos( )

c) [ ] = ( ) ( ) d) [ ] = cos( ) [ ]
x[n](1.22)
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
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 [ ]applied to a digital processor produced
[ ]and that input [ ] produced output [ ]. Then the process are is
linear if its response to { [ ] + [ ]} is { [ ] + [ ]}.
1.6.2 Furthermore, if an input [ ]produced output ay[n] where a is
constant coefficient or multiplier or a weighting factor.
In general the weighted sum of inputs
[ ]+ [ ]+ [ ]+ must produce the weighted sum of
outputs
[ ]+ [ ]+ [ ]+
Let us consider a system which squares each sample value applied to its
input. Thus for two different inputs applied separately, we have
= ( [ ]) = ( [ ]) …. (1.27)
When the same two inputs are summed, and applied simultaneously, the output is
={ [ ]+ [ ]}
= { [ ]} + { [ ]} + 2 [ ] [ ] … (1.28)

19
Eq(1.28) is not the sum of its responses to [ ] [ ] 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.

[ ] = { [ ]} = [ ] …. (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
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
[ ] = { [ ]}
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
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
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 > such that

( )= ( + ) where 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
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
/
= /
( ) …… (1.30)

b) A signal is defined as a power signal if it has nonzero but finite power (0 <
< ) for all time where
/
= /
( ) …… (1.31)

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

24
Time Domain Analysis
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

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
-1] x[n]
(e) fig(2.1) (a)

n
n
-2 -1 0 1 2 -2 -11 0 1 2
-2] x[-
(b)
(f)
n
n
-2 -1 0 1 2n -2 -1 0 1 2
x[-
Each of these is a unit impulse shiftedx[-
(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[n] for each n instant]


(d)

-2 -1 0 1 2 n

1
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[- - -1)


-2) ….. (2.1)
or

[ ]= [ ] [ ]…… (2.2)
Where the integer K takes all value between ±
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.

elsewhere.
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
fig (2.2).
From impulse response can be determined the system properties such as
causality,stability and memory.

2
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
Solution if the system causal, then h[n]

But

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

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
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-

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
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
2.3.2The Step Response
The unit step function u(n) is the running sum of the unit

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]:

…. (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
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) = 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) = 2.952

[4] = [3] + [4] = 3.3.616 and so on. The final value of s[n] forn
= 1+ + = <1

[ ] = 1 + 0.8 + (0.8) + (0.8) + = =5


.
s[n] s[n]
1 0.8 0.82 5
2.44
1.8

1
n 8 n
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
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

[ ]= [ ] [ ] … . (2.6 )

10
2) Linear convolution is used for aperiodic sequence and is given by
( )= ( ) ( ) …. (2.6 b)

Where N= sequence length and = + 1


where =length of x[n]
and =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
{ [ ] [ ]} [ ]= [ ] { [ ] [ ]} ….. (2.8)
Eq(2.8) state that if two systems with impulse response [ ], [ ] are
connected in cascade an equivalent system is one that has a unit sample
response equal to the convolution of [ ] and [ ]:

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

[ ]= [ ]+ [ ] …. (2.11)

Fig (2.5)shows the interpretation of these properties.


11
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
[ ]= [ ] [ ]= [ ] [ ]

= [ ] [ ]

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+ + + + …+

1
[ ]=
1
Therefore [ ] = [ ]

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
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
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[- x[-1]h(n+1)

1 1 2
n n

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

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

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

3 3 n n

- -2) -3
1

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

15
n
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
[ ]= [ ] [ ] k=0 2
1
[ ]= [ ] [ ] n
4 2 k=-1 [lag]
h[n-k] 1 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

[1] = [ ] [1 ]

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


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

[2] = [ ] [2 ]

[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] + [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
Ex2.9 Find the linear convolution between
[ ] = 1,2,3,4 0
[ ] = 4,3,2,1 0
Solution:- [ ]= [ ] [ ]
+ 1=2 1=2×4 1=7 = =4

[ ]= [ ] [ ]

[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

[1] = [ ] [1 ]

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.

[4] = [ ] [4 ]

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
The Convolution Integral
If the input consists of a continuous of impulses the convolution
sum may be replaced by integral and become

( )= ( ) ( ) [ ]= [ ] [ ]

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)
fig (a) has to be replaced by fig(b)
3) (c) to form h(-

4) h(-
-
each of these stages
there is corresponding convolution integral.

18
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- h(t-
h(- 2 2

-2 -2 0 3
(c) (d) stage(1) overlap (e) stage(2a)

3 3 3
h(t- overlap h(t- overlap
2 2 2 h(t-

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

3 x(t)
2 h(t-

(i)stage(5)
(a) Stage 1: t<0 and h(t-
( ) ( ) = 0 for all t
(b) Stage 2: 0 < 2 -
fig(e) and (f) y(t)
( )= ( ) ( ) 12

= 3×2 = 6[ ] = 6 0< 2

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

19
(c) Stage 3: 2 3 and there is complete overlap because x(t) and h(t- shown
in fig(g).

( )= 3×2 = [6 ] 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×2 = [6 ] 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
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] + [ 2] + [ 3] +
[ 1] + [ 1] + [ 2]… (2.11)
To make the equation even more general we allow an arbitrary number of
terms and rewrite eq (2.11) as follows
[ ]+ [ 1] + [ 2] +
= [ ]+ [ 1] + [ 2] + ….(2.11b)

Or

… (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
Frequency Domain Analysis
(Discrete Fourier Series and the Fourier Transform)
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
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
/
= [ ] …. (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:
/
[ ]= …. (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
Ex(3.1)Determine the spectrum of the signals by using Fourier Series
a) [ ] = cos 2
b) [ ] = 1, 1, 0, 0 n>0
Solution
(a) 2 = 2 =
Since 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.
(b) = [ ] k=0, 1, 2, 3

= [ ]

1 /
= [ ]
4

1 1 1
= [ ] = [1 + 1 + 0 + 0] = < 0
4 4 2

1 ( ) 1
= [ ] = [ ]
4 4
1
= [0] + [1] + [2] + [3]
4
1 1
= 1+1 + 0 + 0 = [1 + ]
4 4 2 2
1 2
= [1 ]= <
4 4 4
In the same way fined =0 <0, = <
| |<

1/2

2/4 2/4 //4

0 1 2 3 k k

/4

3
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]
--------- ------------ ---------------- --------
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
= 0, = 1, = , = 1, = /2, = 1, =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
12 k
-2 -11 1 2 -2 -0.5

4
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
| [ ]| = | | … (3.3)
The average power of discrete- time periodic signal with period
N is defined as:

… (3.4)

[ ] / /
= since [ ] =

1
= ( [ ] )

= = | |

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

… (3.5)

5
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 and
Then
[ ]+ [ ] + … (3.6)
2) The time – shift
If x[n]
/ ….. (3.7)
Then [ ]
3) The differentiation
If x[n]

Then x[n]-x[n-1] [1 ] ….. (3.8)


4) The integration
If x[n] and
2 / 1
then [1 ] … (3.9)
5) Convolution
if the digital signals [ ] and [ ] have the same period.
[ ] and [ ]
Then 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
6) Modulation property of the discrete Fourier Series:
[ ] and [ ]
then
…. (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
/ ….. (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
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.
, 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=
then eq.(3.12) of the discrete Fourier series as
= [ ] ………………………(3.12)
( )= = [ ] …. (3.13)

Thus X
Using similar produce, we can derive the inverse transform
of X
[ ]= ( ) …. (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
Ex(3.3)Fined the Fourier transforms of aperiodic digital signal shown in
fig below. Sketch their magnitude over the range - and
discuss the result.

Solutionx(n)

[ ]= [ ] x[n]

where =

0.2 n

- - 0
( ) = 0.2{ [ 2] + [ 1] + [ ] + [ + 1] + [ + 2]}
Using the shifting property of the unit impulse
( ) = 0.2{ + +1+ + }
= 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

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

Solution x[n]

( )= [ ] 0.5

0.25

0.125 n

-22 -1
1 0 1 2 3 4

= 0.5 + 0.25 + 0.125 +

= 0.5(1 + 0.5 + 0.25 + ]

9
( ) = 0.5 = if a <1
.
2
+….]
.
if a=e-

0.5
| ( )| = /
[(1 0.5 ) + (0.5 ) ]
0.5
= /
[1 + 0.25 + 0.25 ]

]
1

1/3

0
Note that:-
1- If = 0, | ( )| = 1 and is max.

2- If = , | ( )| = and is min.

3- X( )
3.6 Properties of Fourier Transfers of the aperiodic digital
1) Linearity: If [ ] ( ) and [ ] ( )
Then

2) Time shifting : x[n] X( )

Then

3) Convolution: If [ ] ( ) , [ ] ( )

Then 1 [ ] 2( ) 1[ ] × 2( )

10
3.7Frequency 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)

Digital LTI System


Input Signal Output Signal

Time domain x[n] h[n] y[n] = x[n] [ ]


( ) = X( )H( )
Where h[n] is the impulse response.

In general we -
( )
… (3.15)
( )
Also … (3.15)

[ ( ) ( )]
( ) ( ) = | ( )|| ( )| …(3.17)

Fourier Transform pair

Now the spectrum of a unit impulse is unity

System frequency response

11
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
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)
The system described by eq (3.18) is the simplest possible
recursive system described by LCCDE. The general form for such
an equation is

[ ]= [ ]…. (3.20)
The integer N is called the order of the DE or the order of the
system.

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

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
[ ]= [ ]…. (1)
= 1‚ = 0.8‚ = 1‚ = 1
But the F.T for eq(1) is given by

( ) = ( )

1 + ( 1) 1 1
= =
1 + (0.8) 1 + 0.8
1 +
=
1 0.8 + 0.8
Note F.T for both sides of eq(1) is given by

[ ] = [ ]

14
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
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.

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

…. (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
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 poi
excluded, because ( > 0)
( > 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.

( )= [ ] = +3 +5 +3 +

RCO is everywhere in the Z plane except at

17
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 +

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

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

( )= [ ]

( )=

( )=1+ + + +
The series is convergence if | | < 1 or equivalently if | | > 1. Thus
we may express X(z) in closed form if | | > 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
( )=
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+ + + +
= region of convergence
1 1 1
( )= 1+ +( ) +( ) +
2 2 2
= =2 thus X(z) converges
If = (inside the circle)
1 1 1
( )=1+ +( ) +( ) +
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
[ ]= { ( )} …. (3.24)

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

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 ] + [1 ] + [2] + ... (3.25)

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

( )= …. (3.26)

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 by


long division

+ + + +
( )=
+ + + +

= (0) + (1) + (2) + (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 + 0.356

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
1+3 + 3.6439 + 2.5756 +

1+ + 0.3561 1+2 +

1± 0.3561
3 + 0.6439

3 ±3 1.0683

3.6439 1.0683

3.6439 ± 3.6439 1.2975927

2.5756 1.2975927

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 + +2 +1
( )= =
1 + 0.356156 + 0.3561

Either way, the z-transform is now expanded into

( )=1+3 + 3.6439 + 2.5756 + ….


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]+ ...
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-
given by k k

21
Partial Fraction

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


in z or and has the form

+ + + +
( )=
+ + + +

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

( )= + + + +
1 1 1

= + + + +

… (3.27)

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

…. (3.28)

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

1) If N<M, then 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 .
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
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 0.25 + 0.375
Solution: - for simplicity, we first express the z-transform in positive
power of z. multiply X(z) by .

( )= =( … (1)
. . . )( . )

( . )( . )
= .
+ .
= ( )…. (2)

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


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

and let z=-0.5 =

23
( )= + … (2)
. .

Substitute the value of and in eq(2)


( / ) ( / )
( )= + form the z-transform table 3, enter 14
. .

form the z-transform


transform table

( . )
.
= where =

( . )
.
= where = 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 + 0.3516

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

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

+ 0.3561 = 0

24
Using the formula

2
+ 0.3561 = 0

Where a and b are the coefficient of and z, and c is the coefficients


constant term (a=1, b=-1 and c=0.356)

1 + (1 4 × 0.3561)
= = 0.5 + 0.3257 =
2
1 (1 4 × 0.3561)
= = 0.5 0.3257 =
2
Where r=0.5967 and = 33.08

+2 +1
( )= = + +
( )( )
Using the procedure of EX. (3.12) to find
1
= = = 2.8082
0.356
= 6.06066 < 98.58
= 6.06066 < 98.58 =

( ) = 2.8082 + +

Using the table to find the inverse z-transform


(2.8082) = 2.8082 [ ] [using entry in table 3.1]

+ = 2 × 6.066(0.5967) cos (33.08 98.58)

[ ] = 2.8082 [ ] + 12.1213(0.5967) cos (33.08 98.58)


Using entry 16 in table 3.1

+ = 2| || | cos [ < +< ] [select the angle of P 1 and


C1]
25
3.8.3 Properties of the z-transform

1) Linearity
If [ ] ( )
[ ] ( )
Then [ ]+ [ ] ( )+ ( ) … (3.29)

2) Delay or shift
If [ ] ( )
[ ] ( )… (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

[ ] ( )
[ ] ( )
5) Differentiation or multiplication by n

If [ ] ( )
Then the z-transform of nx[n] can obtained by differentiating X(z)

( )
[ ]

26
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)

( )
( )= = … (3.32)
( )

The and are the coefficients of the filter.

- If H(z) has poles at = , ,…


And zero at = , , … . The H(z) can be factored and
represents as
( )( )… ( )
( )= )( )… (
… (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
Ex(3.12) Plot the z-plane poles and zeros of the following z-transform

( 1.2)( + 1)
H(z) =
( 0.5 + 0.5)( 0.5 0.5)( 0.8)

Solution: Im

Poles: = 0.5 0.5 0.5 + 0.5


= 0.5 + 0.5 0.8
= 0.8 Re
Zeros: = 1 -1 1.2
=0 0.5 0.5
=0
= 1.2
Ex 3.15Plot poles and zeros of the following z-transform
( )=( 1)( + 1)
Solution This function has zeros only. The five roots of 1 = 0 are
equally spaced around the unit circle. The two roots of + 1 = 0and at
=± .
To find the roots of 1 = 0 using the formula

= [ + ]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 2
= 0+ = 1 = 1 [ 72 ]
5
= 1 [0] = + jsin = 1
= 1 [72] = 72 + jsin72 = 0.3 + j0.9
= 1 [2 × 72] = 144 + jsin144 = 0.8 + j0.58
= 1 [3 × 72] = 216 + jsin216 = 0.8 j0.58
= 0.3 j0.5
Im

Re

28
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
( )( )….( ) ( )
( )= ( )( )….(
= … (3.30)
) ( )
- The frequency response is obtained by substituting = in
eq(3.30) and evaluation H( ) in the interval (0 /2).

29
( )
=
( )
…. (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

=
( )( )

= …. (3.32)

Where and represent the distance from zeros to the point =

Where and represent the distance from poles to the point = =

- Thus the magnitude and phase responses for the system, from eq 3.32
= =1 < = + ( + ) (3.32a)

Im
P

Re

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,

…..
= 2 1
…..
< = + + + ( + + + ) 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
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

( )= P

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


Shown in fig (a) (a) WT=0
+1
=
0.707
( )
= ( )
Im
.

( )

1- At dc wT=0 Re
1+1+0
= = 6.828 < 0
1 0.707 + 0
As shown in fig(a)

2- At = /8, = = =

the pole and zero vector is shown in fig b Im

= Re
.

. .
= = 2.6131 < 67.5
.

31
ie. responses at remaining frequency, obtained in a similar way, are
summarized below.
Im Im
P

P Re P Re

W(rad/sec) WT (rad) | ( )| < ( ) degree


0 0 6.828 0
\8 2.6131 67.5
\4 1.1547 -80.26
3 \8 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
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

… (3.33)
Where h(n) is the impulse response of the system

33
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 cos +

Im

Re

Fig(3.6)

Or

( )[ 2 cos + ]= [ ]

The corresponding difference equation is


[ + 2] 2 [ ] cos + [ ] = [ ]
By subtracting (2) from both sides
[ ] = 2 cos [ 1] [ 2] + [ 2]
The processor will only be stable if r <1.
34
Discrete Fourier Transform (DFT) and
Fast Fourier Transform (FFT)
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
- The DFT of x[nT] is then defined as the sequence of complex value
( ) = (0). ( ). (2 ). … . ( 1) in the frequency domain,

have real and imaginary components in general so that for the


harmonic
( )= ( )+ ( ) … (4.1)

and | ( )| = ( )+ ( )

( )
and X(k) has a phase angle = ( )
… (4.2)

- 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

( )= [ ] = [ ] ..(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 dt Fourier Trasform

[ ] = ( ). =2 / . = =
- The relationship between DFT and Fourier transform is given by

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
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
-1=3]. Using
eq(4.3).

( )= [ ] where k=0,1,2,3
If k=0,

(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,
( )
(1 ) = [ ] =
2 3
=1+0+0+ 4 (1)(3) =1+ 2
2 2
= 1 + cos( ) sin = 1+
3 3
2V and phase angle
2
(1 )= 1 = 45 , = .
If k=2,
( )
(2 ) = [ ] =
2
=1+0+0+ 4 (2)(3) =1+ 3

=1 1=0
(2 )=0.
If k=3,
( )
(3 ) = [ ] =
9
=1+0+0+ 2 =1
-j is complex with magnitude 2V and phase angle
-45 .

3
Thus the time series [1, 0, 0,1] has the DFT given by the sequence
[2,1+j,0,1-j]. x[nT] (a)
To fined = 1 1 =
×
= 125

125 250 375 t( )


( )
×
=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
Fig (b) shows | ( )| versus 45
Fig (c) shows
12.5 25.14 37.71 50.28 ( )
45
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

Solution the

( )= [ ]

( )
( + ) = [ ] = [ ]

= [ ] = ( ) Since =1

4
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

[ ]= ( ) …. (4.4)

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

1
= ( )

[ ]= ( ) … (4.5)

E.x 4.3 Calculate the IDFT from its DFT components [2, 1+j, 0, 1-j]

Solution [ ]= ( )

For n=0 , [0] = [ (0) + (1) + (2) + (3)]


1
= [ 2 + (1 + ) + 0 + (1 )] = 1
4

For n=1, [ ]= [ ]= ( )

1
= ( )
4

1
2 + (1 + )
= + 0 + (1 )
4
1
= [ 2 + (1 + ) + (1 )( )] = 0
4
For =2 [2 ] = 0
For =3 [3 ] = 1

5
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
[ ]= | ( )| … (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
[ ]= [ ] [ ]= [ ( ) ( )] … (4.10)
Where denote circular convolution, and [ ], [ ]and [ ] are finite
sequence of equal length.
Further more ( )= ( ) ( ) … (4.11)
Where ( )= [ [ ]] … (4.12)
(b) Frequency Convolution
( ) ( )= [ [ ] [ ]] …. (4.13)

Where ( ) ( )= ( ) ( ) …. (4.14)

6
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
( )= /
[ ] where k=0,1,2,…,7

( ) = [0] + [1] + [2] + [3]


+ [4] + [5] + [6] + [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 8 = 64 complex multiplication

8 × 7 = 56 complex addition

For 1024 point DFT required (1024) 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 =
/ /
if =2 =1 =
- 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
The N-point DFT of an N-point sequence x[n] requires 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) multiplication and the
same number of addition. Thus the two DFT's required
2(N/2) = multiplication and add. Thus, it is possible to fined
the N-point DFT of x[n] from these two N/2 point DFT with
reduction of the number of multiplies and add by factor .

- The equation (4.3) will be written

( ) [ ] = [ ] … (4.15)

Where = is called twiddle factor, k=0,1,2, …. ,N-1

= = = =

( ) / ( )( )
= =

= =

Summarizing the useful results concerning :-

= … (4.16a)

= / …. (4.16b)

( )
= …. (4.16c)

8
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

( )= /
[ ] =

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)

( )
( )= () + () …. (4.17b)

( )
Because = / = = / = /

( )= () / + () / … (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)

( )
= = / = /

( )= ( )+ ( ) … (4.19)
9
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)

Therefore, X(k) may be computed from the N/2 point DFT's G(k) and
H(k) because
/ /
= = … (4.21a)

+ = ( ) …. (4.21b)

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

( )= [ ] / = [ ] / + [ ] / … (4.22)
As before G(k) can be simplified to

( )= [2 ] / + / [2 + 1] / ….. (4.23)

10
( )= [2 ] / + / [2 + 1] / ….. (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
/
= 1.
Fig(4.5)

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

11
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 = stages of computation. Because each
requires N/2 complex multiplication by the twiddle factors and N
complex addition, these are a total of complex multiplications

and 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
000 000
100 001
010 010
110 011
001 100
101 101
011 110
111 111

12
Pass1 pass2 G1 pass3
x[0] X(0)

W 2
x[4] X(1)
-1
G3
x[2] X(2)

W 4
x[6] X(3)
-1
W
x[1] X(4)
-1 H0 -1
W W
x[5] X(5)
-1 -1 H1 -1
W
x[3] X(6)
-1 H2 -1
W W
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
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 ) = [ ] … (4.24)
Separating this sum into the first N/2 points and the last N/2 points
/
(2 ) = [ ] / + / [ ] / … (4.25)

Because = /

With a change in the indexing on the second sum we have


/ ( )
(2 ) = [ ] / + / [ + ] /

( )
Finally because /
= /

/
(2 + 1) = [ [ ] + ] / … (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) = [ [ ] + ] / … (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)
W
x[4] X(1)
-1 W
x[5]
4-point X(3)
-1 W
x[6] DFT X(5)
-1 W
x[7] X(7)
-1

14
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] W G(1) X(1)

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


W W
x[3] H(1) X(3)
The flow graph of the FFT is given in fig (4.4)
(0) = (0) + (0) = (0) + (0)
(0) = (0) + (2) = [0] + [2]
(0) = (1) + (3) = [1] + [3]
Since = 1 substituting values gives
(0) = [0] + [1] + [2] + [3] = 1 + 0 + 0 + 1 = 2
(1) = (1) + (1)
(1) = (0) (2) = [0] [2]
(1) = (1) (3) = [1] [3]
/ /
Since = =

X(1) = x[0] x[2] + [1] [3]

=1 0 + cos sin [0 1]
2 2
(1) = 1 0 + [0 ][ 1] = 1 +
(2) = (0) (0) = (0) (0)
(2) = [0] + [2] [1] + [3] = 1 + 0 0 1=0

(3) = (1) (1) = x[0] x[2] [1] [3]

(3) = 1 0 cos + sin [0 1] = 1


2 2
15
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] G(1) X(1)

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


W Type equation here . W
x[3] H(1) X(3)
(0) = (0) + (0) = (0) + (0)
(0) = (0) + (2) = [0] + [2]
(0) = (1) + (3) = [1] + [3]
Since = 1 substituting values gives
(0) = [0] + [1] + [2] + [3] = 0.5 + 1 + 1 + 0.5 = 3
(1) = (1) + (1)
(1) = [0] [2] = [0] [2]
(1) = (1) (3) = [1] [3]
/ /
Since = =

X(1) = x[0] x[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
A framework for digital filter design
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] … (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
[ ]= [ ]+ [ 1] … (5.2)
- The second is a recursive system described by
[ ]= [ 1] + [ ] … (5.3)
Fig (5.1)
x[n] v[n] y[n] x[n] w[n] y[n]
+ + + +

(a) (b)

x[n] w[n] y[n]


+ +

w(n-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] [n] [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
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] + [ ] … (5.4)

[ ]= [ ]+ [ 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
[ ]= [ ]+ [ ]… (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

… (5.7)

And a recursive system

… (5.8)

2
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

[ ]= ( ) + [ ] … (5.9)

For nonrecursive system

[ ]= ( ) … (5.10)

x[n] v[n] y[n] x[n] w[n] y[n]


+ + + +

+ + + +

+ +
+ +

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
- 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)
[ ]= [ ]+ [ ] … (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] [ 2] + [ ]+ [ 1] +
[ 2] …. (5.11)
- The direct form II structure for realizing this system is shown in fig
(5.4a). If we set = = 0 then reduced to
[ ]= [ ]+ [ 1] + [ 2] …. (5.12)
Eq(5.12) represents special case of FIR system.
- If we set = = 0 , we obtain purely recursive second order
system described by difference equation
[ ]= [ 1] [ 2] + [ ] …. (5.13)
- Eq (5.12) and (5.13) are shown in fig (5.4b) and fig (5.4c).

x[n] x[n] w y[n]


+ +

b2 y[n]
+ + + +

(b)

x[n] y[n]
+ +
(a)

(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
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

[ ]= [ ]+ [ 1] + [ 1]

Solution

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


+ +

Block diagram
Using the same procedure in fig (5.1)

5
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
x(t) filter process
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
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
[ ]= ( ) ( ) …. (5.14) for IIR
[ ]= ( ) ( ) …. (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
[ ]= ( ) ( )

= [ ] [ ] … (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
( )= ( ) … (5.17a) FIR

( )= … (5.17b) IIR

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
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] [ 2] + [ ]+ [ 1] +
[ 2]

2) [ ] = [ ]

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
The corresponding set of difference equations for M=N=2
[ ]= [ ] [ 1] [ 2] … (5.9)
[ ]= [ ]+ [ 1] + [ 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] y[n]
+ +

(1) (IIR)
+ +

x[n] x[n-1] x[n-2] x[n-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
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 …. (5.18a)
( ) = 20log (1 + ) …. (5.18b)

11
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 (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
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]
+ +

+ + H(z)=

[ ]= [ ]
4
=1 [ ]
+ +

fig (5.4a) Direct realization


+ +
a fourth order IIR filter

13
x[n] ( ) [ ] ( ) y[n]
+ + + +

+ + + +

Fig (5.4b) cascade realization of a fourth order IIR filter


( )= Transfer function
[ ]= [ ] [ ] [ 2] Difference
[ ]= [ ]+ [ 1] + [ 2] equation
[ ]= [ ] [ ] [ 2]
[ ]= [ ]+ [ 1] + [ 2]
[ ] [ ] fig (5.4c) parallel realization
+ + of a fourth order IIR filter

( )= +
+

x[n] [ ] [ ] y[n]
+ + +

[ ]= [ ] [ ] [ 2]
[ ]= [ ] [ ] [ 2]
[ ]= [ ]+ [ 1]
+ [ ]= [ ]+ [ 2]
[ ]= [ ]

[ ]
C [ ]= [ ]+ [ ]+ [ ]

14
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]

[ ]= [ ]

( )=

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
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)

[ ]
+
x[n]
+
[ ]
Fig (5.6a) basic lattice structure.

stage1 [ ] stage2 [ ]
+ +
x[n]

+ [ ] + [ ]
Fig (5.6b) 2-stage FIR

x[n] stage1 [ ] stage2 [ ]


+ +

+ +
16
[ ] [ ] 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 + 0.9025
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
[ ] = [ ] + [1] [ 1] + [2] [ 2] … (2) by using IZT

But ( ) = 1 1.3435 + 0.9025 … (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 [ ] stage2
+
[ ]
+
x[n]

+ +
Fig (5.4b) [ ] [ ]

[ ]= + [ 1] [ ]= [ 1] + [ ]

[ 1] = [ 2] + [ 1]

= [ ]+ [ 1] + { [ 2] + [ 1]}

[ ]= [ ]+ [ 1] + [ 2] + [ 1]

[ ]= [ ]+ (1 + ) [ 1] + [ 2]… (3)

[ ] = [ ] + [1] [ 1] + [2] [ 2] ….. (2)


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

(1 + ) = [1]
[1]
= , = [2]
1 + [2]
1.3425
= = 0.706 , = 0.9025
1 + 0.9025

18
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
Finite Impulse response (FIR) filter design
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

[ ]= [ ] [ ] … (6.1a)
k=0,1,2,… N

( )= ( ) … (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
= ( )/ …. (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
… (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
(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

( )= [ ] Substitute = ( )

( )= ( )

= [0] + [1] + [2] + [3] + [4]


+ [5] + [6]

3
( )= [ [0] + [1] + [2] + [3] + [4]
+ [5] + [6] ]
Using the summitry condition we can group terms whose coefficients are
numerically equal
( )= [ [0]( + ) + [1]( + )
+ [2]( + ) + [3]
( )= [2 [0] cos(3 )
+ 2 [1] cos(2 ) + 2 [2] cos( ) + [3]]
Since we have n=7, symmetrical at n= =3
- 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
( )= [ ] cos ( ) … (1a)
( )
= ±| ( )| …. (1b)

± | ( )| = ( ) cos

( )= 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
symmetrical n= 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]

( )= [0] + + [1] + + [2] +

+ [3] +
7 5 3
= [2 [0] cos + 2 [1] cos + 2 [2] cos + 2 [3] cos ]
2 2 2 2
( )
= ±| ( )|
Where ±| ( )| = [ ] cos[ ]
7
( )= [ ]=2
2 2
Thus also the phase response is linear.

4
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
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.
[ ]= ( ) …. (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
( )
[ ]=2 =2 = 2 cos =2 =0
( )

( )

Fig (6.2)
[ ]

6
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
[ ] . . . .…

- 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
- 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 ,
[ ] = 0.54 + 0.46 cos 2 2 (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
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.0625 [The normalized transition bandwidth]
Using eq (6.12) to find N
. .
But = = .
= 52.8 53
The filter coefficients are obtained from [ [ ] [ ]]
( )
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
.

9
.
The normalized = = 0.21875
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( ) × .
- n=1, [ ]= = sin(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
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
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
( )
[ ]= ( ) … (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)
( )
[ ]= [ 2| ( )| cos |[ ]| + (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)

H(k)

(b)

4 5 6 7 8 9 10 12 14 k

| ( )|

(c)
W

12
- 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 ( )
[ ] == [ 2| ( )| cos |[ ]| + (0)]

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
- 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

= 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
Design of infinite impulse response
(IIR) digital filter
7.1 Design of infinite impulse response (IIR) digital filter
Realization IIR digital filters are characterized by the following recursive
difference equation

[ ]= [ ] [ ]= [ ] [ ] … (7.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

+ + +
( )= = … (7.2)
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
( )( )… ( )
( )= … (7.3)
( )( )… ( )

1
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:-
passband ripple parameter where the passband ripple is
passband deviation = 20 Log (1 + )
stopband deviation = 20 Log(1
and passband edge frequency and the stopband ripple is
and stopband edge frequency = 20 Log
- Passbnad and stopband deviations may be expressed as ordinary
number as in decibels.
|H(f)|
1
passband ripple
1
1+

/2 f

2
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
0 f
(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
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
360 × = 180 the unit circle.
(2) To have the passband centered at 125Hz requires us to place poles at
±360 × = ±90 .
(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) 1
( )= = ( )
+ 0.877969

1
= ( ( ) )
1 + 0.877969
Im

0.937
Re

-0.937

4
To find the difference equation, using the IZT
( ) 1
=
( ) 1 + 0.877969
( )[1 + 0.877969 ] = ( )[1 ]
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)
= 1. = 0. = 1
= 0. = 0.87796
-0.87796
Note:
The general equation of 2nd order is given by

[ ]= [ ] [ ]

= [ ]+ [ 1] + [ 2] [ 1] + [ 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
the unit circle correspond 50Hz that is at angle 360 × = ±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
±
=1 =1 =1 = 0.937 [ = 2 × 5 = 10 ]

3) The pole-zero diagrams in fig (7.2a). From the figure, the transfer
function of the filter is given by
( )( )
( )= . . where the angle of poles
( . )( . )

. . ( )
= = 360 × = 39.6
. . . .
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
= 1, = 1.618, = 1, = 1.5161, = 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
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 ( )= .

( )= [ ( )] = =

where 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

Since [z-transform of is given by = ]

Thus, form the result above, we can write

… . (7.5)
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
( )= + + . … . (7.6)

Where the are the poles of H(s)

… (7.7)
1

7
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
+ + … (7.8)
1 1
+ ( + )
=
1 ( + ) +
If the poles , are complex conjugates, then will be also
be complex conjugates
[ ( ) ( )]
+ .(7.9)
( )
Where and are the real and imaginary of .
and are the real and imaginary of .

* 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 +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
1
( )= ( )| = =
+ 2 +1 + 2 +

= +

Where and can be find by set + 2 + =0

2 ± 2 4×1× 2 (1 ± )
= = = 666.4324(1 ± )
2 2
= 666.4324(1 + ), = = 666.4324(1 + )

= = 666.4324 , = = 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 and . (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.0308 + 0.3530
To keep the gain down and to avoid overflow when the filter is implemented
in practice H(z) is multiplied by = = = 0.78
.
0.3078
( )=
1 1.0308 + 0.35
Using the same procedure in ex. [7.1, 7.2] to find DE and coefficients
+
x[n] 0.308 y[n]

1.0308
.
. .
0.3530

9
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
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
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
transfer function H(z) by replacing . (analogue)
Note = + = +
=
( )
= (digital)
( )
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.
Solution ( )= … . (7.5.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
( ) = ( )| = =
. +1 + 0.7265
0.7265
4) Using BZT
0.7265
( ) = ( )| =
1
+ 0.7265
+1
0.7265( + 1) 0.7265( + 1)
= =
1 + 0.7265(1 + ) (1 + 0.7265) + 0.7265 1

12
. ( )
H(z) = 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 +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
The prewarped analogue filter is given by
1
( )= ( )| =
+ 2 +1
( ) 0.1488
( )= =
+ 2 +( ) + 0.5455 + 0.1488
Applying the BTZ gives
0.0878(1 2 + )
( )=
1 1.0048 + 0.356
See Ex 7.5 for the DE and block diagram.

13
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
( )
Now we replace =
( )

( )= ( )|

1 1
= =
( 1) ( 1)
cot 2 +1
+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


combined into one transformation = [cot ][ ].

14
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
| ( )| = … . (7.11) |H(f)|
( / )

Where N is the order of the filter 1 Buttefly response

is the 3dB cutoff frequency 0.707

- The stopband attenuation = 20


- The filter order is
f
1
1
… (7.12)
20
7.5.2 Chebyshev Filter
| ( )| = … (7.13)
1+

Where is the chebyshev polynomial and N order of the filter


determine the passband ripple in decibel
Passband ripple 10 [1 + ]= 20 [1 ] … (7.14)
|H(f)|
1 Chebyshev
1 response

- 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
Stopband attenuation 20 ( )

… . (7.15)

Where = , is the stopband frequency, and are the


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, .
(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

= ... (7.18c) low pass to band pass

= ... (7.18d) low pass to band stop

= =
= tan ( )
= tan ( )
(4) Apply BZT to the new H(s)
1
=
+1

16
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 × 30
= tan = 0.7265
2 × 150
- The s-plane transfer function of the low pass filter is given by
( )= …(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 + 0.7265
+1 +1
The z-plane transfer function is obtained by applying the BZT
( )/( )
( )= ( )| = =( ) ( ) .
.
1 1
1 1
( )= =
(1 1 )+( 1
+ 1)0.7265 1.7265 0.2735 1

1
( ) = 0.5792
1 + 0.1584
( )
To fined DE
( )
= 0.5792 .
( )[1 + 0.1584 ] = 0.5792(1 ) ( )
Using IZT
[ ]= 0.158 [ 1] + 0.5791 [ ] 0.5791 [ 1]
Compare y[n] with eq (7.1)

[ ]= [ ] [ ]

17
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
2 × 200
= tan = tan = 0.3249
2 2000 × 2
2 × 300
= tan = tan = 0.5095
2 2000 × 2
= = 0.3249 × 0.5095 = 0.1655
= = 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
( )= ( )| =
+
+1

= …[ . 7.8.2]
+ +
Applying the BZT to the analogue band pass filter
( 1)
( ) = ( )| = +1
( )
( 1)
( ) [( 1)/( + 1)] + +
+1
( 1)/(1 + + )
=
2( 1)
+ + (1 + )/(1 + + )
1+ +
Substituting the value of and W and simplifying we have
1
( ) = 0.1367 … ( . 7.8.3)
1 1.2362 + 0.7265

18
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)
… (7.8.1)

… (7.8.2)

… (7.8.3)
. .

19

You might also like