DSP Lectures
DSP Lectures
Lect 1
Fundamentals of Digital
Signal Processing
1.1 Introduction
Signal and systems representation, representation of signals in
time, sampling and analog to signal conversion.
1.2 Time domain analysis
Linear time invariant systems, impulse response and convolution
sum.
1.3 Frequency Domain Analysis and Z-Transform
Linear constant-coefficient difference equation, Fourier transform
and frequency response, z-transform.
1.4 Discrete Fourier Transforms (DFT) and FFT
Signal analysis and synthesis based on DFT, Fast Fourier
Transform (FFT).
1.5 Filter Analysis
Fundamental structures of digital filter.
1.6 Infinite Impulse Response (IIR) Digital filter
1.7 Finite Impulse Response (FIR) Digital Filter
1
Lect. 1, Asst. Prof. Dr. Hadi T. Ziboon, Department of Electrical Eng. U.O.T
Computer Network
2.1 Introduction
Internet architecture, OSI and TCP / IP reference models, network
history and standardization, network topology, LAN, MAN and WAN.
2.2 Physical Layer
Theoretical basis, various transmission medias, various well know
networks, multiplexing, switching.
2.3 Data link layer
Framing, error control (detection and correction), flow control.
2.4 Network layer
Routing, network control, IP protocols, routing and control protocols.
2.5 Transport layer
Reliable end – end data transfer principles, flow control, end-end
congestion control, UDP, TCP.
2.6 Application layer
WWW, FTP, Email, DNS, Multimedia.
2.7 Network security
Text Books
[1]Introduction to digital signal processing with computer application,
Paul Lynng 1993.
[2] Digital Signal Processing, Li Tan 2008.
[3] Data Communication and computer Network Behrous Feourozon,
2007.
2
Lect. 1, Asst. Prof. Dr. Hadi T. Ziboon, Department of Electrical Eng. U.O.T
1. Introduction
1.1 The scope of digital signal processing (DSP)
1.1 DSP techniques are now used to analyze and process signals and
data arising in many areas of engineering, science, medicine, economics
and the social sciences.
1.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.
1.4 Various terms are used to describe signals in the DSP environment.
3
Lect. 1, Asst. Prof. Dr. Hadi T. Ziboon, Department of Electrical Eng. U.O.T
1.7 In practice, the term discrete time signal and digital are often used
interchangeably.
x[n] y[n]
x[n] y[n]
DSP
n=0 T nT n
4
Lect. 1, Asst. Prof. Dr. Hadi T. Ziboon, Department of Electrical Eng. U.O.T
y[n] = F { ∑𝑁
𝑘=0 𝑥[𝑛 − 𝑘]} …… (1.1b)
5
Lect. 1, Asst. Prof. Dr. Hadi T. Ziboon, Department of Electrical Eng. U.O.T
6
Lect. 1, Asst. Prof. Dr. Hadi T. Ziboon, Department of Electrical Eng. U.O.T
n
n
1.3.3 Alternatively, if we have a digital system with sampling interval T, the maximum analog
frequency is called the Nyquist frequency and is given by
1 𝜋
𝑓1 = 2𝑇 𝐻𝑧 𝑜𝑟 𝑊1 = 2𝜋𝑓1 = 𝑇 𝑟𝑎𝑑𝑖𝑎𝑛𝑠/𝑠 ……… (1.5)
3.4 Fig (1.4a) represents the frequency distribution or spectrum of an analog speech signal. There
are no components above maximum frequency.
/ H(f) /
(a) 𝑓1 𝑓1 = 3𝐾𝐻𝑧
0 3𝑓(𝐾𝐻𝑧)
/ H(f) /
Reconstructed filter
0 3 6
(c)
f
Fig (1.4) The effects of sampling on a signal spectrum.
From fig (1.4) can be concluded:-
a) The spectrum as an even function, extending to negative frequencies. This widely used
representation results from expressing each frequency component as the sum of two
exponentials. Thus a component Acoswt may be written as
𝐴 𝐴
𝐴𝑐𝑜𝑠(𝑤𝑡) = 𝑒 𝑗𝑤𝑡 + 𝑒 −𝑗𝑤𝑡 …. (1.6)
2 2
b) Reconstructing filter is used to recover the original signal. The filter type is low pass filter.
8
Lect. 1, Asst. Prof. Dr. Hadi T. Ziboon, Department of Electrical Eng. U.O.T
a) With 3 bit code, the separate sample values are 8. The total amplitude
range is divided into 8 quantization levels or slots.
b) The maximum error introduced into each sample value by this process
1
is± half quantization level. With 3 bite code the error ± of the total
16
9
Lect. 1, Asst. Prof. Dr. Hadi T. Ziboon, Department of Electrical Eng. U.O.T
1.3.8 After a signal has been processed digitally, it may be converted back to an
analog voltage using a digital to analog converted (DAC).
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.
2
n
7
5
DAC output
2
Time
Analog signal
Time
10
Lect. 1, Asst. Prof. Dr. Hadi T. Ziboon, Department of Electrical Eng. U.O.T
𝑢[𝑛]=0 𝑛<0
𝑢[𝑛]=1 𝑛≥0] … (1.7)
Fig (1.7) shows unit step
𝛿 [𝑛]=0 𝑛≠0
𝛿 [𝑛]=1 𝑛=0] … (1.8)1
fig (1.8) unit impulse function n
The relationship between unite step and unite impulse is given by
𝑢[𝑛] = ∑𝑛𝑚=−∞ 𝛿 (𝑚) …. (1.9)
11
Lect. 1, Asst. Prof. Dr. Hadi T. Ziboon, Department of Electrical Eng. U.O.T
for n<0
n
fig (1.9) The unit ramp function.
Ex 1.1Find expression for the following signal.x[n]
a) This is a unit step function which has been scaled
(Weighted) by of -2, it starts at n= - 4, rather than
n=0, and it is time reversed. n
-2
b) Scaling by -2gives the function -2u[n]
c) Time shifting so that it starts at n=-4
gives the function -2u[n=-4]
d) Reversal gives the function -2u[-n-4].Hence the required function is
𝑥 [𝑛] = −2𝑢[−𝑛 − 4] since 𝑢[𝑛] = 1 𝑛 > 0
= −2𝑢[−(𝑛 + 4)] = 0 𝑛 < 0
in this case reversal
12
Lect. 1, Asst. Prof. Dr. Hadi T. Ziboon, Department of Electrical Eng. U.O.T
13
Lect. 1, Asst. Prof. Dr. Hadi T. Ziboon, Department of Electrical Eng. U.O.T
𝑥[𝑛] = 𝐴 𝑒 𝛽𝑛 …. (1.12)
Where A and β are constants.
n n n
fig (1.10) Basic digital signal real exponentials.
c) Such real exponentials theoretically continue forever in both directions. In
practice, we work with defined signals in time such as
𝛽𝑛
x[n] = �Ae n≥0 …. (1.13)
0 n<0
we can make use of the fact that the unit step u[n] is zero for n<0 and unity for n ≥
0, if multiply or modulate an exponential by u[n], then x[n]
𝑥 [𝑛] = 𝐴 𝑒 𝛽𝑛 𝑢[𝑛] …. (1.14)
d) The successive sample values from a simple geometric progression each value
equals that of its neighbor, multiplied by constant βn.
∴𝑥 [𝑛] = 𝐴 𝑒 𝛽𝑛 = 𝐴𝐵𝑛 𝑤ℎ𝑒𝑟𝑒 𝐵 = 𝑒 𝛽
Hence 𝑥 [𝑛 + 1] = 𝐴𝐵𝑛+1 = [𝐴𝐵𝑛 ]𝐵 = 𝐵𝑥[𝑛] …. (1.15)
14
Lect. 1, Asst. Prof. Dr. Hadi T. Ziboon, Department of Electrical Eng. U.O.T
This result shows that a sampled cosine signal can be made up from a
pair of sampled imaginary exponentials
g) By subtracting 𝑥1 and 𝑥2
𝑥1 − 𝑥2 = 2𝑗 sin(𝑛𝛺)
𝐴 𝐴
∴ 𝐴 sin(𝑛𝛺) = 𝑒 𝑗(𝑛𝛺) − 𝑒 −𝑗(𝑛𝛺) … (1.20)
2𝑗 2𝑗
15
Lect. 1, Asst. Prof. Dr. Hadi T. Ziboon, Department of Electrical Eng. U.O.T
What is the difference between sampled sine and cosines and their
counterpart?
1) Analog sine and cosine signals are oscillatory and periodic sample sines and
cosines, however, are not necessarily periodic. Although their sample values lie on
a periodic envelope, the numerical values may not form a repetitive sequence. Fig
(1.11a) shows a discrete time sinusoid and fig (1.11b) shows a discrete time
cosinusoid both are periodic but fig (1.11c) shows a discrete time samples lies a
long a sinusoidal envelope, does not have repeating numerical values.
Exact repetition will only occur if the sampling interval bears some simpler
relationship to the repetition time or period of the analog signal. This means that
𝑥 [𝑛] = 𝐴 𝑒 𝑗𝑛𝛺 = 𝐴 𝑒 𝑗[𝑛+𝑁]𝛺 = 𝐴 𝑒 𝑗(𝑛𝛺) 𝑒 𝑗(𝑁𝛺) … (1.21)
𝛺 𝑚
NΩ = 2πm or
2𝜋
= 𝑁
…… (1.22)
𝛺
Hence x[n] is only periodic if is a rational number (the ratio of two
2𝜋
integer). Otherwise its sample values do not repeat.
x[n] x[n]
n n
Thus the sample series may be generated if both f and 𝑓𝑠 are know.
17
Lect. 1, Asst. Prof. Dr. Hadi T. Ziboon, Department of Electrical Eng. U.O.T
Ex (1.5) Sketch carefully, and defined the values for each samples of the
following signals:-
𝜋𝑛
a) 𝑥 [𝑛] = exp (0.2𝑛) b) 𝑥 [𝑛] = cos( )
4
𝑛 𝜋𝑛 −𝑛
c)𝑥 [𝑛] = exp( ) sin( ) d) 𝑥 [𝑛] = exp � � cos(𝑛)𝑢[𝑛]
15 6 5
x[n](1.22)2
1.22
1
0.22
n
n
(a) (b)
n n
(c) (d)
18
Lect. 1, Asst. Prof. Dr. Hadi T. Ziboon, Department of Electrical Eng. U.O.T
19
Lect. 1, Asst. Prof. Dr. Hadi T. Ziboon, Department of Electrical Eng. U.O.T
Eq(1.28) is not the sum of its responses to 𝑥1 [𝑛] 𝑎𝑛𝑑 𝑥2 [𝑛] applied
separately.
1.6.3 Frequency Preservation: - It means that if we apply an input signal
containing certain frequencies to a linear system, the output can contain
only the same frequencies and no others. The property depends upon the
fact a sampled sinusoid, applied to any linear processor; produce a
similar form of output.
This property does not hold for the squaring system mentioned above.
Suppose a signal sin(nΩ) is
∴ 𝑦[𝑛] = {𝑥1 [𝑛]}2 = 𝑠𝑖𝑛2 [𝑛𝛺] …. (1.29)
1 1 1
= {1 + cos[2𝑛𝛺]} = + cos [2𝑛𝛺]
2 2 2
Thus there is no component in output at frequency = Ω.
1.6.4 Time Invariance:-A time-invariant system is one whose properties
do not vary with time. The only effect of a time shift in an input signal to
the system is a corresponding time shift in its output. The majority of
technological systems and processes are of this type.
6.5 Association and Commutation
Association property means that we may analyze a complicated LTI
system by breaking it down into a number of simpler subsystems. Also,
we can synthesize an overall system perhaps a very complicated one by
designing a number of independent subsystems.
20
Lect. 1, Asst. Prof. Dr. Hadi T. Ziboon, Department of Electrical Eng. U.O.T
21
Lect. 1, Asst. Prof. Dr. Hadi T. Ziboon, Department of Electrical Eng. U.O.T
Ex (1.6) x[n] and y[n] are the input and output signals of a DSP system.
Determine which of the following properties and possessed by systems
defined by the recurrence formula (a) and (d) below:-
Linearity Invertibility Stability
Causality Time Invariance Memory
a) y[n]= 3x[n] – 4x[n-1]
b) y[n] = 2y[n-1] + x[n+2]
c) y[n] = n x[n]
d) y[n] = cos[x[n]]
Solution
a) – The output is a weighted sum of present and previous inputs
- It is bounded if the input is bounded.
- Thus the system has all six properties mentioned above.
b) – The present output depends on a future input, so the system is not causal.
- If the input signal ceases, the output goes on rising without limit, since each
output value twice the previous one. Therefore the system is unstable.
- However a possess the other properties mentioned above namely: linearity,
time-invariance, invertibility and memory.
c) – The output depends on the present input only, so the system has no
memory.
- Since it also depends on the independent variable, the system is time-variant
- But the system have the properties of linearity, causality, stability and
invertibility.
22
Lect. 1, Asst. Prof. Dr. Hadi T. Ziboon, Department of Electrical Eng. U.O.T
d) y[n] = cos[x[n]]
– A cosine function is periodic; so many different values of x[n]
would produce the same value of y[n]. Hence the system is not
invertible.
- It is not a linear because if we double x[n], we do not double y[n].
- Since y[n] depends only on x[n], the system has no memory.
- However, it is time invariant, causal and stable.
1.8. Classification of Signals
1.8.1 Deterministic and Random Signal
A signal can be classified as deterministic, meaning that there is no
uncertainty with respect to its value at any time or as random that there
is some degree uncertainty before the signal actually occurs.
23
Lect. 1, Asst. Prof. Dr. Hadi T. Ziboon, Department of Electrical Eng. U.O.T
time time
Analog continuous time Digital continuous time
time time
Analog discrete time Digital discrete time
b) A signal is defined as a power signal if it has nonzero but finite power (0 <
𝑃𝑥 < ∞) for all time where
1 𝑇/2
𝑃𝑥 = 𝑙𝑖𝑚 𝑇→∞ ∫−𝑇/2 𝑥 2 (𝑥) 𝑑𝑡 …… (1.31)
𝑇
In general:-
a) Periodic and random signal are classified as power signals.
b) Deterministic and nonperiodic signal classified as energy signals.
24
University of Technology
Department of Electrical Engineering
Lect2
The basic techniques for describing digital signals and processors in the time domain
are:-
a) Convolution:- allows us to find the output signal from any LTI processor in
response to any input.
b) Impulse response:- this is the response of the processor to the unit impulse
response δ(n).
The time domain methods are used for analysis and are not a great help in designing
new processor. The main reason is that the design specifications are based on
performance in the frequency domain. The convolution takes place in the time
domain, without any need to consider the frequency components of the input signal
and processor.
The digital signal x[n] is shown in fig(2.1) and it is clear that x[n] may be considered
as the superposition or summation of the more basic impulse signals shown in parts
x[1]δ[n-1] x[n]
(e) fig(2.1) (a)
n
n
-2 -1 0 1 2 -2 -1 0 1 2
x[2]δ[n-2] x[-2]δ[n+2]
(b)
(f)
n
n
-2 -1 0 1 2n -2 -1 0 1 2
x[-1]δ[n+1]
Each of these is a unit impulse shiftedx[-1]δ[n+1]
(c)
by 'n' samples which has been weighted
n
by the value of x[n] [ i.e the value of -2 -1 0 1 2
x[0]δ[n]
x[n] for each n instant]
(d)
-2 -1 0 1 2 n
1
Lect. 2, Asst. Prof. Dr. Hadi T. Ziboon, Department of Electrical Eng. U.O.T
Thus each of these signal shown in fig(a-f) is a unit impulse which has been weighted
by the appropriate value of x[n] [ i.e the value of x[n] is shown in part a], and shifted
by a number of sampling intervals.
𝑥[𝑛] = ∑∞
𝑘=−∞ 𝑥 [𝑘 ]𝛿[𝑛 − 𝑘]…… (2.2)
Where the integer K takes all value between ±∞, x[n] is a completely general digital
signal.
2
Lect. 2, Asst. Prof. Dr. Hadi T. Ziboon, Department of Electrical Eng. U.O.T
δ[n] h(n)
Digital LTI
processor
memoryless noncausal
n n
Ex 2.1
Find the first three sample values of the impulse response h[n]for the system defined
by the following difference equation
3
Lect. 2, Asst. Prof. Dr. Hadi T. Ziboon, Department of Electrical Eng. U.O.T
It is simple to find the value of each term of h[n] for a given value
of n
If n=0 , substitute n=0 in eq(2.3)
∴ ℎ[0] = 1.5ℎ[−1] − 0.85 ℎ[−2] + 𝛿 [0]
=0–0+1=1
Since h[n]=0 for n˂0
If n=1, substitute n=1 in eq(2.3)
ℎ[1] = 1.5ℎ[0] − 0.85 ℎ[−1] + 𝛿 [1]
= 1.5 × 1 – 0.85 × 0 + 0 = 1.5
If n=2,
ℎ[2] = 1.5ℎ[1] − 0.85 ℎ[0] + 𝛿 [2]
= 1.5 × 1.5 – 0.85 × 1 + 0 = 1.4
and so on for other value of n
Note: that is, in this example, the input impulse only contributes at
n=0, but the value of h[n] depend entirely on previous values,
being generated recursively.
Program can be used to evaluate h[n] and their program in
appendix A1 in the reference by Lynn.
4
Lect. 2, Asst. Prof. Dr. Hadi T. Ziboon, Department of Electrical Eng. U.O.T
EX 2.2 Find the first three sample values of the impulse response h[n] for
the system shown in figure
x(n) + y(n)
-0.9
T
Solution:-
The system is causal, so that h[n]=0 for n˂0 and zero otherwise
5
Lect. 2, Asst. Prof. Dr. Hadi T. Ziboon, Department of Electrical Eng. U.O.T
EXP 2.3 find the first four sample values of the impulse response h[n] for the system
defined by the following equation
𝑦 [ 𝑛 ] = 𝑥 [ 𝑛 ] + 𝑥 [ 𝑛 − 1] + 𝑥 [ 𝑛 − 2] + ⋯
Solution:-
This is a nonrecursive system, since no feedback in the equation
ℎ[0] = 1 + 0 + 0 + ⋯ = 1
= 0+1+0… = 1
Similarly h[2] =h[3] =1 and so on. The impulse response therefor equals
the unit step.
𝑦 [ 𝑛 ] = 𝑦 [ 𝑛 − 1] + 𝑥 [ 𝑛 ]
Solution:-this is a recursive system, since there is a feedback in the
equation
6
Lect. 2, Asst. Prof. Dr. Hadi T. Ziboon, Department of Electrical Eng. U.O.T
s[n] fig(2.4b)
7
Lect. 2, Asst. Prof. Dr. Hadi T. Ziboon, Department of Electrical Eng. U.O.T
EX 2.5 Find and sketch, the first four few sample value of the impulse response and
step responses of the system shown in fig (ex 2.5). Also determine the final value of
s[n] as n ∞x(n) y(n)
+
Solution:-
0.8 (a)
T
By inspection we see that the recurrence formula is
The step response equals the running sum of h[n].Hence its first few value are [using
the above results]
𝑠[4] = 𝑠[3] + ℎ[4] = 3.3.616 and so on. The final value of s[n] forn
1
∞ is given by𝑢𝑠𝑖𝑛𝑔 𝑦 = 1 + 𝑥 + 𝑥2 = 𝑓𝑜𝑟 𝑥 < 1
1−𝑥
1
𝑠[∞] = 1 + 0.8 + (0.8)2 + (0.8)3 + ⋯ = =5
1−0.8
s[n] s[n]
1 0.8 0.82 5
2.44
1.8
1
n 8 n
Lect. 2, Asst. Prof. Dr. Hadi T. Ziboon, Department of Electrical Eng. U.O.T
2.952
n
2.44 0
2.362 -u[n-4]
1.889
1.80 4 n
0
1.5
1 x[n]
n
n
0 4
9
Lect. 2, Asst. Prof. Dr. Hadi T. Ziboon, Department of Electrical Eng. U.O.T
10
Lect. 2, Asst. Prof. Dr. Hadi T. Ziboon, Department of Electrical Eng. U.O.T
Commutation property
x[n] y[n] h[n] y[n]
h[n] x[n]
Associative property
x[n] y[n] x[n] y[n]
h1[n] h2[n] h1(n) *h2(n)
Distributive property
h2[n]
fig (2.5) the interpretation of convolution properties from a system point view.
2.4.2 Performing Convolution
a) Direct Evaluation: when the sequences that are being convolved may
be described by simple closed form mathematical expression, the
convolution can be found by direct sum given in eq (2.1).
Ex 2.7 Let us perform the convolution of two signals
𝑛
𝑛 𝑎 𝑛≥0
𝑥 [𝑛 ] = 𝑎 𝑢 [𝑛 ] = �
0 𝑛<0
And h[n]=u[n]
Solution: u(k)
k
u[k-n]
n k
u[n-k]
n k
u[k]u[n-k]
n k
12
Lect. 2, Asst. Prof. Dr. Hadi T. Ziboon, Department of Electrical Eng. U.O.T
𝑦 [𝑛 ] = 𝑥 [𝑛 ] ∗ ℎ [𝑛 ] = � 𝑥 [𝑘 ]ℎ [𝑛 − 𝑘 ]
𝑘=−∞
∞
= � 𝑎 𝑘 𝑢 [𝑘 ]𝑢 [𝑛 − 𝑘 ]
𝑘=−∞
Because u[k]=0 for k<0 and u[n-k] is equal to zero for k>n.
when n<0, there are no nonzero terms in the sum and y[n]=0.
On the other hand if 𝑛 ≥ 0
𝑛
𝑦 [𝑛 ] = � 𝑎 𝑘 = 1 + 𝑎 + 𝑎 2 + 𝑎 3 + … + 𝑎 𝑛
𝑘=0
1 − 𝑎𝑛+1
𝑦 [𝑛 ] =
1−𝑎
1−𝑎𝑛+1
Therefore𝑦[𝑛] = 𝑢[𝑛]
1−𝑎
13
Lect. 2, Asst. Prof. Dr. Hadi T. Ziboon, Department of Electrical Eng. U.O.T
14
Lect. 2, Asst. Prof. Dr. Hadi T. Ziboon, Department of Electrical Eng. U.O.T
x[n]=0 for n<-1 and n>2 , x[0]=2 , x[1]=3, x[2]= -1 and x[-1]=1
Solution:- 𝑦[𝑛] = ∑∞
𝑘=−∞ 𝑥[𝑘] ℎ[𝑛 − 𝑘]
x[n] 3 h[n] 2
2 1
1 n
n
n
-2 -1 0 1 2 -2 -1 0 1 2 3 4
x[-1]δ(n+1) x[-1]h(n+1)
1 1 2
n n
-2 -1 0 1 2 -2 -1 1 2 3 4
1
x[0]δ(n) 2 x[0]h(n) 2
n
-2 -1 1 2 3 4 -2 -1 1 2 3 4
x[1]δ(n-1) x[1]h(n-1) 6
3 3 n n
x[2]δ(n-2) x[2]δ(n-2) -3
1
n n
y[n] -1 7 -2
-1 1 3
15
n
Lect. 2, Asst. Prof. Dr. Hadi T. Ziboon, Department of Electrical Eng. U.O.T
𝑦[1] = � 𝑥[𝑘]ℎ[1 − 𝑘]
𝑘=0
𝑦[2] = � 𝑥[𝑘]ℎ[2 − 𝑘]
𝑘=0
𝑦[3] = � 𝑥[𝑘]ℎ[3 − 𝑘]
𝑘=0
16
Lect. 2, Asst. Prof. Dr. Hadi T. Ziboon, Department of Electrical Eng. U.O.T
∴ 𝑦[𝑛] = � 𝑥[𝑘]ℎ[𝑛 − 𝑘]
𝑘=0
7
𝑦[0] = � 𝑥[𝑘]ℎ[−𝑘]
𝑘=0
𝑦[1] = � 𝑥[𝑘]ℎ[1 − 𝑘]
𝑘=0
𝑦[4] = � 𝑥[𝑘]ℎ[4 − 𝑘]
𝑘=0
17
Lect. 2, Asst. Prof. Dr. Hadi T. Ziboon, Department of Electrical Eng. U.O.T
18
Lect. 2, Asst. Prof. Dr. Hadi T. Ziboon, Department of Electrical Eng. U.O.T
+∞
Thus 𝑦(𝑡) = 𝑥(𝑡) ∗ ℎ(𝑡) = ∫−∞ 𝑥(𝜏)𝑦(𝑡 − 𝜏)𝑑𝜏 𝑥[𝑡] 𝑓𝑜𝑟 0 ≤ 𝑡 ≤ 3
Thus 𝑥(𝑡) ∗ ℎ(𝑡) exists in five stages:- ℎ[𝑡] 𝑓𝑜𝑟 0 ≤ 𝑡 ≤ 2
x(t) (a) h(t) x(τ) (b) h(τ)
3 3
2 2
ttττ
3 2 3 2
h(t-τ) 3 x(τ) h(t-τ) 3 x(τ)
h(-τ) 2 2 2
τττ
-2 -2 0 3 0 τ =t 3
(c) (d) stage(1) overlap (e) stage(2a) x(τ)
x(τ)
3 3 3 x(τ)
h(t-τ) overlap h(t-τ) overlap overlap
2 2 2 h(t-τ)
3 x(t)
2 h(t-τ)
(i) stage(5) 5 τ
(a) Stage 1: t<0 and h(t-τ) does not overlap with x(τ) as shown in fig(d)
∴ 𝑥(𝜏) ∗ ℎ(𝑡 − 𝜏) = 0 for all t
(b) Stage 2: 0 < 𝑡 ≤ 2 and partial overlap occure between x(τ) and h(t-τ) as shown in
fig(e) and (f) y(t)
𝜏=𝑡
∴ 𝑦(𝑡) = ∫0 𝑥(𝜏)ℎ(𝑡 − 𝜏) 𝑑𝜏12
𝑡
= � 3 × 2 𝑑𝜏 = 6[𝜏]𝑡0 = 6𝑡 0<𝑡≤2
0
19
Lect. 2, Asst. Prof. Dr. Hadi T. Ziboon, Department of Electrical Eng. U.O.T
(c) Stage 3: 2 ≤ 𝑡 ≤ 3 and there is complete overlap because x(t) and h(t-τ) as shown
in fig(g).
𝑡 𝑡
∴ 𝑦(𝑡) = ∫𝜏=𝑡−2 3 × 2 𝑑𝜏 = [6𝜏] 𝑡−2 y(t)
= 12 2≤𝑡≤3
2 3 t
(d) Stage 4: 3 ≤ 𝑡 ≤ 5 this is another overlap as shown in fig(h) y(t)
𝜏=3 3
∴ 𝑦(𝑡) = ∫𝜏=𝑡−2 3 × 2 𝑑𝜏 = [6𝜏] 𝑡−2 12
= 6(5 − 𝑡) = 30 − 6𝑡
3 5 t
(e) Stage 5: t>5 as shown in fig(i) there is no overlap ∴ 𝑦(𝑡) = 0
The convolution integral having a different expression for each of thethreeregion
corresponding to three stages as summarized below
0≤𝑡≤2 y(t)=6t
2≤𝑡≤3 y(t)=12
3≤𝑡≤5 y(t)=30-6t
y(t)
12
10
8
6
4
2
0 1 2 3 5 t
20
Lect. 2, Asst. Prof. Dr. Hadi T. Ziboon, Department of Electrical Eng. U.O.T
Or
∑𝑁 𝑀
𝑘=0 𝑎𝑘 𝑦[𝑛 − 𝑘] = ∑𝑘=0 𝑏𝑘 𝑥[𝑛 − 𝑘] … (2.12)
21
University of Technology
Department of Electrical Engineering
Lect3
1
Lect. 3, Asst. Prof. Dr. Hadi T. Ziboon, Department of Electrical Eng. U.O.T
1
n k k
-0.5
-1 -1
-2 -2
Fig(3.1)
(a) Periodic digital signal (b) Real parts of 𝐶𝑘 (c) Imaginary parts of 𝐶𝑘
2
Lect. 3, Asst. Prof. Dr. Hadi T. Ziboon, Department of Electrical Eng. U.O.T
1/2
√2/4√2/4𝜋/4
0 1 2 3 k k
−𝜋/4
3
Lect. 3, Asst. Prof. Dr. Hadi T. Ziboon, Department of Electrical Eng. U.O.T
0 1 2 3 4 5 6 7 n
-2
R (𝐶𝑘 ) I [𝐶𝑘 ]
1 0.5
k12 k
-2 -1 1 2 -2 -0.5
4
Lect. 3, Asst. Prof. Dr. Hadi T. Ziboon, Department of Electrical Eng. U.O.T
= � 𝐶𝑘 ∗ 𝐶𝑘 = � |𝐶𝑘 |2
𝑛=0 𝑛=0
𝐸𝑁 = ∑𝑁−1 2 𝑁−1 2
𝑛=0 |𝑥[𝑛]| = 𝑁 ∑𝑛=0 |𝐶𝑘 | … (3.5)
5
Lect. 3, Asst. Prof. Dr. Hadi T. Ziboon, Department of Electrical Eng. U.O.T
indicates that the periodic digital signal x[n] has spectral coefficients 𝐶𝑘 .
6
Lect. 3, Asst. Prof. Dr. Hadi T. Ziboon, Department of Electrical Eng. U.O.T
7
Lect. 3, Asst. Prof. Dr. Hadi T. Ziboon, Department of Electrical Eng. U.O.T
n n
8
Lect. 3, Asst. Prof. Dr. Hadi T. Ziboon, Department of Electrical Eng. U.O.T
Solutionx(n)
• 𝑋[𝛺] = ∑∞
𝑛=−∞ 𝑥[𝑛] 𝑒
−𝑗𝛺𝑛
x[n]
2𝜋𝑘
where Ω =
𝑁
0.2 n
x(Ω)
1
-2π -π 0 π 2π Ω
𝑋(𝛺) = 0.2{𝛿[𝑛 − 2] + 𝛿[𝑛 − 1] + 𝛿[𝑛] + 𝛿[𝑛 + 1] + 𝛿[𝑛 + 2]}𝑒 −𝑗𝛺𝑛
Using the shifting property of the unit impulse
∴ 𝑋(𝛺) = 0.2{𝑒 −𝑗2𝛺 + 𝑒 −𝑗𝛺 + 1 + 𝑒 𝑗𝛺 + 𝑒 𝑗2𝛺 }
= 0.2(1 + 2𝑐𝑜𝑠𝛺 + 2𝑐𝑜𝑠2𝛺)
o The spectrum is real since x[n] is an even function. It is sketched in
the lower part of fig.
o The spectrum is periodic in Ω, repeating every 2π.
Solution x[n]
𝑋(𝛺) = ∑∞
𝑛=−∞ 𝑥 [𝑛] 𝑒
−𝑗𝛺𝑛
0.5
0.25
0.125 n
-2 -1 0 1 2 3 4
9
Lect. 3, Asst. Prof. Dr. Hadi T. Ziboon, Department of Electrical Eng. U.O.T
1 1
𝑋(𝛺) = 0.5 1−0.5𝑒 −𝑗𝛺 ∑∞ 𝑛
𝑛=0 𝑎 = 1−𝑎if a <1
1
= ∴ X[Ω] = 0.5[1+a+a2 +….]
1−0.5𝑒−𝑗𝛺
if a=e-jΩ
0.5
|𝑥(𝛺)| =
[(1 − 0.5𝑐𝑜𝑠𝛺)2 + (0.5𝑠𝑖𝑛𝛺)2 ]1/2
0.5
=
[1 − 𝑐𝑜𝑠𝛺 + 0.25𝑐𝑜𝑠 2 𝛺 + 0.25𝑠𝑖𝑛2 𝛺]1/2
x[Ω]
1
1/3
Ω
0 π 2π
Note that:-
1- If Ω = 0, |𝑋(Ω)| = 1 and is max.
1
2- If Ω = π, |𝑋(Ω)| = and is min.
3
10
Lect. 3, Asst. Prof. Dr. Hadi T. Ziboon, Department of Electrical Eng. U.O.T
3.7.1 The first method by using input signal frequency response and LTI
frequency response
11
Lect. 3, Asst. Prof. Dr. Hadi T. Ziboon, Department of Electrical Eng. U.O.T
12
Lect. 3, Asst. Prof. Dr. Hadi T. Ziboon, Department of Electrical Eng. U.O.T
∑𝑁 𝑀
𝑘=0 𝑎𝑘 𝑦[𝑛 − 𝑘] = ∑𝑘=0 𝑏𝑘 𝑥[𝑛 − 𝑘]…. (3.20)
The integer N is called the order of the DE or the order of the
system.
13
Lect. 3, Asst. Prof. Dr. Hadi T. Ziboon, Department of Electrical Eng. U.O.T
𝑁 𝑀
14
Lect. 3, Asst. Prof. Dr. Hadi T. Ziboon, Department of Electrical Eng. U.O.T
15
Lect. 3, Asst. Prof. Dr. Hadi T. Ziboon, Department of Electrical Eng. U.O.T
𝑋(𝑧) = ∑∞
𝑛=−∞ 𝑥[𝑛] 𝑧
−𝑛
…. (3.22)
𝑋(𝑧) = ∑∞
𝑛=0 𝑥[𝑛] 𝑧
−𝑛
…. (3.23)
16
Lect. 3, Asst. Prof. Dr. Hadi T. Ziboon, Department of Electrical Eng. U.O.T
Ex(3.8) Findthe z-transform and the region of converges for the discrete
time sequence given in fig(3.8)
Solutionx[n]
5
3 3
1 1
0
-6 -5 -4 -3 -2 -1 0 1 2 3 4 n
• The sequence of the signal is noncausal, since is not zero for n<0
but it is of a finite duration.
• The sequence has value x(-6)=0, x(-5), x(-3)=5, x(-2)=3, x(-1)=1
and x(0)=0.
∞
∴ 𝑋(𝑧) = � 𝑥[𝑛] 𝑧 −𝑛 = 𝑧 5 + 3𝑧 4 + 5𝑧 3 + 3𝑧 2 + 𝑧
𝑛=−∞
17
Lect. 3, Asst. Prof. Dr. Hadi T. Ziboon, Department of Electrical Eng. U.O.T
Ex(3.9) Fined the z-transform and the region of convergence for the
discrete time sequences
Solution
∞
∴ 𝑋(𝑧) = � 𝑥 [𝑛] 𝑧 −𝑛
𝑛=−∞
𝑋(𝑧) = 𝑧 + 3𝑧 + 5 + 3𝑧 −1 + 𝑧 −2
2
Ex(3.10) Fined the z-transform and the region of convergence for the
discrete time sequence defined by
𝑥[𝑛] = 1 0≤𝑛≤∞
=0 𝑛<0
Solution The sequence is a causal sequence of infinite duration
∞
𝑋(𝑧) = � 𝑥[𝑛] 𝑧 −𝑛
𝑛=−∞
∞
𝑋(𝑧) = � 𝑧 −𝑛
𝑛=0
𝑋(𝑧) = 1 + 𝑧 −1 + 𝑧 −2 + 𝑧 −3 + ⋯
The series is convergence if |𝑧 −1 | < 1 or equivalently if |𝑧| > 1. Thus
we may express X(z) in closed form if |𝑧| > 1.
1 𝑧
𝑋(𝑧) = =
1 − 𝑧 −1 𝑧 − 1
- In this case, the z-transform is valid everywhere outside a circle of
unit radius whose center is at the region.
18
Lect. 3, Asst. Prof. Dr. Hadi T. Ziboon, Department of Electrical Eng. U.O.T
𝑧
𝑋(𝑧) =
𝑧−1
- The outside of the circle is the region of convergence.
- We can readily that Im
when |𝑧| > 1, X(z) coverage.
where |𝑧| < 1, X(z) diverges.
For ex. If z=2 (outside the circle) |𝑧| = 1 Re
𝑋(𝑧) = 1 + 𝑧 −1 + 𝑧 −2 + 𝑧 −3 + ⋯
𝑍
= 𝑍−1 region of convergence
1 1 1
𝑋(𝑧) = 1 + + ( )2 + ( )3 + ⋯
2 2 2
2
= =2 thus X(z) converges
2−1
1
If 𝑧 = (inside the circle)
2
1 1 1
𝑋(𝑧) = 1 + + ( )2 + ( )3 + ⋯
0.5 0.5 0.5
= 1+2+4+8+… thus X(z) diverge
3.8.2 The Inverse Z-transform
- The inverse z-transform (IZT) allows recovering the discrete time
sequence, x[n], given its transform. The IZT is particularly useful in
DSP, for example in finding the impulse response of digital filters.
The inverse z-transform is defend as
𝑥[𝑛] = 𝑍 −1 {𝑋(𝑧)} …. (3.24)
𝑋(𝑧) = � 𝑥[𝑛] 𝑧 −𝑛
𝑛=0
19
Lect. 3, Asst. Prof. Dr. Hadi T. Ziboon, Department of Electrical Eng. U.O.T
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
𝑎0 + 𝑎1 𝑧 −1 + 𝑎2 𝑧 −2 + ⋯ + 𝑎𝑁 𝑧 −𝑁
𝑋 (𝑧) =
𝑏0 + 𝑏1 𝑧 −1 + 𝑏2 𝑧 −2 + ⋯ + 𝑏𝑀 𝑧 −𝑀
1 + 2𝑧 −1 + 𝑧 −2
𝑋 (𝑧) =
1 − 𝑧 −1 + 0.356𝑧 −2
Solution In this method, the numerator and denominator of X(z) are first
expressed in either descending powers of Z or as ending power of Z and
the quotient is then obtained by long division
20
Lect. 3, Asst. Prof. Dr. Hadi T. Ziboon, Department of Electrical Eng. U.O.T
1 + 3𝑧 −1 + 3.6439𝑧 −2 + 2.5756𝑧 −3 + ⋯
1 + 𝑧 −1 + 0.3561𝑧 −2 1 + 2𝑧 −1 + 𝑧 −2
−1 ± 𝑧 −1 ∓ 0.3561𝑧 −2
3𝑧 −1 + 0.6439𝑧 −2
−3𝑧 −1 ± 3𝑧 −2 ∓ 1.0683𝑧 −3
3.6439𝑧 −2 − 1.0683𝑧 −3
2.5756𝑧 −3 − 1.2975927𝑧 −4
−2.5756𝑧−3 − 1.2975927𝑧−4
1 + 2𝑧 −1 + 𝑧 −2 𝑧 2 + 2𝑧 + 1
𝑋 (𝑧) = =
1 − 𝑧 −1 + 0.356156𝑧 −2 𝑧 2 − 𝑧 + 0.3561
21
Lect. 3, Asst. Prof. Dr. Hadi T. Ziboon, Department of Electrical Eng. U.O.T
Partial Fraction
𝑎0 + 𝑎1 𝑧 −1 + 𝑎2 𝑧 −2 + ⋯ + 𝑎𝑁 𝑧 −𝑁
𝑋 (𝑧) =
𝑏0 + 𝑏1 𝑧 −1 + 𝑏2 𝑧 −2 + ⋯ + 𝑏𝑀 𝑧 −𝑁
If poles of X(z) are first order and N=M , then X(z) can be expanded as
𝐶1 𝐶2 𝐶𝑀
𝑋(𝑧) = 𝐵0 + + + ⋯ +
1 − 𝑃1 𝑍 −1 1 − 𝑃2 𝑍 −2 1 − 𝑃𝑀 𝑍 −1
𝐶1 𝑍 𝐶2 𝑍 𝐶𝑀 𝑍
= 𝐵0 + + + ⋯+
𝑍 − 𝑃1 𝑍 − 𝑃2 𝑍 − 𝑃𝑀
𝐶𝑘 𝑍
= 𝐵0 + ∑𝑀
𝑘=1 … (3.27)
𝑍−𝑃𝑘
Where 𝑃𝑘 are the poles of X(z), 𝐶𝑘 are the partial fraction coefficients
and
𝐵0 = 𝑎𝑁 /𝑏𝑁 …. (3.28)
22
Lect. 3, Asst. Prof. Dr. Hadi T. Ziboon, Department of Electrical Eng. U.O.T
𝑧 −1
𝑋(𝑧) =
1 − 0.25𝑧 −1 + 0.375𝑧 −2
Solution: - for simplicity, we first express the z-transform in positive
power of z. multiply X(z) by 𝑧 2 .
𝑧 𝑧
∴ 𝑋(𝑧) = 𝑧 2 = (𝑧−0.75)(𝑧+0.5) … (1)
−0.25𝑧−0.375
𝑧 1 𝑐 𝑧
2 𝑐 𝑧
(𝑧−0.75)(𝑧+0.5)
= 𝑧−0.75
+ 𝑧+0.5
= 𝑋(𝑧)…. (2)
23
Lect. 3, Asst. Prof. Dr. Hadi T. Ziboon, Department of Electrical Eng. U.O.T
1 𝐶 𝑧2 𝐶 𝑧
𝑋(𝑧) = 𝑧−0.75 + 𝑧−0.5 … (2)
𝑘𝑧
form the z-transform table 𝑘 ∝𝑛 ↔ 𝑧−∝
4
� �𝑧 4(0.75)𝑛 4
𝑧 −1 5
�𝑧−0.75� = where 𝐾 = , α=0.75
5 5
4
�− �𝑧 −4(0.5)𝑛 −4
𝑧 −1 5
� 𝑧−0.5 � = where 𝐾 = , α=0.5
5 5
The desired inverse z-transform, x[n] is the sum of the two inverse
z-transform
4 4
∴ 𝑥 [𝑛] = (0.75)𝑛 − (−0.5)𝑛
5 5
Ex(3.12) Find the discrete time signal, x[n], represented by the following
z-transform using the partial fraction expansion method
1 + 2𝑧 −1 + 𝑧 −2
𝑋(𝑧) =
1 − 𝑏1 𝑧 −1 + 0.3516𝑧 −2
𝑧 2 + 2𝑧 + 1
𝑋(𝑧) = 2
𝑧 − 𝑧 + 0.3561
The poles of X(z) are found by solving
𝑧 2 − 𝑧 + 0.3561 = 0
24
Lect. 3, Asst. Prof. Dr. Hadi T. Ziboon, Department of Electrical Eng. U.O.T
−𝑏 ∓ �(𝑏 2 − 4𝑎𝑐)
𝑃= 𝑧2 − 𝑧 + 0.3561 = 0
2𝑎
Where a and b are the coefficient of 𝑧 2 and z, and c is the coefficients
constant term (a=1, b=-1 and c=0.356)
1 + �(1 − 4 × 0.3561)
𝑃1 = = 0.5 + 𝑗0.3257 = 𝑟𝑒 𝑗𝜃
2
1 − �(1 − 4 × 0.3561)
𝑃2 = = 0.5 − 𝑗0.3257 = 𝑟𝑒 −𝑗𝜃
2
Where r=0.5967 and 𝜃 = 33.080
𝑧 2 + 2𝑍 + 1 𝐵0 𝐶1 𝐶2
∴ 𝑋 (𝑧) = = + +
𝑧(𝑧 − 𝑃1 )(𝑧 − 𝑃2 ) 𝑧 𝑧 − 𝑃1 𝑧 − 𝑃2
Using the procedure of EX. (3.12) to find
𝑎𝑁 1
𝐵0 = = = 2.8082
𝑏𝑁 0.356
𝐶1 = 6.06066 < −98.58
𝐶2 = 6.06066 < 98.58 = 𝐶1∗
𝐶1 𝑧 𝐶2 𝑧
∴ 𝑋(𝑧) = 2.8082 + +
𝑧 − 𝑃1 𝑧 − 𝑃2
Using the table to find the inverse z-transform
𝑧 1 (2.8082) = 2.8082 𝑢[𝑛] [using entry in table 3.1]
𝐶1 𝑧 𝐶2 𝑧
𝑧1 � + � = 2 × 6.066(0.5967)𝑛 cos (33.08𝑛 − 98.58)
𝑧 − 𝑃1 𝑧 − 𝑃2
∴ 𝑥[𝑛] = 2.8082𝑢[𝑛] + 12.1213(0.5967)𝑛 cos (33.08𝑛 − 98.58)
Using entry 16 in table 3.1
𝐶1 𝑧 𝐶2 𝑧
𝑧1 � + � = 2|𝐶||𝑃|𝑛 cos [𝑛 < 𝑃+< 𝑐] [select the angle of P 1 and
𝑧−𝑃1 𝑧−𝑃2
C1]
25
Lect. 3, Asst. Prof. Dr. Hadi T. Ziboon, Department of Electrical Eng. U.O.T
1) Linearity
If 𝑥1 [𝑛] ↔ 𝑋1 (𝑧)
𝑥2 [𝑛] ↔ 𝑋2 (𝑧)
Then 𝑎𝑥1 [𝑛] + 𝑏𝑥2 [𝑛] ↔ 𝑎𝑋1 (𝑧) + 𝑏𝑋2 (𝑧) … (3.29)
2) Delay or shift
If 𝑥 [𝑛] ↔ 𝑋1 (𝑧)
𝑥[𝑛 − 𝑚] ↔ 𝑧 −𝑚 𝑋(𝑧)… (3.30)
3) Convolution: Given a discrete LTI system with input, x[n], and
impulse response, h(k), the output of the system is given by
∞
4) Time reversal
𝑥[𝑛] ↔ 𝑋(𝑧)
𝑥[−𝑛] ↔ 𝑋(𝑧 −1 )
5) Differentiation or multiplication by n
If 𝑥[𝑛] ↔ 𝑋(𝑧)
Then the z-transform of nx[n] can obtained by differentiating X(z)
𝑑𝑋(𝑧)
𝑛𝑥 [𝑛] ↔ −𝑧
𝑑𝑧
26
Lect. 3, Asst. Prof. Dr. Hadi T. Ziboon, Department of Electrical Eng. U.O.T
Where 𝑧𝑖 is the ith zero,𝑃𝑖 is the ith pole and K is the gain factor.
Fig(3.4)
27
Lect. 3, Asst. Prof. Dr. Hadi T. Ziboon, Department of Electrical Eng. U.O.T
Ex(3.12) Plot the z-plane poles and zeros of the following z-transform
𝑧 2 (𝑧 − 1.2)(𝑧 + 1)
H(z) =
(𝑧 − 0.5 + 𝑗0.5)(𝑧 − 0.5 − 𝑗0.5)(𝑧 − 0.8)
Solution: Im
Re
28
Lect. 3, Asst. Prof. Dr. Hadi T. Ziboon, Department of Electrical Eng. U.O.T
29
Lect. 3, Asst. Prof. Dr. Hadi T. Ziboon, Department of Electrical Eng. U.O.T
𝑁
𝛱𝑖=1 𝑘(𝑒 𝑗𝑤𝑇 −𝑧𝑖 )
∴ 𝐻�𝑒 𝑗𝑤𝑇 � = 𝑁 (𝑒 𝑗𝑤𝑇 −𝑃 )
𝛱𝑖=1
…. (3.31)
𝑖
Eq(3.31) with two zero and two poles is shown in fig (3.5). In this case,
the frequency response for a given point 𝑃 = 𝑍 = 𝑒 𝑗𝑤𝑇 is given by
𝑗𝑤𝑡
𝑘�𝑒 𝑗𝑤𝑇 − 𝑧1 ��𝑒 𝑗𝑤𝑇 − 𝑧2 �
𝐻�𝑒 �=
(𝑒 𝑗𝑤𝑇 − 𝑃1 )(𝑒 𝑗𝑤𝑇 − 𝑃2 )
𝑘 𝑢1 <𝜑1 𝑢1 <𝜑2
= …. (3.32)
𝑉1 <∅1 𝑉2 <∅2
Where 𝑢1 and 𝑢2 represent the distance from zeros to the point 𝑍 = 𝑒 𝑗𝑤𝑇
Where 𝑉1and 𝑉2represent the distance from poles to the point 𝑃 = 𝑍 = 𝑒 𝑗𝑤𝑇
- Thus the magnitude and phase responses for the system, from eq 3.32
𝑢 𝑢
�𝐻𝑒 𝑗𝑤𝑇 � = 𝑉1 𝑉2 𝑖𝑓 𝑘 = 1 < 𝐻�𝑒 𝑗𝑤𝑇 � = 𝜑1 + 𝜑2 − (∅1 + ∅2 ) (3.32a)
1 2
𝑢2 Im 𝑃1 𝑉1
P
∅1 𝑤𝑇 𝑢1
Re
𝑧2 𝑧1
𝑃2 𝑉2
Note 1. In general, in the geometric method, the frequency response at a given
frequency, w (at the angle wT) is determined by the ratio of the product of the
zero vectors 𝑢𝑖 < 𝜑𝑖 with the product of the pole vectors 𝑃𝑖 < 𝜑𝑖 where i= 1, 2,
… 𝑃1 𝑣1
𝑗𝑤𝑇
𝑘 𝑢1 𝑢2 𝑢3 … . . 𝑢𝑖
�𝐻𝑒 �= ∅2 𝑃1
𝑉1 𝑉2 𝑉3 … . . 𝑉𝑖
< 𝐻�𝑒 𝑗𝑤𝑇 � = 𝜑1 + 𝜑2 + ⋯ + 𝜑𝑖 − (∅1 + ∅2 + ⋯ + ∅𝑖 ) 𝑃2 𝑣2
∅1
30
Lect. 3, Asst. Prof. Dr. Hadi T. Ziboon, Department of Electrical Eng. U.O.T
Ex3.16 Determine the frequency response at dc, 1/8, 1/4, 3/8, 1/2 the
sampling frequency of the causal discrete time system has the following
z-transform
𝑧+1
𝐻(𝑧) =
𝑧 − 0.7071
Sketch, the amplitude frequency response in the interval 0 < 𝑤 ≤ 𝑤𝑠 ,
where 𝑤𝑠 (rad/s) in the sampling frequency.Using the geometric method.
Solution using eq(3.32) Im
𝑘 𝑢1 <𝜑1 𝑢1 <𝜑2
𝐻(𝑒 𝑗𝑤𝑇 ) = P
𝑉1 <∅1 𝑉2 <∅2
𝑗𝑤𝑇
𝑒 𝑗𝑤𝑇 + 1
𝐻�𝑒 � = 𝑗𝑤𝑇
𝑒 − 0.707
1+cos 𝑤𝑇+𝑗 sin(𝑤𝑇)
= Im
cos 𝑤𝑇−0.7071+𝑗 sin(𝑤𝑇)
𝑤
𝑃( 𝑠 )
4
1- At dc wT=0 Re
1+1+0
𝐻�𝑒 𝑗𝑤𝑇 � = = 6.828 < 0
1 − 0.707 + 0
As shown in fig(a) (b) WT=π/4
𝑤 2𝜋𝑓𝑠 𝑇 𝜋
2- At 𝑤 = 𝑤𝑠 /8, 𝑤𝑇 = � 𝑠 � 𝑇 = =
8 8 4
𝜋 𝜋
1+cos� �+𝑗 sin� �
𝑗𝑤𝑇 4 4
𝐻�𝑒 �= 𝜋 𝜋 Re
cos� 4 �−0.7071+𝑗 sin� 4 �
1.8477<22.5
= = 2.6131 < −67.50 (c) WT=π/2
0.7071<90
31
Lect. 3, Asst. Prof. Dr. Hadi T. Ziboon, Department of Electrical Eng. U.O.T
P Re P Re
(e)wT=π (d)wT=3π/4
W(rad/sec) WT (rad) |𝐻(𝑒 𝑗𝑤𝑇 )| < 𝐻(𝑒 𝑗𝑤𝑇 ) degree
0 0 6.828 0
𝑤𝑠 \8 π/4 2.6131 67.5
𝑤𝑠 \4 π/2 1.1547 -80.26
3𝑤𝑠 \8 3 π/4 0.4840 -85.93
𝑤𝑠 \2 π 0 0
|𝐻(𝑒 𝑗𝑤𝑇 )|
6 (1) A sketch of the magnitude and
4 phase responses as shown in fig
2 e and f
(e) 𝑤𝑠 \8 𝑤𝑠 \4 3𝑤𝑠 \8 𝑤𝑠 \2 w
< 𝐻(𝑒 𝑗𝑤𝑇 ) (2) The magnitude response |𝐻(𝑒 𝑗𝑤𝑇 )|
60 is symmetrical about half the sampling
40 frequency (Nyquist frequency)
20 (3) The phase response antisymmetrical
A bout the same frequency
(f) 𝑤𝑠 \8 𝑤𝑠 \4 3𝑤𝑠 \8 𝑤𝑠 \2 w
-20
-40
-60
-80
-100
32
Lect. 3, Asst. Prof. Dr. Hadi T. Ziboon, Department of Electrical Eng. U.O.T
33
Lect. 3, Asst. Prof. Dr. Hadi T. Ziboon, Department of Electrical Eng. U.O.T
2) When a poles lies inside the unit circle the system is stable.
3) When a poles lies on or outside the unit circle the system is unstable.
Note when a pole is coincident with a zero on the unit circle so that its effects
are nullified.
- Since stability to the radius of z-plane poles, it is often helpful to express
their locations in polar co-ordinates.
- Let us consider a processor with complex conjugate pole-pair as shown in
fig(3.6). The poles are at radius (r) and make angle ∓𝜑 with the positive
real axes. These location are therefore
𝑧 = 𝑟 𝑒𝑥𝑝(𝑗𝜑)and= 𝑟 𝑒𝑥𝑝(−𝑗𝜑).
𝑌(𝑧) 1
𝐻 (𝑧 ) = =
𝑋(𝑧) (𝑧 − 𝑟𝑒 )(𝑧 − 𝑟𝑒 −𝑗𝜑 )
𝑗𝜑
𝑌 (𝑧 ) 1
=
𝑋(𝑧) [𝑧 − 𝑟(cos 𝜑 + sin 𝜑)][𝑧 − 𝑟(cos 𝜑 − sin 𝜑)]
1
=
𝑧2 − 2𝑟𝑧 cos 𝜑 + 𝑟 2
Im
𝜑 Re
Fig(3.6)
Or
Lect4
4.1 DFT
1
Lect. 4, Asst. Prof. Dr. Hadi T. Ziboon, Department of Electrical Eng. U.O.T
𝐼(𝑘)
and X(k) has a phase angle 𝜑𝑘 = 𝑡𝑎𝑛−1 … (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
2𝜋
𝑁−1
𝑋(𝑘𝛺) = ∑𝑛=0 𝑁−1
𝑥[𝑛𝑇] 𝑒 −𝑗𝑘𝛺𝑛𝑇 = ∑𝑛=0 𝑥[𝑛𝑇] 𝑒 −𝑗 𝑁 𝑘𝑛 ..(4.3)
Where k= 0, 1, 2, 3, … N-1
∞
F(jwt) = � f(t)e−jωt dt Fourier Trasform
−∞
2
Lect. 4, Asst. Prof. Dr. Hadi T. Ziboon, Department of Electrical Eng. U.O.T
3
Lect. 4, Asst. Prof. Dr. Hadi T. Ziboon, Department of Electrical Eng. U.O.T
Thus the time series [1, 0, 0,1] has the DFT given by the sequence
[2,1+j,0,1-j]. x[nT] (a)
2𝜋
To fined 𝛺 = 𝑁𝑇 1
1 1 𝑇 = 8×103 = 125µ𝑆
2𝜋
= 1 125 250 375 t(𝜇𝑠)
4( )
8×103
=12.57kHz x[nT] (b)
∴ 2𝛺 = 2 × 12.57 = 25.14𝑘𝐻𝑧 2 2
3𝛺 = 3 × 12.57 = 37.71 √2 √2
𝑁−1 𝑁−1
2𝜋 2𝜋 2𝜋
−𝑗 (𝑘+𝑁)𝑛 −𝑗 𝑘𝑛 −𝑗 𝑁
𝑋(𝑘 + 𝑁)𝛺 = � 𝑥[𝑛𝑇] 𝑒 𝑁 = � 𝑥[𝑛𝑇] 𝑒 𝑁 𝑒 𝑁
𝑛=0 𝑛=0
2𝜋
−𝑗 𝑘𝑛 −𝑗2𝜋𝑛
= ∑𝑁−1
𝑛=0 𝑥[𝑛𝑇] 𝑒 𝑁 𝑒 = 𝑋(𝑘𝑁) Since 𝑒 −𝑗2𝜋𝑛 = 1
4
Lect. 4, Asst. Prof. Dr. Hadi T. Ziboon, Department of Electrical Eng. U.O.T
E.x 4.3 Calculate the IDFT from its DFT components [2, 1+j, 0, 1-j]
𝑗2𝜋𝑘𝑛
1 𝑁−1
Solution 𝑥 [𝑛𝑇] = ∑𝑘=0 𝑋(𝑘𝛺) 𝑒 𝑁
𝑁
1
For n=0 , 𝑥 [0] = [𝑋(0) + 𝑋(1) + 𝑋(2) + 𝑋(3)]
4
1
= [2 + (1 + 𝑗) + 0 + (1 − 𝑗)] = 1
4
𝑗2𝜋𝑘
1
For n=1, 𝑥 [𝑛𝑇] = 𝑥[𝑇] = ∑𝑁−1 𝑋(𝑘) 𝑒 𝑁
𝑁 𝑘=0
3
1 𝑗𝑘𝜋
= � 𝑋(𝑘) 𝑒 2
4
𝑘=0
1 𝑗2
𝜋 3𝜋
𝑗2
( ) (
= �2 + 1 + 𝑗 𝑒 + 0 + 1 − 𝑗 𝑒 �)
4
1
= [2 + (1 + 𝑗)𝑗 + (1 − 𝑗)(−𝑗)] = 0
4
For 𝑛 = 2 → 𝑥 [2𝑇] = 0
For 𝑛 = 3 → 𝑥 [3𝑇] = 1
5
Lect. 4, Asst. Prof. Dr. Hadi T. Ziboon, Department of Electrical Eng. U.O.T
The right hand side of eq(4.8) is the mean square spectral amplitude,
while the left hand side is the sum of the squared magnitude of the time
series.
3) Delta Function
𝐹𝐷 [𝛿(𝑛𝑇)] = 1 …. (4.9)
Where 𝐹𝐷 is the Discrete Fourier Transform
4) Convolution
(a) Time Convolution
𝑥3 [𝑛] = 𝑥1 [𝑛] ∗ 𝑥2 [𝑛] = 𝐹𝐷−1 [𝑋1 (𝑘)𝑋2 (𝑘)] … (4.10)
Where ∗ denote circular convolution, and 𝑥1 [𝑛], 𝑥2 [𝑛]and 𝑥3 [𝑛] are finite
sequence of equal length.
Further more 𝑋3 (𝑘) = 𝑋1 (𝑘)𝑋2 (𝑘) … (4.11)
Where 𝑋3 (𝑘) = 𝐹𝐷 [𝑥3 [𝑛]] … (4.12)
(b) Frequency Convolution
1
𝑋1 (𝑘) ∗ 𝑋2 (𝑘) = 𝐹𝐷 [𝑥1 [𝑛]𝑥2 [𝑛]] …. (4.13)
𝑁
6
Lect. 4, Asst. Prof. Dr. Hadi T. Ziboon, Department of Electrical Eng. U.O.T
- A large number of the multiplication and addition are required for the
calculation of the DFT.
- For an 8 point DFT the expansion for X(kΩ) becomes
𝑋(𝑘𝛺) = ∑7𝑛=0 𝑥[𝑛] 𝑒 −𝑗2𝜋𝑛𝑘/8 where k=0,1,2,…,7
2𝜋𝑘 2𝜋𝑘 2𝜋𝑘 2𝜋𝑘
𝑋(𝑘𝛺) = 𝑥[0]𝑒 −𝑗 8
0
+ 𝑥[1]𝑒 −𝑗 8
1
+ 𝑥[2]𝑒 −𝑗 8
2
+ 𝑥[3]𝑒 −𝑗 8
3
Eq(4.15) contains eight terms on the right hand side. Each term consists
(8) complex multiplications and seven complex addition to be calculated.
For an 8 point DFT required 82 = 64 complex multiplication
8 × 7 = 56 complex addition
7
Lect. 4, Asst. Prof. Dr. Hadi T. Ziboon, Department of Electrical Eng. U.O.T
the N-point DFT of x[n] from these two N/2 point DFT with
1
reduction of the number of multiplies and add by factor 𝑁 2 .
2
2𝜋
Where 𝑊𝑁 = 𝑒 −𝑗 𝑁 is called twiddle factor, k=0,1,2, …. ,N-1
𝑗2𝜋
2𝜋 2 2𝜋2 − 𝑁
−𝑗 𝑁 −𝑗 𝑁
𝑊𝑁2 = �𝑒 � =𝑒 =𝑒 2 = 𝑊𝑁
2
𝑁 2𝜋 𝑁
𝑁/2
𝑊 (𝑘+ 2 ) = 𝑊𝑁𝑘 𝑊𝑁 = 𝑊𝑁𝑘 𝑒 −𝑗( 𝑁 )( 2 )
2𝜋
𝑊𝑁 = 𝑒 −𝑗 𝑁 … (4.16a)
𝑁
(𝑘+ 2 )
𝑊𝑁 = −𝑊𝑁𝑘 …. (4.16c)
8
Lect. 4, Asst. Prof. Dr. Hadi T. Ziboon, Department of Electrical Eng. U.O.T
x[n] fig(4.1)
-2 -1 0 x[1] 2 3 4 5 x[6] 7 k
Although the N/2 point DFT's of g[n] and h[n] are sequences of length
N/2, the periodicity of the complex exponentials allows us to write:-
𝑁 𝑁
𝐺(𝑘) = 𝐺(𝑘 + ) …. (4.20a) 𝐻(𝑘) = 𝐻(𝑘 + ) … (4.20b)
2 2
Therefore, X(k) may be computed from the N/2 point DFT's G(k) and
H(k) because
𝑘+𝑁/2 𝑁/2
𝑊𝑁 = 𝑊𝑁𝑘 𝑊𝑁 = −𝑊𝑁𝑘 … (4.21a)
𝑁
𝑘+ 𝑁
𝑊𝑁 2
𝐻 �𝑘 + � = −𝑊𝑁𝑘 𝐻(𝑘) …. (4.21b)
2
Fig(4.2) shows the block diagram of the computations that are necessary
for the first stage of 8 point DIT-FFT.
Using Eq(4.19) and eq(4.20) to draw fig (4.2) where G(k)=DFT of g(𝑙)
𝑋(𝑘) = 𝐺(𝑘) + 𝑊𝑁𝑘 𝐻(𝑘) … (4.19) H(k)=DFTof h(𝑙)
Fig(4.2)
x(0) X(0)
4-point
x(2) X(1)
DFT
x(4) X(2)
x(6) X(3)
x(1) X(4)
4-point
x(3) DFT X(5)
x(5) X(6)
x(7) X(7)
10
Lect. 4, Asst. Prof. Dr. Hadi T. Ziboon, Department of Electrical Eng. U.O.T
𝑁 𝑁
−1 𝑛𝑘 𝑘 −1 𝑛𝑘
𝐺(𝑘) = ∑𝑛=0 𝑔[2𝑛] 𝑊𝑁/4
4
+ 𝑊𝑁/2 ∑𝑛=0
4
𝑔[2𝑛 + 1] 𝑊𝑁/4 ….. (4.23)
Where the first term is the N/4 point DFT of the even samples of g[n] and
the second term is the N/4 point DFT of the odd sample
Fig (4.3) shows the decimation of 4 point DFT into two point DFT's in
the decimation in time FFT.
Fig(4.3)
x(0) 2 point G(0)
x(4) DFT G(1)
x(2) 2 point
G(2)
x(6) DFT
G(3)
Fig(4.4)
q[0] Q(0)=q(0)+q(1)
q[1] Q(0)=q(0)-q(1)
- The basic computational unit of the FFT, shown in fig(4.5a) is called
butterfly. This structure may be simplified by factoring out a term 𝑊𝑁𝑟
from the lower branch as shown in fig (4.5b). the factor remain is
𝑁/2
𝑊𝑁 = −1.
Fig(4.5)
𝑟+𝑁/2
𝑊𝑁 𝑊𝑁𝑟 -1
a) The butterfly which is the basic computational element of the FFT
algorithm.
b) A simplified butterfly, with only one complex multiplication.
11
Lect. 4, Asst. Prof. Dr. Hadi T. Ziboon, Department of Electrical Eng. U.O.T
and 𝑁𝑙𝑜𝑔2 𝑁 complex addition. Thus big saving in time for execution the
DFT by using FFT.
A Complete 8-point radix-2 decimation in time FFT is shown in fig (4.6)
12
Lect. 4, Asst. Prof. Dr. Hadi T. Ziboon, Department of Electrical Eng. U.O.T
W80 𝐺2
x[4] X(1)
-1
G3
x[2] X(2)
W80 𝐺4
x[6] X(3)
-1
W80
x[1] X(4)
-1 H0 -1
W80 W81
x[5] X(5)
-1 -1 H1 -1
W82
x[3] X(6)
-1 H2 -1
W80 W83
x[7] X(7)
-1 -1 H3 -1
fig (4.6) A complete eight point radix-2 decimation in time FFT
4.7 Decimation in Frequency FFT
Another class of FFT algorithms may be derived by decimating the output sequence
X(k) into smaller and smaller subsequences. These algorithm are called decimation in
13
Lect. 4, Asst. Prof. Dr. Hadi T. Ziboon, Department of Electrical Eng. U.O.T
𝑁
(𝑛+ )𝑘 𝑛𝑘
Finally because 𝑊𝑁/2 2
= −𝑊𝑁/2
𝑁/2−1 𝑁𝑛𝑘
∴ 𝑋(2𝑘 + 1) = ∑𝑛=0 [𝑥[𝑛] − 𝑥 �𝑛 + 2 �] 𝑊𝑁/2 … (4.26)
Which is the N/2 point DFT of the sequence that is formed by adding the first N/2
points of x[n] to the last N/2.
Using the same procedure for the odd sample of X(k) we have
𝑁/2−1 𝑛𝑘 𝑁
𝑋(2𝑘 + 1) = ∑𝑛=0 𝑊𝑁𝑛 [𝑥[𝑛] − 𝑥 �𝑛 + 2 �]𝑊𝑁/2 … (4.27)
Fig (4.7) an eight point decimation in frequency FFT of the first stage
x[0] X(0)
x[3] X(6)
W80
x[4] X(1)
-1 W81
x[5]
4-point X(3)
-1 W82
x[6] DFT X(5)
-1 W83
x[7] X(7)
-1
14
Lect. 4, Asst. Prof. Dr. Hadi T. Ziboon, Department of Electrical Eng. U.O.T
Ex.4.4 Calculate the FFT of the data sequence (1,0,0,1) and plot the
amplitude and phase spectra if the decimation in time is used.
Solution fig(4.4) Flow graph of the FFT
x[0] G(0) X(0)
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)
16
University of Technology
Department of Electrical Engineering
Lect5
𝒛 𝒛 𝒛 𝒛
𝑏1 −𝑎1 −𝑎1 𝑏1
(a) (b)
- As we have seen the main properties of the LTI system are the
association and commutation as shown in fig (5.2).
x[n] y[n] h[n] y[n] x[n] x[n] y[n]
h[n] x[n] ℎ1 [n] ℎ2 [n] ℎ
y[n]
commutation association
- If we interchange the order of the cascaded LTI system, the overall
response remains the same due to the association property. Thus of
we change the order of the recursive and nonrecursive system, we
obtain another structure.
1
Lect. 5, Asst. Prof. Dr. Hadi T. Ziboon, Department of Electrical Eng. U.O.T
For the realization of the system described by(5.1). The resulting system
is shown in fig (5.1b). From this figure we obtained the two difference
equations.
- Thus the two difference eq(5.4) and (5.5) are equivalent to single
difference equation (5.1).
- Thus new realization shown in fig (5.1c) required only one delay for
w[n] and hence it is more efficient in terms of memory requirements.
It is called the direct from II structure.
- These structures can be generalized for the general LTI recursive
system described by the difference equation
𝑦[𝑛] = − ∑𝑁 𝑀
𝑘=1 𝑎𝑘 𝑦[𝑛 − 𝑘 ] + ∑𝑘=0 𝑏𝑘 𝑥[𝑛 − 𝑘]… (5.6)
- Fig (5.2) shows the direct form I structure for this system. This
structure requires M+N delays and N+M+1 multiplication.
- Using the previous steps to define the nonrecursive system by
𝑣[𝑛] = ∑𝑀
𝑘=0 𝑏𝑘 𝑥[𝑛 − 𝑘] … (5.7)
𝑦[𝑛] = − ∑𝑁
𝑘=1 𝑎𝑘 𝑦[𝑛 − 𝑘 ] + 𝑣[𝑛] … (5.8)
2
Lect. 5, Asst. Prof. Dr. Hadi T. Ziboon, Department of Electrical Eng. U.O.T
By reversing the order of these two systems, as was previously done for
the first order system, we obtain the direct form II structure shown in fig
(5.3). This structure is the cascade of a recursive system
𝑤[𝑛] = − ∑𝑁
𝑘=1 𝑎𝑘 𝑤(𝑛 − 𝑘) + 𝑥[𝑛] … (5.9)
𝑦[𝑛] = ∑𝑀
𝑘=0 𝑏𝑘 𝑤(𝑛 − 𝑘) … (5.10)
𝒛 𝒛 𝒛
+ + + +
𝑏1 −𝑎1 −𝑎1 𝑤𝑛−1 𝑏1
3
Lect. 5, Asst. Prof. Dr. Hadi T. Ziboon, Department of Electrical Eng. U.O.T
(b) 𝒛
𝒛 𝒛
(c)
Fig (5.4) structure for the realization of second order systems for
(a) General second order
(b) FIR system
(c) Purely recursive system
4
Lect. 5, Asst. Prof. Dr. Hadi T. Ziboon, Department of Electrical Eng. U.O.T
The notation that is used for these elements [adders, multipliers and
delay] which are used to implement the digital network as shown in
fig(5.5). A network is also represented by a signal flowgraph, which is a
network of directed branches that are connected at nodes. Each branch
has an input and output with direction indicated by an arrowhead. The
nodes in a flowgraph correspond to either adders or branch points.
Finally, there are two special type of nodes:-
1) Source nodes: These are nodes that have no incoming branches and
are used for sequences that are input to the filter.
2) Sink nodes: These are nodes that have only entering branches and are
used to represent output sequence.
Fig (5.5)
𝑥𝑗 [𝑛] 𝑥𝑘 [𝑛]
(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
Solution
𝑧 −1
𝑧
−𝑎1 𝑏1
−𝑎1 𝑏1
Block diagram
Using the same procedure in fig (5.1)
5
Lect. 5, Asst. Prof. Dr. Hadi T. Ziboon, Department of Electrical Eng. U.O.T
6
Lect. 5, Asst. Prof. Dr. Hadi T. Ziboon, Department of Electrical Eng. U.O.T
Fig (5.7)
h(k), k=0,1,2
x[n] y[n]
Impulse response
- For IIR filters, the impulse response is finite duration whereas for FIR
it is of finite duration, since h(k) for FIR has only N values. In practice
it is not feasible to compute the output of the IIR filter using Equation
(5.14) because the length of its impulse response to long (infinite in
theory). Instead, the IIR filtering eq(5,14) is expressed in a recursive
form.
7
Lect. 5, Asst. Prof. Dr. Hadi T. Ziboon, Department of Electrical Eng. U.O.T
= ∑𝑁 𝑀
𝑘=0 𝑎𝑘 𝑥[𝑛 − 𝑘] − ∑𝑘=1 𝑏𝑘 𝑦[𝑛 − 𝑘] … (5.16)
The choice between FIR and IIR filters depends on the relative advantages
of the two filters
1) FIR has linear phase response and this is important for data transition,
biomedicine, digital audio and image processing. However, the phase
responses of IIR filters are nonlinear.
2) FIR filters realized nonrecursively are always stable. The stability of
IIR cannot always be guranted, since IIR filters realized recursively.
3) FIR requires more coefficients for sharp cutoff than IIR. Thus for a
given amplitude response specification, more processing time and
storage will be required for FIR implantation.
4) Analogue filters can be readily transformed into equivalent IIR digital
filters meeting similar specifications. This is not possible with FIR
filters as they have no analogue counterpart. However, with FIR it is
easier to synthesize filters of arbitrary frequency responses.
8
Lect. 5, Asst. Prof. Dr. Hadi T. Ziboon, Department of Electrical Eng. U.O.T
Note Newer DSP processors have architectures that are tailored to FIR
filtering, and some are designed specifically for FIR.
2) 𝑦[𝑛] = ∑11
𝑘=0 𝑎𝑘 𝑥[𝑛 − 𝑘]
9
Lect. 5, Asst. Prof. Dr. Hadi T. Ziboon, Department of Electrical Eng. U.O.T
𝑧
−𝑎1 𝑏1 (1) (IIR)
+ +
𝑧
−𝑎2 𝑏2
𝑎0 𝑎1 𝑎2 𝑎11
+
y[n] (2) (FIR)
1) Filters (1) and (2) are IIR and FIR respectively.
2) The block diagrams are shown in figs (1) and (2).
3) From examination of the two difference equations and storage requirements
for both filters are summarized below.
FIR IIR
Number of multiplication 12 5
Number of addition 11 4
Storage locations (coeffients and data) 24 8
It is clear that IIR filter is more economical in both computational and storage
requirements than FIR.
10
Lect. 5, Asst. Prof. Dr. Hadi T. Ziboon, Department of Electrical Eng. U.O.T
The five steps are not necessarily, independent, nor are they always
performed in the order given.
𝛿𝑃 = passband deviation. …
𝛿𝑠 = stopband deviation. F s /2
𝑓𝑃 = passband edge frequency. 𝛿𝑠 𝑓𝑃 𝑓𝑠
𝑓𝑠 = stopband edge frequency. Pass band transition band stopband
f norm
- The edge frequencies are often given in normalized form, that is as
a fraction of the sampling frequency (𝑓/𝐹𝑠 ).
- Passband and stopband deviations may be expressed as ordinary
numbera are in decibels when they specify the passband ripple and
minimum stopband attenuation respectively
𝐴𝑠 (𝑠𝑡𝑜𝑝𝑏𝑎𝑛𝑑 𝑎𝑡𝑡𝑒𝑛𝑢𝑎𝑡𝑖𝑜𝑛) = −20𝑙𝑜𝑔10 𝛿𝑠 …. (5.18a)
𝐴𝑃 (𝑝𝑎𝑠𝑠𝑏𝑎𝑛𝑑 𝑟𝑖𝑝𝑝𝑙𝑒) = 20log (1 + 𝛿𝑃 ) …. (5.18b)
11
Lect. 5, Asst. Prof. Dr. Hadi T. Ziboon, Department of Electrical Eng. U.O.T
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:-
12
Lect. 5, Asst. Prof. Dr. Hadi T. Ziboon, Department of Electrical Eng. U.O.T
𝑧 𝑧
∑4𝑘=0 𝑎𝑘 𝑧 −𝑘
𝑎1 + −𝑏1 H(z)=
+ 1+∑4𝑘=1 𝑏𝑘 𝑧 −𝑘
𝑧 𝑧
𝑧 𝑧
13
Lect. 5, Asst. Prof. Dr. Hadi T. Ziboon, Department of Electrical Eng. U.O.T
𝑎4 −𝑏4
x[n] 𝑤1 (𝑛) 𝑦1 [𝑛] 𝑤2 (𝑛) y[n]
+ + + +
𝑎01 𝑎02
𝑧 𝑧
+ + + +
−𝑏11 𝑎11 −𝑏12 𝑎12
𝑧 𝑧
−𝑏21 𝑎21 −𝑏22 𝑎22
Fig (5.4b) cascade realization of a fourth order IIR filter
1+𝑎1𝑘 𝑧 −1 +𝑏2𝑘 𝑧 −2
𝐻(𝑧) = 𝐶 ∏2𝑘=1 Transfer function
1+𝑏1𝑘 𝑧 −1+𝑏2𝑘 𝑧 −2
𝑤1 [𝑛] = 𝐶𝑥[𝑛] − 𝑏11 𝑤1 [𝑛] − 𝑏21 𝑤1 [𝑛 − 2] Difference
𝑦1 [𝑛] = 𝑎01 𝑤1 [𝑛] + 𝑎11 𝑤1 [𝑛 − 1] + 𝑎21 𝑤1 [𝑛 − 2] equation
𝑤2 [𝑛] = 𝑦1 [𝑛] − 𝑏12 𝑤1 [𝑛] − 𝑏22 𝑤2 [𝑛 − 2]
𝑦[𝑛] = 𝑎02 𝑤2 [𝑛] + 𝑎12 𝑤2 [𝑛 − 1] + 𝑎22 𝑤2 [𝑛 − 2]
𝑤1 [𝑛] 𝑦1 [𝑛] fig (5.4c) parallel realization
+ +
𝑎01 of a fourth order IIR filter
𝑎0𝑘 +𝑎1𝑘 𝑧 −1
𝑧 𝐻(𝑧) = 𝐶 + ∑2𝑘=1
1+𝑏1𝑘 𝑧 −1 +𝑏2𝑘 𝑧 −2
+ −𝑏11 𝑎11
𝑧
−𝑏21
x[n] 𝑤2 [𝑛] 𝑦2 [𝑛] y[n]
+ + +
𝑎02
𝑤1 [𝑛] = 𝐶𝑥[𝑛] − 𝑏11 𝑤1 [𝑛] − 𝑏21 𝑤1 [𝑛 − 2]
𝑤2 [𝑛] = 𝑦1 [𝑛] − 𝑏12 𝑤1 [𝑛] − 𝑏22 𝑤2 [𝑛 − 2]
𝑧 𝑦1 [𝑛] = 𝑎01 𝑤1 [𝑛] + 𝑎11 𝑤1 [𝑛 − 1]
+ 𝑦2 [𝑛] = 𝑎02 𝑤2 [𝑛] + 𝑎12 𝑤2 [𝑛 − 2]
−𝑏12 𝑎12 𝑦3 [𝑛] = 𝐶𝑥 [𝑛]
𝑧
−𝑏22 𝑦3 [𝑛]
C 𝑦[𝑛] = 𝑦1 [𝑛] + 𝑦2 [𝑛] + 𝑦3 [𝑛]
14
Lect. 5, Asst. Prof. Dr. Hadi T. Ziboon, Department of Electrical Eng. U.O.T
+
y[n]
𝑀−1
𝑦[𝑛] = � 𝑏𝑘 𝑥[𝑛 − 𝑘]
𝑘=0
𝑀−1
𝐻(𝑧) = � 𝑏𝑘 𝑧 −𝑘
𝑘=0
b. Frequency-sampling realization is an alternative structure for an
FIR filter in which the parameters that characterize the filter are the
values of the desired frequency response instead of the impulse
response h[n]. To derive the frequency sampling structure, we
specify the desired frequency response at a set of equally spaced
frequencies. This structure required fewer computations
(multiplications and additions) than corresponding direct form Fig
(5.5b) shows this structure.
Fig (5.5b) Frequency Sampling structure
x[n] H(1)
+ +
𝑧 -1 𝑧
+ H(2) y[n]
+
H(N-1)
𝑧
+
15
𝑧
Lect. 5, Asst. Prof. Dr. Hadi T. Ziboon, Department of Electrical Eng. U.O.T
d. There are many other practical structures for digital filters, but most of
these are popular only in specific application areas. An example is the
lattice structure which finds use in speech and linear predication
application. The lattice structure may be used to represent FIR and IIR
filters. The basic lattice structure is characterized by a single input and a
pair of output as shown in fig (5.6a). A lattice structure is derived from
the basic structure in fig (5.6a)
𝑦1 [𝑛]
+
x[n] 𝑘1
+
𝑤1 [𝑛]
Fig (5.6a) basic lattice structure.
+ 𝑤1 [𝑛] 𝑧− + 𝑤2 [𝑛]
𝑧−
Fig (5.6b) 2-stage FIR
17
Lect. 5, Asst. Prof. Dr. Hadi T. Ziboon, Department of Electrical Eng. U.O.T
x[n]
𝑧 𝑧
ℎ[1] = −1.3435 ℎ[2] = 0.9025
+
y[n] fig (5.4a)FIR using Transversal
2) A two stage lattice structure for the filter is given in fig (5.4b). The
output of the structure are related to the input as
stage1 𝑦1 [𝑛] stage2
+
𝑦2 [𝑛]
+
x[n] 𝑘1 𝑘2
𝑘1 𝑘2
𝑧 − + 𝑧− +
Fig (5.4b) 𝑤1 [𝑛] 𝑤2 [𝑛]
𝑤1 [𝑛 − 1] = 𝑥 [𝑛 − 2] + 𝑘1 𝑥[𝑛 − 1]
𝑘1 (1 + 𝑘2 ) = ℎ[1]
ℎ[1]
∴ 𝑘1 = , 𝑘2 = ℎ[2]
1 + ℎ[2]
−1.3425
∴ 𝑘1 = = −0.706 , 𝑘2 = 0.9025
1 + 0.9025
18
Lect. 5, Asst. Prof. Dr. Hadi T. Ziboon, Department of Electrical Eng. U.O.T
Ex 5.5
Discuss the five main steps involved in the design of digital filters, using
the following design problem to illustrate your answer.
A digital filter is required for real time noise reduction (in medical
application). The filter should meet the following amplitude response
specifications:
Passband 0 – 10 Hz
Stopband 20 – 64 Hz
Sampling frequency 128Hz
Maximum passband deviation < 0.036 dB
Stopband attenuation > 30dB
Solution:
1)Requirement specification.
3) Selection of filter
5) implementation
19
University of Technology
Department of Electrical Engineering
Lect6
𝑦[𝑛] = ∑𝑁−1
𝑘=0 ℎ[𝑘] 𝑥[𝑛 − 𝑘] … (6.1a)
k=0,1,2,… N
𝐻(𝑧) = ∑𝑁−1
𝑘=0 ℎ(𝑘) 𝑧
−𝑘
… (6.1b)
Where h(k) :The impulse response coefficient of the filter.
H(z) : The transfer function of the filter
N: The filter length that is the number of the filter coefficients.
b) FIR filters can have an exactly linear phase response.
a) The phase delay of the filter is the amount of time delay for each
frequency components (𝑇𝑃 ).
b) The group delay is the average time delay of the composite signal
suffer at each frequency 𝑇𝑔
The phase delay is the negative of the phase angle divide by frequency
where the group delay is the negative of the derivative of the phase with
respect to 𝑤.
1
Lect. 6, Asst. Prof. Dr. Hadi T. Ziboon, Department of Electrical Eng. U.O.T
𝑇𝑃 = −∅(𝑤)/𝑤 …. (6.2a)
where 𝑇𝑃 = time or phase delay for each frequency component.
𝑑∅(𝜔)
𝑇𝑔 = − …. (6.2a)
𝑑𝜔
where 𝑇𝑔 = group delay (is the time delay of the composite signal at each
frequency.
A filter with a nonlinear phase characteristic will cause a phase distortion
in the signal that passes through it.
2
Lect. 6, Asst. Prof. Dr. Hadi T. Ziboon, Department of Electrical Eng. U.O.T
(2) FIR digital filter has impulse response, h(n) defined over the interval
0 ≤ 𝑛 ≤ 𝑁 − 1. Show that if N=7 and h[n] satisfies the symmetry
condition h[n]= h[N-n-1] the filter has a linear phase characteristic.
(3) Repeat (2) if N=8.
Solution
(1) The necessary and sufficient condition for a filter to have a linear
phase response must be symmetrical
ℎ[𝑛] = ℎ[𝑁 − 𝑛 − 1]
or ℎ[𝑛] = −ℎ[𝑁 − 𝑛 − 1]
For nonrecursive FIR filters, the storage space for coefficients and the
number of arithmetic operations are reduced by nearly a factor of 2.
For recursive FIR filters the coefficient can be made to be simple
integers, leading to increased speed of processing.
In linear phase filters, all frequency components experience the same
amount of delay through the filter that is no phase distortion.
(2) Using the symmetry condition we find that for N=7
ℎ[𝑛] = ℎ[𝑁 − 𝑛 − 1]
ℎ[0] = ℎ[7 − 0 − 1] = ℎ[6]
Using the same way to fined ℎ[1] = ℎ[5]. ℎ[2] = ℎ[4]. ℎ[3] = ℎ[3].
𝐻(𝑧) = ∑𝑁−1
𝑛=0 ℎ(𝑛) 𝑧
−𝑛
3
Lect. 6, Asst. Prof. Dr. Hadi T. Ziboon, Department of Electrical Eng. U.O.T
𝐻(𝑤) = 𝑒 −𝑗3𝑤 [ℎ[0]𝑒 𝑗3𝑤 + ℎ[1]𝑒 𝑗2𝑤 + ℎ[2]𝑒 𝑗𝑤 + ℎ[3] + ℎ[4]𝑒 −𝑗𝑤
+ ℎ[5]𝑒 −𝑗2𝑤 + ℎ[6]𝑒 −𝑗3𝑤 ]
Using the summitry condition we can group terms whose coefficients are
numerically equal
𝐻(𝑤) = 𝑒 −𝑗3𝑤 [ℎ[0](𝑒 𝑗3𝑤 + 𝑒 −𝑗3𝑤 ) + ℎ[1](𝑒 𝑗2𝑤 + 𝑒 −𝑗2𝑤 )
+ ℎ[2](𝑒 𝑗𝑤 + 𝑒 −𝑗𝑤 ) + ℎ[3]
𝐻(𝑤) = 𝑒 −𝑗3𝑤 [2ℎ[0] cos(3𝑤)
+ 2ℎ[1] cos(2𝑤) + 2ℎ[2] cos(𝑤) + ℎ[3]]
7−1
Since we have n=7, ∴ symmetrical at n= =3
2
- If we let a[0]=2h[3] and a[n]=2h[3-n],a[1]=2h[2],a[2]=2h[1],
a[3]=2h[0] n=0,1,2,3
h[n]
0 1 2 3 4 5 6 n
3 −𝑗3𝑤
∴ 𝐻(𝑤) = ∑𝑛 𝑎[𝑛] cos 𝑤(𝑛) 𝑒 … (1a)
−𝑗𝜑(𝑤)
= ±|𝐻(𝑤)|𝑒 …. (1b)
3
𝑗𝑤 𝑗𝑤
+ ℎ[3] �𝑒 − 2 + 𝑒 2 ��
𝑗7𝑤 7𝑤 5𝑤 3𝑤 𝑤
= 𝑒− 2 [2ℎ[0] cos � � + 2ℎ[1] cos � � + 2ℎ[2] cos � � + 2ℎ[3] cos � �]
2 2 2 2
𝑗∅(𝑤)
= ±|𝐻(𝑤)|𝑒
1
Where ±|𝐻(𝑤)| = ∑4𝑛=1 𝑏[𝑛] cos[𝑤 �𝑛 − 2�]
7 𝑁
∅(𝑤) = − 𝑎𝑛𝑑 𝑏[𝑛] = 2ℎ � − 𝑛�
2𝑤 2
Thus also the phase response is linear.
4
Lect. 6, Asst. Prof. Dr. Hadi T. Ziboon, Department of Electrical Eng. U.O.T
𝛿𝑠
Pass band 𝑓𝑃 transition 𝑓𝑠 stopband f
band
5
Lect. 6, Asst. Prof. Dr. Hadi T. Ziboon, Department of Electrical Eng. U.O.T
6
Lect. 6, Asst. Prof. Dr. Hadi T. Ziboon, Department of Electrical Eng. U.O.T
The impulse response for the ideal highpass, bandpass and bandstop
filters are obtained from the lowpass case of eq (6.9).
- From fig (6.2), an obvious solution to truncate the ideal response by
setting ℎ𝐷 (𝑛) = 0 for n > M (where M is the length of the window).
However, this introduce undesirable ripples and overshoots the so
called Gibb's phenomenon , Direct truncation of ℎ𝐷 [𝑛] as described
above is equivalent to multiplying the ideal impulse response by a
rectangular window of the form
𝑤 [𝑛]=1. 𝑛=0.1.2.…𝑀−1
=0 𝑒𝑙𝑠𝑒𝑤ℎ𝑒𝑟𝑒 } … . (6.10)
- In the frequency domain this is equivalent to convolving
𝐻𝐷 (𝑤)𝑎𝑛𝑑 𝑊(𝑤)𝑤ℎ𝑒𝑟𝑒 𝑊(𝑤) is the Fourier transform of w[n].
- A practical approach is to multiply the ideal impulse response, ℎ𝐷 (𝑛),
by a suitable window function, w[n], whose duration is finite, as
shown in fig (6.3).
𝐻𝐷 (𝑤) ℎ𝐷 [𝑛]
w n
W(w) w(n)
w n
|𝐻(𝑤)| ℎ[𝑛] = ℎ𝐷 [𝑛] w[n]
w n
7
Lect. 6, Asst. Prof. Dr. Hadi T. Ziboon, Department of Electrical Eng. U.O.T
n f
w[n] W(f)
-43db
(b) Hamming
n f
w[n] W(f)
-55db
(c)Blackman
n f
8
Lect. 6, Asst. Prof. Dr. Hadi T. Ziboon, Department of Electrical Eng. U.O.T
Ex.6.2 Determine the coefficient of an FIR low pass filter for n=0, 1,2,-- 26
to meet the specification given below using the Hamming window
method
Passband edge frequency 1.5KHz
Transition width 0.5KHz
Stopband attenuation 50 dB
Sampling frequency 8KHz
Solution The ideal impulse response for low pass filter is given by
eq (6.9)
sin(𝑛𝑤𝑐 )
ℎ𝐷 [𝑛] = 2𝑓𝑐 𝑛≠0
𝑛𝑤𝑐
ℎ𝐷 [𝑛] = 2𝑓𝑐 if n=0 if n=0
0.5
∆𝑓 = = 0.0625 [The normalized transition bandwidth]
8
Using eq (6.12) to find N
3.3 3.3
But 𝑁 = = 0.0625 = 52.8 ≅ 53 𝑓𝑖𝑙𝑡𝑒𝑟 𝑙𝑒𝑛𝑔𝑡ℎ
∆𝑓
The filter coefficients are obtained from [ℎ𝐷 [𝑛] 𝑤[𝑛]]
2𝑓𝑐 sin(𝑛𝑤𝑐 )
Where ℎ𝐷 [𝑛] = 𝑖𝑓 𝑛≠0
𝑛𝑤𝑐
ℎ𝐷 [𝑛] = 2𝑓𝑐 if n=0
Hamming window is given by
2𝜋𝑛
𝑤[𝑛] = 0.54 + 0.46 cos( ) − 26 ≤ 𝑛 ≤ 26
53
Because of the smearing effect of the window on the filter response, the
cutoff response of the resulting filter will be different from that given in
the specifications. To solve the problem, we will use an 𝑓𝑐 that is centered
on the transition band
∆𝑓 0.5
𝑓𝑐 = 𝑓𝑐 + = 1.5 + = 1.75𝐾𝐻𝑧
2 2
9
Lect. 6, Asst. Prof. Dr. Hadi T. Ziboon, Department of Electrical Eng. U.O.T
1.75
The normalized 𝑓𝑐′ = = 0.21875
8
Not that h[n] is symmetrical, thus we need only compute values for h[0],
h[1], ….. , h[26]
- n=0, ℎ𝐷 = 2𝑓𝑐 = 2 × 0.21875 = 0.4375
𝑤 [0] = 0.54 + 0.46 cos(0) = 1
∴ ℎ[0] = ℎ𝐷 [0]𝑤[0] = 0.4375 × 1 = 0.4375
sin(𝑛𝑤𝑐 ) 2×0.21875
- n=1, ℎ𝐷 [𝑛] = 2𝑓𝑐 = sin(2𝜋 × 0.21875)
𝑛𝑤𝑐 2𝜋×0.21875
sin[360 × 0.21875]
ℎ𝐷 [ 1 ] = = 0.31219
𝜋
2𝜋𝑛
𝑤 [𝑛] = 0.54 + 0.46 cos � �
53
2𝜋
𝑤[1] = 0.54 + 0.46 cos( ) = 0.98713
53
ℎ(1) = ℎ(−1) = ℎ𝐷 [1] 𝑤(1) = 0.31219 × 0.98713
= 0.31119
- Using the same procedure to find
ℎ(2) = ℎ(−2) = ℎ𝐷 [2] 𝑤[2] = 0.06012
ℎ(26) = ℎ(−26) = ℎ𝐷 [26] 𝑤[26] = 0.000913
- We note that the indices of the filter coefficients run from -26 to +26.
To make the filter causal, necessary for implementation, we add 26 to
each index so that indices start at zero.
- Advantage and disadvantage of the window method
1) An important advantage of the window method is its simplicity. It
is simple to apply and simple to understand. It involves a
minimum of computation.
2) The major disadvantage is its lack of flexibility. Both the peak
passband and stopband ripples are approximately equal, so that the
designer may end up.
10
Lect. 6, Asst. Prof. Dr. Hadi T. Ziboon, Department of Electrical Eng. U.O.T
1 1
0.8 H(w) practical
w w
11
Lect. 6, Asst. Prof. Dr. Hadi T. Ziboon, Department of Electrical Eng. U.O.T
w
𝐹𝑠
H(k)
(b)
4 5 6 7 8 9 10 12 14 k
̭
|𝐻(𝑘)|
(c)
W
12
Lect. 6, Asst. Prof. Dr. Hadi T. Ziboon, Department of Electrical Eng. U.O.T
13
Lect. 6, Asst. Prof. Dr. Hadi T. Ziboon, Department of Electrical Eng. U.O.T
- For the important case of linear phase h[n] will be symmetrical and so we can
write (for N even)
𝑵
−𝟏
⎡𝟐 ⎤
𝟏
𝒉[𝒏] = ⎢ � 𝟐|𝑯(𝒌)| 𝐜𝐨𝐬[𝟐𝝅𝒌(𝒏 − 𝜶)/𝑵 + 𝑯(𝟎)]⎥ … (𝟔. 𝟏𝟒)
𝑵⎢ ⎥
𝒌=𝟏
⎣ ⎦
- For n odd, the upper limit in the summation is (N-1)/2.
2)The ideal frequency response is shown in fig (6.7a). The frequency samples are
taken at intervals of 𝒌𝒇𝒔 /𝑵, that is at intervals of multiple of 18kHz /9 = 2kHz for
each interval. Thus the frequency are given by
H(k)=1 k=0,1,2
=0 k=3,4
𝑵−𝟏 𝒈−𝟏
Using eq(6.14) to find α= 𝟐
= 𝟐
≅ 𝟒 to find the impulse response coefficients as
shown in table
𝟒
𝟏 𝟐𝝅𝒌(𝒏 − 𝜶)
𝒉[𝟎] = �� 𝟐 𝑯(𝒌) 𝐜𝐨𝐬 � � + 𝑯(𝟎)�
𝟗 𝟗
𝒌=𝟏
𝟏 −𝟒 −𝟒
= [𝟐𝑯(𝟏) 𝐜𝐨𝐬[𝟐𝝅 × 𝟏 × ( ) + 𝟐𝑯(𝟐) 𝐜𝐨𝐬[𝟐𝝅 × 𝟐 × ( ) + 𝟎 + 𝟎 + 𝟏
𝟗 𝟗 𝟗
𝟏
= [𝟐 × 𝟏 × (−𝟎. 𝟗𝟑𝟓) + 𝟐 × 𝟎. 𝟕𝟔𝟔 + 𝟏] = 𝟕. 𝟐 × 𝟏𝟎−𝟐
𝟗
But positive symmetry h(n)=h(N-1-n)
Using the same procedure to find h[1], h[2], h[3], …, h[8]
h[0] = 0.07252262 =h[8] H(k) fig(6.7)
h[1] = -0.11111 =h[7]
h[2] = -0.059120 =h[6]
h[3] = 0.3199 =h[5] 0 1 2 2.5 3 4 5 6 7 8 9 k
h[4] = 0.555 =h[4] [ this mean each value of step =2kHz,
14
University of Technology
Department of Electrical Engineering
Lect 7
∞ 𝑁 𝑀
Where h[k] is the impulse response of the filter, 𝑎𝑘 and 𝑏𝑘 are the
coefficients of the filter, and x[n] and y[n] are the input and output of the
filter. The transfer function for the IIR filter is
𝑎0 + 𝑎1 𝑧 −1 + ⋯ + 𝑎𝑁 𝑧 −𝑁 ∑𝑁
𝑘=0 𝑎𝑘 𝑧
−𝑘
𝐻(𝑧) = = … (7.2)
1 + 𝑏1 𝑧 −1 + ⋯ + 𝑎𝑀 𝑧 −𝑀 1 + ∑𝑀
𝑘=1 𝑏𝑘 𝑧
−𝑘
- An important part of the IIR filters design to find the values of 𝑎𝑘 and
𝑏𝑘 to satisfy the required filter characteristics. Eq (7.1) and (7.2) are
the characteristics equation for IIR filter.
- As shown in eq (7.1), the current output y[n] is a function of past
output y[n-k] as well as present and past input samples x[n-k].
- The strength of IIR filters comes from the flexibility the feedback
arrangement.
- IIR filters normally require fewer coefficients than FIR for the same
applications, which is why IIR filters are used when sharp cutoff and
high throughput are important requirements.
- The main problem of the IIR filter is the stability.
- The transfer function of IIR filter H(z) given in eq (7.2) can be
factored as
𝑘(𝑧 − 𝑧1 )(𝑧 − 𝑧2 ) … (𝑧 − 𝑧𝑁 )
𝐻(𝑧) = … (7.3)
(𝑧 − 𝑃1 )(𝑧 − 𝑃2 ) … (𝑧 − 𝑃𝑀 )
1
Lect. 7, Asst. Prof. Dr. Hadi T. Ziboon, Department of Electrical Eng. U.O.T
𝛿𝑠
2
Lect. 7, Asst. Prof. Dr. Hadi T. Ziboon, Department of Electrical Eng. U.O.T
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:
Im 𝐹𝑠 /4 |H(f)|
𝐹𝑠 /2 0 Re
3𝐹𝑠 /4
𝐹𝑠 𝐹𝑠 3𝐹𝑠
0 𝐹𝑠 f
4 2 4
(a) (b)
3
Lect. 7, Asst. Prof. Dr. Hadi T. Ziboon, Department of Electrical Eng. U.O.T
0.937
Re
-0.937
4
Lect. 7, Asst. Prof. Dr. Hadi T. Ziboon, Department of Electrical Eng. U.O.T
Fig (7.2a)
f
Solution 50Hz
1) To reject the component at 50Hz, we place a pair of complex zeros at points on
50
the unit circle correspond 50Hz that is at angle 360 × 500 = ±36𝑜 as shown in fig
(7.2b).
2) To achieve a sharp notch filter and improved Im
response on either side of notch frequency,
a pair of complex conjugate poles is placed at a radius.
Fig(7.2b) -1 R
5
Lect. 7, Asst. Prof. Dr. Hadi T. Ziboon, Department of Electrical Eng. U.O.T
𝐵𝑊 ±5 10
𝑟 =1− =1− 𝜋 =1− 𝜋 = 0.937 [𝐵𝑊 = 2 × 5 = 10𝐻𝑧]
𝐹𝑠 500 500
3) The pole-zero diagrams in fig (7.2a). From the figure, the transfer
function of the filter is given by
0 0
(𝑧−𝑒 −𝑗36 )(𝑧−𝑒 𝑗36 )
𝐻(𝑧) = where the angle of poles
(𝑧−0.937𝑒 −𝑗39.6 )(𝑧−0.937𝑒 𝑗39.6 )
6
Lect. 7, Asst. Prof. Dr. Hadi T. Ziboon, Department of Electrical Eng. U.O.T
Solution (1) The impulse response, h(t), is given by the inverse Laplace
transform. Assume the transfer function of the analogue lowpass filter RC
𝐶
is given by 𝐻(𝑠) = .
𝑆−𝑃
𝐶
ℎ(𝑡) = 𝐿−1 [𝐻(𝑠)] = 𝐿−1 � � = 𝐶𝑒 𝑃𝑡
𝑆−𝑃
where 𝐿−1 is the inverse Laplace transform
P is the pole of H(s)
(2) According to the impulse invariant method, the impulse response of the
equivalent digital filter, h(nT), is equal to h(t) at the discrete time t=nT,
n=0, 1, 2, … that is
ℎ(𝑛𝑇) = ℎ(𝑡)|𝑡=𝑛𝑇 = 𝐶𝑒 𝑃𝑛𝑇
The transfer function of H(z) is obtained by z-transforming of h(nT)
∞ ∞
𝐶
𝐻(𝑧) = � ℎ(𝑛𝑇) 𝑧 −𝑛 = � 𝐶 𝑒 𝑃𝑛𝑇 𝑧 −𝑛 =
1 − 𝑒 𝑃𝑇 𝑧 −1
𝑛=0 𝑛=0
𝑘𝑧 𝑘
Since [z-transform of 𝑘𝑒 −𝛼𝑛 is given by
𝑧−𝑒 −𝛼
= 1−𝑒 −𝛼𝑧 −1 ]
Thus, form the result above, we can write
𝐶 𝐶
→ … . (7.5)
𝑆−𝑃 1 − 𝑒 𝑃𝑇 𝑧 −1
(3) To apply impulse invariant method to high order (for ex, Mth.order) IIR
filter with simple poles, the transfer function, H(s) is first expanded using
partial fractions as the sum of single pole filters
𝐶1 𝐶2 𝐶𝑀
𝐻(𝑠) = + + ⋯. … . (7.6)
𝑠 − 𝑃1 𝑠 − 𝑃2 𝑠 − 𝑃𝑀
𝑀
𝐶𝑘
=�
𝑠 − 𝑃𝑘
𝑘=1
Where the 𝑃𝑘 are the poles of H(s)
𝑀 𝑀
𝐶𝑘 𝐶𝑘
∴� →� … (7.7)
𝑠 − 𝑃𝑘 1 − 𝑒 𝑃𝑇 𝑧 −1
𝑘=1 𝑘=1
7
Lect. 7, Asst. Prof. Dr. Hadi T. Ziboon, Department of Electrical Eng. U.O.T
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.
1
𝐻(𝑠) =
𝑠 2 + √2 𝑠 + 1
Using the impulse invariant method obtain the transfer function, H(z), of
the digital filter, assuming a 3 dB cutoff frequency of 150Hz and sampling
frequency 1.28kHz.
8
Lect. 7, Asst. Prof. Dr. Hadi T. Ziboon, Department of Electrical Eng. U.O.T
1 𝛼2
𝐻− (𝑠) = 𝐻(𝑠)|𝑠= 𝑠 = =
𝛼 𝑠 2 𝑠 𝑠 2 + √2 𝛼 𝑠 + 𝛼 2
�𝛼 � + √2 𝛼 + 1
𝐶1 𝐶2
= +
𝑠 − 𝑃1 𝑠 − 𝑃2
x[n]
𝑧 0.308
+
y[n]
𝑧
1.0308
𝑎 =0 𝑏1 =−1.03
{𝑎01=0.307 𝑏2 =0.3530 𝑧
−0.3530
9
Lect. 7, Asst. Prof. Dr. Hadi T. Ziboon, Department of Electrical Eng. U.O.T
Summary of the impulse invariant method procedure for calculating IIR filter
coefficients
1) Determine a normalization analogue filter, H(s), that satisfies the
specifications for the desired digital filter.
2) If, necessary, expand H(s) using partial functions.
3) Obtain the z-transform of each partial fraction.
4) Obtain H(z). If the actual sampling frequency is used then multiply H(z) by
𝑇𝑠 (sampling period= 1/𝐹𝑠 ).
Remarks on the impulse invariant method
1) The impulse response of the discrete filter, h[n] is identical to that of the
analogue filter, h(t), at the discrete time instants t=nT, n=0, 1, 2, … as
shown in fig (7.7a). It is for this reason this method is called the impulse
invariant method.
2) The sampling frequency affects the frequency response of the impulse
invariant discrete filter. High sampling frequency is necessary for
frequency response to be close to that of the equivalent analogue filter.
3) As in the case with sampling data systems, the spectrum of the impulse
invariant filter corresponding to H(z) would be the same that of the
analogue H(s), but repeats at multiplies of the sampling frequency as
shown in fig(7.8 a, b), leading to aliasing.
Fig (7.7a) |H(f)| fig(7.8 a)
h(t)
𝐹𝑠 2𝐹𝑠 f
(a) Spectrum of an analogue filter
(b) Spectrum of an equivalent impulse
2T 4T 6T 8T 10T Time invariant digital filter showing effects
fig(7.7b) (nT interval) of aliasing.
10
Lect. 7, Asst. Prof. Dr. Hadi T. Ziboon, Department of Electrical Eng. U.O.T
Re Re
11
Lect. 7, Asst. Prof. Dr. Hadi T. Ziboon, Department of Electrical Eng. U.O.T
12
Lect. 7, Asst. Prof. Dr. Hadi T. Ziboon, Department of Electrical Eng. U.O.T
0.4208(1+𝑧 −1 )
H(z) = 1−0.1584𝑧 −1
0.4208
x(n) 𝑧 + y(n)
x[t] R y[t] 𝑧
0.1584
13
Lect. 7, Asst. Prof. Dr. Hadi T. Ziboon, Department of Electrical Eng. U.O.T
𝑠 ′
𝑤𝑃 𝑇 2
𝑠= 𝑤ℎ𝑒𝑟𝑒 𝑤𝑃 = 𝑘 tan 𝑘 = 1 𝑜𝑟
𝑤𝑃′ 2 𝑇
2) The BZT is applied by replacing s in the new transfer function as
𝑧−1
𝑠=𝑘
𝑧+1
3) It is common practice in many texts to use the factor k=2/T.
It should be mentioned that both k=1 and k=2/T lead to the same results because k is
cancelled out anyway. To illustrate this consider the following simple filter
1
𝐻(𝑠) =
𝑠+1
Assuming that the digital filter is to have a cutoff frequency of 𝑤𝑃 , then we must
frequency scale H(s) with the following frequency
𝑤𝑃 𝑇
𝑤𝑃′ = 𝑘 tan( )
2
Then the transfer function is
1
𝐻′ (𝑠) = 𝐻(𝑠)|𝑠= 𝑠 = 𝑠
𝑤 𝑇 +1
𝑤𝑃′
𝑘 tan( 𝑃 )
2
𝑘(𝑧−1)
Now we replace 𝑠 =
(𝑧+1)
∴ 𝐻(𝑧) = 𝐻′ (𝑠)|𝑠=𝑘𝑧−1
𝑧+1
1 1
= =
𝑘(𝑧 − 1) 𝑤 𝑇 (𝑧 − 1)
� 𝑧+1 � cot � 2𝑃 � +1
(𝑧 + 1)
𝑤 𝑇 + 1
[𝑘𝑡𝑎𝑛 � 2𝑃 �]
From the above we see that the factor k is cancelled out it would not have
mattered whether k=1 or 2/T.
4) For more computation efficiency, the two transformation can be
𝑤 𝑇 𝑧−1
combined into one transformation 𝑠 = [cot � 𝑃 �][ ].
2 𝑧+1
14
Lect. 7, Asst. Prof. Dr. Hadi T. Ziboon, Department of Electrical Eng. U.O.T
𝛿𝑠
𝑤𝑃′ 𝑤𝑠′ f
- The transfer function, H(s), for the Chebyshev response depends On the
desired passband ripple and the filter order, N. The attenuation in decibles
and the filter order N are given by
15
Lect. 7, Asst. Prof. Dr. Hadi T. Ziboon, Department of Electrical Eng. U.O.T
16
Lect. 7, Asst. Prof. Dr. Hadi T. Ziboon, Department of Electrical Eng. U.O.T
Ex. 7.7 Convert the simple low pass filter (RC filter) into equivalent digital
high pass filter. Assume a sampling frequency of 150 Hz and a cutoff
frequency of 30Hz.
Determine the transfer function and difference equation.
Draw the block diagram of the high pass filter
Solution The critical frequency for the digital filter is 𝑤𝑃 = 2𝜋 × 30 𝑟𝑎𝑑
𝑤𝑃 𝑇
and for analogue filter 𝑤𝑃′ = tan( ), with T=1/50
2
2𝜋 × 30
∴ 𝑤𝑃′ = tan = 0.7265
2 × 150
- The s-plane transfer function of the low pass filter is given by
1
𝐻(𝑠) = 𝑠+1 …(7.8.1)
Using the LPF to HPF transformation of equation (7.18b), the
denormalized analog transfer function is obtains as
1 1 𝑠
𝐻 ′ (𝑠) = 𝐻 (𝑠)| 𝑤′ = = =
𝑤𝑃′ 0.7265
𝑠= 𝑃
𝑠 +1 + 1 𝑠 + 0.7265
𝑠 𝑠
The z-plane transfer function is obtained by applying the BZT
(𝑧−1)/(𝑧+1) 𝑧−1
𝐻 (𝑧) = 𝐻′ (𝑠)|𝑠=𝑧−1 = 𝑧−1 =(
𝑧+1 +0.7265 𝑧−1)+(𝑧+1)0.7265
𝑧+1
1 − 𝑧−1 1 − 𝑧−1
𝐻(𝑧) = =
(1 − 𝑧−1 ) + (𝑧−1 + 1)0.7265 1.7265 − 0.2735𝑧−1
1 − 𝑧 −1
𝐻 (𝑧) = 0.5792
1 + 0.1584𝑧 −1
𝑌(𝑧) 1−𝑧 −1
To fined DE
𝑋(𝑧)
= 0.5792 1+0.1584𝑧 −1
𝑌(𝑧)[1 + 0.1584𝑧 −1 ] = 0.5792(1 − 𝑧 −1 )𝑋(𝑧)
Using IZT
∴ 𝑦[𝑛] = −0.158 𝑦[𝑛 − 1] + 0.5791 𝑥 [𝑛] − 0.5791 𝑥[𝑛 − 1]
Compare y[n] with eq (7.1)
𝑁 𝑀
Ex. 7.8 A discrete band pass filter with Butterworth characteristics meeting
the following specifications is required. Determine the transfer function H(z)
with pole-zero diagram. Using BZT. Starting with first order low pass filter.
Pass band =200-300Hz, sampling frequency=2000Hz and filter order=2.
Solution The prewarped pass band edge frequencies are given by
𝑤1 𝑇 2 × 200𝜋
𝑤1′
= tan � � = tan = 0.3249
2 2000 × 2
′
𝑤2 𝑇 2 × 300𝜋
𝑤2 = tan � � = tan = 0.5095
2 2000 × 2
𝑤02 = 𝑤1′ 𝑤2′ = 0.3249 × 0.5095 = 0.1655
𝑊 = 𝑤2− − 𝑤1− = 0.5095 − 0.3249 = 0.1846
A first order normalized analogue filter is
1
𝐻 (𝑠) = (𝐸𝑥. 7.8.1)
𝑠+1
Using the low pass to band pass filter eq(7.18c)
′(
1
𝐻 𝑠) = 𝐻(𝑠)| 𝑠 2 +𝑤02 = 2
𝑠= 𝑠 + 𝑤02
𝑊𝑠 + 1
𝑊𝑠
𝑊𝑆
= 2 … [𝐸𝑥. 7.8.2]
𝑠 + 𝑊𝑆 + 𝑤02
Applying the BZT to the analogue band pass filter
𝑊 (𝑧 − 1)
𝐻 ′ (𝑠) = 𝐻 (𝑠)| (𝑧−1) = 𝑧+1
𝑠= 𝑊 (𝑧 − 1)
(𝑧+1) [(𝑧 − 1)/(𝑧 + 1)]2 + + 𝑤02
𝑧+1
𝑊(𝑧 2 − 1)/(1 + 𝑊 + 𝑤02 )
=
2 2(𝑤02 − 1) 2 2
𝑧 +� 2 � 𝑧 + (1 − 𝑊 + 𝑤0 )/(1 + 𝑊 + 𝑤0 )
1 + 𝑊 + 𝑤0
Substituting the value of 𝑤02 and W and simplifying we have
1 − 𝑧 −2
𝐻 (𝑧) = 0.1367 … (𝐸𝑥. 7.8.3)
1 − 1.2362𝑧 −1 + 0.7265𝑧 −2
18
Lect. 7, Asst. Prof. Dr. Hadi T. Ziboon, Department of Electrical Eng. U.O.T
R R
(a) (b)
Im
z-plane
R
(c)
a) Pole-zero diagrams for a reference LPF eq(7.8.1)
b) Intermediate analogue band pass filter eq(7.8.2)
c) Discrete band pass filters by BZT eq(7.8.3)
1
𝐻(𝑠) = … (7.8.1)
𝑠+1
1
𝐻 − (𝑠) = … (7.8.2)
𝑠 2 +𝑊𝑠+𝑤02
1−𝑧 −2
𝐻(𝑠) = … (7.8.3)
1−1.2362 𝑧 −1 +0.7265 𝑧 −2
19