Digital Signal Processing: Mustansiriyah University College of Engineering Electrical Engineering Department 4 Class
Digital Signal Processing: Mustansiriyah University College of Engineering Electrical Engineering Department 4 Class
Digital Signal Processing: Mustansiriyah University College of Engineering Electrical Engineering Department 4 Class
College of Engineering
Electrical Engineering Department
4th Class
2024-2025
Digital Signal Processing / 4th Class/ 2024-2025
Topics Covered
Introduction to Digital Signal Processing
Signal Sampling and Reconstructions: Sampling of Continuous Signal,
Signal Reconstruction, Aliasing Noise Level
Digital Signals and Systems: Classification of Systems, Linear System,
Time-Invariant System, Causal System, Stability
Digital Convolution: Graphical Method, Table Lookup Method, Matrix by
Vector Method, Linear Convolution and Circular Convolution,
Deconvolution
Frequency Response and Sinusoidal Steady State Response
Z-Transform (Review), Discrete Fourier Transform, Fast Fourier
Transform
Fast Fourier Transform (FFT) Algorithms
Analog Filter Design: Butterworth Filters , Chebyshev Filters.
Digital Filter Design: Infinite Impulse Response (IIR) filter , Finite Impulse
Response (FIR) filter
Realization of Digital Filters :Realization of IIR Filters , Realization of FIR
Filters
Theoretical: 2 Hrs/Wk
Total hours (60 Theoretical)
Suggested References:
1) "Digital Signal Processing Principles, Algorithms, and Applications", John G. Proakis,
Dimitris G. Manolakis, Third Edition (1996).
2) "Applied Digital Signal Processing Theory and Practice", Dimitris G. Manolakis, Vinay K.
Ingle, First Edition (2011).
Digital Signal Processing / 4th Class/ 2024-2025
• Continuous in time.
• Amplitude may take on any value in the continuous range of (-∞,∞).
❖ Analog Processing
• Differentiation, Integration, Filtering, Amplification.
• Differential Equations
• Implemented via passive or active electronic circuitry.
B. Discrete-Time signals:
Discrete signals are defined only at certain specific value of time as shown in Fig. 2.
.
Fig. 2. Discrete signal
1
Digital Signal Processing / 4th Class/ 2024-2025
C. Digital Signal:
Digital signal is the signal that takes on values from a finite set of possible values as
shown in Fig. 3.
In contrast, the infinite length signal is nonzero over all real numbers.
2
Digital Signal Processing / 4th Class/ 2024-2025
Where,
ℎ(𝑡): The System Impulse Response
H(𝑠): The System Transfer Function
H(Ω): The System Frequency Response
Analogue signal processing is achieved by using analogue components such as:
▪ Resistors.
▪ Capacitors.
▪ Inductors.
3
Digital Signal Processing / 4th Class/ 2024-2025
As shown in the diagram, the analog input signal, which is continuous in time and
amplitude, is generally encountered in our real life. Examples of such analog signals include
current, voltage, temperature, pressure, and light intensity. Usually a transducer (sensor) is
used to convert the non-electrical signal to the analog electrical signal (voltage). This analog
signal is fed to an analog filter, which is applied to limit the frequency range of analog signals
prior to the sampling process. The purpose of filtering is to significantly attenuate aliasing
distortion.
The band-limited signal at the output of the analog filter is then sampled and converted
via the ADC unit into the digital signal, which is discrete both in time and in amplitude.
The DSP then accepts the digital signal and processes the digital data according to
DSP rules such as lowpass, highpass, and bandpass digital filtering, or other algorithms for
different applications. Notice that the DSP unit is a special type of digital computer and can be
a general-purpose digital computer, a microprocessor, or an advanced microcontroller;
furthermore, DSP rules can be implemented using software in general. With the DSP and
4
Digital Signal Processing / 4th Class/ 2024-2025
corresponding software, a processed digital output signal is generated. This signal behaves in a
manner according to the specific algorithm used.
The DAC unit converts the processed digital signal to an analog output signal. The
signal is continuous in time and discrete in amplitude (usually a sample-and-hold signal).
The final stage in Fig. 7 is often another analog filter designated as a function to
smooth the DAC output voltage levels back to the analog signal (i.e. to reconstruct the analog
signal from the DAC output).
In contrast to the above, a direct analog processing of analog signals is much simpler
since it involves only a signal processor. It is therefore natural to ask why we go to use the
DSP systems. There are several good reasons:
1- Rapid advances in integrated circuit design and manufacture are producing more
powerful DSP systems on a single chip at decreasing size and cost.
3- Good processing techniques are available for digital signals, such as Data compression
(or source coding), Error Correction (or channel coding), Equalization and Security.
4- Easy to mix signals and data using digital techniques known as Time Division
Multiplexing (TDM).
The list below by no means covers all DSP applications. Many more areas are
increasingly being explored by engineers and scientists. Applications of DSP techniques will
continue to have profound impacts and improve our lives.
1- Digital audio and speech: Digital audio coding such as CD players, digital crossover,
digital audio equalizers, digital stereo and surround sound, noise reduction systems,
speech coding, data compression and encryption, speech synthesis and speech
recognition.
5- Medical imaging equipment: ECG analyzers, cardiac monitoring, medical imaging and
image recognition, digital x-rays, image processing, magnetic resonance, tomography
and electrocardiogram.
6- Multimedia: Internet phones, audio, and video, hard disk drive electronics, digital
pictures, digital cameras, DVD, JPEG, Movie special effects, video conferencing, text-
to-voice and voice-to-text technologies.
6
Digital Signal Processing / 4th Class/ 2024-2025
Fig. 9. Display of analog (continuous) signal and digital samples versus the sampling time instants
7
Digital Signal Processing / 4th Class/ 2024-2025
For a given sampling interval T, which is defined as the time span between two sample
points, the sampling rate or sampling frequency is the rate at which the signal is sampled,
expressed as the number of samples per second (reciprocal of the sampling interval).
f s 2 f max
Where, fmax is the maximum-frequency component of the analog signal to be sampled.
8
Digital Signal Processing / 4th Class/ 2024-2025
Ts is called the Nyquist interval: It is the longest time interval that can be used for sampling a
band limited signal and still allow reconstruction of the signal at the receiver without
distortion.
Example: Find the Nyquist frequency and Nyquist interval of the following signals:
a) speech signal containing frequencies up to 4 kHz
b) audio signal possessing frequencies up to 20 kHz
Solution:
a) to sample a speech signal containing frequencies up to 4 kHz, the Nyquist rate
(minimum sampling rate fs) is chosen to be at least 8 kHz, or 8,000 samples per
second (fs=2fm) and Nyquist interval (maximum time interval Ts) is 1/fs = 1/8 kHz =
0.125 ms.
b) to sample an audio signal possessing frequencies up to 20 kHz, at least 40,000 samples
per second, or 40 kHz, of the audio signal are required and Nyquist interval
(maximum time interval Ts) is 1/fs = 1/40 kHz = 25 μs.
From the spectral analysis shown in Fig. 12, it is clear that the sampled signal spectrum
9
Digital Signal Processing / 4th Class/ 2024-2025
consists of the scaled baseband spectrum centered at the origin and its replicas centered at the
frequencies of ± nfs (± n/Ts) (multiples of the sampling rate) for each of n = 1,2,3, . . .
In Fig. 12, three possible sketches are classified. Given the original signal spectrum
X(f) plotted in Fig. 12(a), the sampled signal spectrum is plotted in Fig. 12(b), where, the
replicas have separations between them. In Fig. 12(c), the baseband spectrum and its replicas
are just connected. In Fig. 12(d), the original spectrum and its replicas are overlapped; that is,
there are many overlapping portions in the sampled signal spectrum.
If applying a lowpass reconstruction filter to obtain exact reconstruction of the original signal
spectrum,
➢ As long as fs > 2B, no overlap of repeated replicas X(f - n/Ts) will occur in Xs(f). Hence,
the signal at the output of the filter will be the original signal spectrum without
distortion as shown in Fig. 13.
➢ If the waveform is undersampled (i.e. fs < 2B), then there will be spectral overlap in the
sampled signal. Hence, the signal at the output of the filter will be different from the
original signal spectrum as shown in Fig. 14. [This is the outcome of aliasing].
➢ This implies that whenever the sampling condition is not met, an irreversible overlap of
10
Digital Signal Processing / 4th Class/ 2024-2025
Example:
Suppose that an analog signal is given as
x(t) = 5 cos (2π.1000t), for t > 0, and is sampled at the rate of 8,000 Hz.
a. Sketch the spectrum for the original signal.
b. Sketch the spectrum for the sampled signal from 0 to 20 kHz.
Sol.
a. Since the analog signal is sinusoid with a peak value of 5 and frequency of 1,000 Hz, we
can write the sine wave using Euler’s identity:
11
Digital Signal Processing / 4th Class/ 2024-2025
b. After the analog signal is sampled at the rate of 8,000 Hz, the sampled signal spectrum and
its replicas centered at the frequencies ±nfs, each with the scaled amplitude being 2.5/T, are as
shown in Figure below.
Notice that the spectrum of the sampled signal contains the images of the original spectrum;
that the images repeat at multiples of the sampling frequency fs (for our example, 8 kHz, 16
kHz, 24 kHz, . . . ); and that all images must be removed, since they convey no additional
information.
Signal reconstruction
Two simplified steps are involved, as described in Fig. 15. First, the digitally
processed data y(n) are converted to the ideal impulse train ys(t), in which each impulse has its
amplitude proportional to digital output y(n), and two consecutive impulses are separated by a
sampling period of T; second, the analog reconstruction filter is applied to the ideally
recovered sampled signal ys(t) to obtain the recovered analog signal.
The following three cases are listed for recovery of the original signal spectrum:
12
Digital Signal Processing / 4th Class/ 2024-2025
Case 1: fs = 2fmax: Nyquist frequency is equal to the maximum frequency of the analog signal
x(t), an ideal lowpass reconstruction filter is required to recover the analog signal spectrum.
This is an impractical case.
Case 2: fs > 2fmax: In this case, there is a separation between the highest frequency edge of the
baseband spectrum and the lower edge of the first replica. Therefore, a practical lowpass
reconstruction (anti-image) filter can be designed to reject all the images and achieve the
original signal spectrum.
Case 3: fs < 2fmax: This is aliasing, where the recovered baseband spectrum suffers spectral
distortion, that is, contains an aliasing noise spectrum; in time domain, the recovered analog
signal may consist of the aliasing noise frequency or frequencies. Hence, the recovered analog
signal is incurably distorted.
x(t) = 5cos(2π.2000t) +3cos(2π.3000t) for t ≥ 0, and it is sampled at the rate of 8,000 Hz,
The two-sided amplitude spectrum for the sinusoids (sampled signal) is displayed in Fig.
b. Based on the spectrum in (a), the sampling theorem condition is satisfied; hence, we can
recover the original spectrum using a reconstruction lowpass filter. The recovered spectrum
is shown in the following Fig.
13
Digital Signal Processing / 4th Class/ 2024-2025
2n
f
1 + a
fc
Aliasing noise level % = for 0 ≤ f ≤ fc
2n
f − fa
1 + s
fc
Where, n is the filter order, fa is the aliasing frequency, fc is the cutoff frequency, and fs is the
sampling frequency.
Example: In a DSP system with anti-aliasing filter, if a sampling rate of 8,000 Hz is used and the
anti-aliasing filter is a second-order Butterworth lowpass filter with a cutoff frequency of 3.4
kHz,
a. Determine the percentage of aliasing level at the cutoff frequency.
b. Determine the percentage of aliasing level at the frequency of 1,000 Hz.
Sol.
14
Digital Signal Processing / 4th Class/ 2024-2025
15
Digital Signal Processing / 4th Class/ 2024-2025
❑ exponential sequence
▪ If β=0, x(n)=A
▪ If β<0, x(n) is exponential decay.
▪ If β˃0, x(n) is exponential growth.
❑ Sinusoidal sequence
Note: x (n) = x (t ) t = nT s
16
Digital Signal Processing / 4th Class/ 2024-2025
Example: Assuming a DSP system with a sampling time interval of 125 microseconds, convert
each of the following analog signals x(t) to the digital signal x(n).
1. 10 e − 5000 t u(t )
2. 10 sin(2000 t )u(t )
sol.
Periodic Sequences:
A sequence x(n) is defined to be periodic with period N if
17
Digital Signal Processing / 4th Class/ 2024-2025
Operations on Sequences:
❑ For input signal x(n) and output signal y(n)
(i) Scaling: y(n)=α x(n)
• α is called gain or scale factor.
• If |α|˃1, called an amplification.
• If |α|<1, called an attenuating.
• If α <0, called inverting.
• Sometimes denoted by triangle or circle in block diagram:
❑ For multiple input signals x1(n) , x2(n) and output signal y(n)
(i) Addition (summing):
y(n)=x1+x2=x1(n)+x2(n)
18
Digital Signal Processing / 4th Class/ 2024-2025
Example: Represent the sequence x[n] = {4, 2, -1, 1, 3, 2, 1, 5} as sum of shifted unit impulse.
sol.
Given x[n] = {4, 2, -1, 1, 3, 2, 1, 5}; n = -3 -2 -1 0 1 2 3 4
x[n] = x[-3]δ[n+3] + x[-2] δ[n+2] + x[-1] δ[n+1] +x[0] δ[n] + x[1] δ[n-1] + x[2] δ[n-2] + x[3]
δ[n-3] + x[4] δ[n-4]
= 4 δ[n+3] +2 δ[n+2] - δ[n-1] + δ[n] +3 δ[n-1] + 2 δ[n-2] + δ[n-3] +5 δ[n-4]
Example: Consider the following two sequences of length (5) defined for 0≤ n ≤4:
x[n] = {3.5, 41, 36, -9.5, 0}
y[n] = {1.7, -0.5, 0, 0.8, 1}
Find:
a) x[n].y[n]
b) x[n]+y[n]
c) 7/2 x[n]
sol.
a) x[n].y[n]= {5.44, -20.5, 0, -7.6, 0}
b) x[n]+y[n]= {4.9, 40.5, 36, -8.7, 1}
c) 7/2 x[n]= {11.2, 143.5, 126, -33.25, 0}
19
Digital Signal Processing / 4th Class/ 2024-2025
1 n=
2
P= x (n)
N n = −
• A signal is called energy signal if E < ∞.
• A signal is called power signal if 0 < P < ∞.
• A signal can be an energy signal, a power signal or neither type.
• An energy signal has zero power. E < ∞; P = 0
• A power signal has infinite energy. P < ∞; E = ∞
Interconnections of Systems:
1. Series or cascade interconnection. The output of System 1 is the input to System 2.
20
Digital Signal Processing / 4th Class/ 2024-2025
4. Feedback interconnection. The output of System 2 is fed back and added to the external
input to produce the actual input to System 1.
21
Digital Signal Processing / 4th Class/ 2024-2025
x2 T[.] y2 a y1+by2 =? y
22
Digital Signal Processing / 4th Class/ 2024-2025
23
Digital Signal Processing / 4th Class/ 2024-2025
b. Let the input and output be x1(n) and y1(n), respectively; then the system output is y1(n)
=2x1(3n). Again, let the input and output be x2(n) and y2(n), where x2(n) = x1(n − n0), a shifted
version, and the corresponding output is y2(n). We get the output due to the shifted input x2(n)
= x1(n − n0) and note that x2(3n) = x1(3n − n0):
y2(n) = 2x2(3n) = 2x1(3n − n0):
On the other hand, if we shift y1(n) by n0 samples, which replaces n in
y1(n) = 2x1(3n) by n − n0, it yield
y1(n − n0) = 2x1(3(n − n0)) = 2x1(3n − 3n0):
Clearly, we know that y2(n) ≠ y1(n − n0). Since the system output y2(n) using the input shifted
by n0 samples is not equal to the system output y1(n) shifted by the same n0 samples, thus, the
system is not time-invariant (time-varying system).
c. Let the input and output be x1(n) and y1(n), respectively; then the output is y1(n) =nx1(n).
Again, let the input and output be x2(n) and y2(n), where x2(n) = x1(n − n0), a shifted version,
and the corresponding output is y2(n). We get the output due to the shifted input x2(n) = x1(n −
n0) and note that x2(n) = n x1(n − n0):
y2(n) = n x2(n) = n x1(n − n0):
On the other hand, if we shift y1(n) by n0 samples, which replaces n in
y1(n) = n x1(n) by n − n0, it yield
y1(n − n0) = (n-n0) x1(n − n0):
Clearly, we know that y2(n) ≠ y1(n − n0). Since the system output y2(n) using the input shifted
by n0 samples is not equal to the system output y1(n) shifted by the same n0 samples, thus, the
system is not time-invariant (time-varying system).
Note: Linear Time Invariant System (LTI) is the system that satisfies both the linearity and the
time-invariance properties. Such systems are mathematically easy to analyze, and easy to
design.
24
Digital Signal Processing / 4th Class/ 2024-2025
b. Since for n ≥ 0, the output y(n) depends on the input’s future value x(n+1), the system is
noncausal.
c. Since for n ≥ 0, the output y(n) depends on the input’s future values x(n+1) and x(n+2), the
system is noncausal.
Stable and Unstable Systems:
A system is said to be bounded input-bounded output (BIBO) stable if and only if
every bounded input produces the bounded output. It means, that there exist some finite numbers
say Mx and My, such that
For all n, If for some bounded input sequence x(n), the output y(n)is unbounded (infinite), the
system is classified as unstable.
Note: The system is stable, if its transfer function vanishes after a sufficiently long time. For a stable
system:
25
Digital Signal Processing / 4th Class/ 2024-2025
a. If |x[n]| ≤ Bx < ∞ for all n, then |y[n]| ≤ By= B x2 < ∞ for all n. Thus, the system is stable.
0 n 0
b. If x[n] = u[n] = : bounded
1 n 0
n n 0 n0
Then y[n] = x[k ] = u[k ] = n + 1 n0
: not bounded
k = − k = −
Thus, the accumulator system is unstable.
n 0 n0
Note: u[k ] = n + 1 n0
k = −
Note: The unit step function u[n] is the running sum of the unit impulse δ[n], so the step response
S[n] of a LTI processor is the running sum of its impulse response. Therefore, if we denote the step
response by S[n], we have
n
S[n] = y[n] x[n]= u[n] = h[m]
m=−
26
Digital Signal Processing / 4th Class/ 2024-2025
1 N 1− x ( N +1)
Note: ( x) n =
1− x
and ( x) n =
1− x
n= 0 n= 0
27
Digital Signal Processing / 4th Class/ 2024-2025
response h(n) has a finite number of terms. We call this a finite impulse response (FIR) system.
In general, we can express the output sequence of a LTI system from its impulse response and
inputs as:
y(n) = . . .. + h(−1) x(n+ 1) + h(0) x(n) + h(1) x(n−1) + h(2) x(n−2) + . . . ..
This equation called the digital convolution sum.
Example: Given the difference equation
y(n)= 0.25 y(n − 1) + x(n) for n ≥ 0 and y(−1) = 0,
a. Determine the unit-impulse response h(n).
b. Draw the system block diagram.
c. For a step input x(n) = u(n), find the output responses for the first three samples using the
difference equation.
sol.
a. Let x(n) = δ(n), then h(n) = 0.25 h(n − 1) + δ(n)
To solve for h(n), we evaluate
h(0) = 0.25 h(−1) + δ(0) = 0.25 ( 0 ) + 1 = 1
h(1) = 0.25 h(0) + δ(1) = 0.25 ( 1 ) + 0 = 0.25
h(2) = 0.25 h(1) + δ(2) = 0.25 ( 0.5 ) + 0 = 0.0625
…
With the calculated results, we can predict the impulse response as:
n
h(n) =( 0.25) u(n) = δ(n) + 0.25 δ (n − 1) + 0.0625 δ (n − 2) + . . .
c. From the difference equation and using the zero-initial condition, we have
28
Digital Signal Processing / 4th Class/ 2024-2025
Notice that this impulse response h(n) contains an infinite number of terms in its duration due to
the past output term y(n − 1). Such a system as described in the preceding example is called an
infinite impulse response (IIR) system.
29
Digital Signal Processing / 4th Class/ 2024-2025
Digital Convolution
The Convolution Sum or Superposition Sum Representation of LTI Systems:
The convolution allows us to find the output signal from any LTI processor in
response to any input signal. We can find the output signal y(n) from an LTI processor by
convolving its input signal x(n) with a second function representing the impulse response h(n)
of the processor. The convolution sum or superposition sum of the sequences x(n) and h(n)
can be represented by
The digital convolution can be performed by Direct method , graphical, table lookup,
matrix by vector methods.
Graphical Method:
The convolution sum of two sequences can be found by using the following steps:
Step 1. Obtain the reversed sequence h( - k).
Step 2. Shift h( - k) by n samples to get h(n - k). If n≥0, h( - k) will be shifted to the right by n
samples; but if n < 0, h( - k) will be shifted to the left by n samples.
Step 3. Perform the convolution sum that is the sum of the products of two sequences x(k) and
h(n - k) to get y(n).
Step 4. Repeat steps 1 to 3 for the next convolution value y(n).
Example: Find the convolution of the two sequences x[n] and h[n] given by x[n] = [3, 1, 2] and
h[n] = [3, 2, 1]. The bold number shows where n=0. Using:
a. Direct method.
b. Graphical method
c. Table Lookup Method
30
Digital Signal Processing / 4th Class/ 2024-2025
Sol: a. Using y[n] = x[k ]h[n − k ]
k = −
x[n] = [3, 1, 2] and h[n] = [3, 2, 1] nx=[0 , 1 ,2] , nh=[0 , 1 , 2] ,
then ny=[0+0 … 2+2]=[0 … 4]=[0 1 2 3 4]
Total number of samples N=N1+N2-1=3+3-1=5 samples.
The values of k are equal to nx ,k =0,1,2
b. Graphical method
31
Digital Signal Processing / 4th Class/ 2024-2025
Example : Find the h*x of the two sequences x[n] and h[n] given by x[n] = [1 1 2 1 2 2 1 1] and
h[n] = [1 2 -1 1] by using matrix be vector .
Solution:
nx=[-2 -1 0 1 2 3 4 5] , nh=[-1 0 1 2] → ny=[-2+(-1) . . . 5+2]=[-3 -2 -1 0 1 2 3 4 5 6 7]
Nx=8 , Nh=4 , N=8+4-1=11
Dimension of matrix become N× Nx =11×8
Circular Convolution
The circular convolution can be performed by Direct method , Concentric Circle , graphical
methods.
Note: N =maximum( N1 , N2 )
Example: Use Direct, Concentric Circle and graphical methods to find circular convolution of
x (n)=[1 2 2] and x (n)=[0 1 2 3].
1 2
32
Digital Signal Processing / 4th Class/ 2024-2025
x1(k) x2(-k) 3
1
0 2
1 2 1
0 1
x1(k) x1(k)
0 x2(-k) 3 2 0 2 x2(1- 0 2
1
k)
2 3
2 2
y(0)=1x0+2x3+2x2+0x1=10 y(1)=1x1+2x0+2x3+0x2=7
1 1
2 3
x1(k) x1(k)
0 3 x2(2- 1 2 0 0 x2(3- 2 2
k) k)
0 1
2 2
y(2)=1x2+2x1+2x0+0x3=7 y(3)=1x3+2x2+2x1+0x0=9
33
Digital Signal Processing / 4th Class/ 2024-2025
3- graphical method
y=[10 7 7 9]
Deconvolution:
The digital Deconvolution can be performed by Iterative Approach, Polynomial
Approach, and Graphical Method. In the following subsection, the polynomial approach will be
explained.
Polynomial Approach:
A long division process is applied between two polynomials. For causal system, the remainder is
always zero.
Example: If y(n) = [15 -8 -5 2] and h(n) = [-3 1] find x(n) .
2 3
Solution: y = 15 - 8 x - 5 x + 2 x , and h = -3 + x. Applying long division, we obtain
2
result = -5+ x + 2 x . Then x(n) = [-5 1 2]
35
Digital Signal Processing / 4th Class/ 2024-2025
Note: the output to a sinusoid is another sinusoid of the same frequency but with different phase
and magnitude.
Example (1): A discrete time system has a unit sample response h(n)
h(n) = 0.5 δ(n) + δ(n − 1) + 0.5 δ(n − 2)
a) Find the system frequency response. Plot magnitude and phase.
b) Find the steady-state response of the system to x(n) = 5 cos ( π n /4).
c) Find the steady-state response of the system to x(n) = 5 cos ( 3 π n /4).
d) Find the total response to x(n) = u(n) assuming the system is initially at rest.
Solution:
│H(ejW)│ Φ(ejW)
2 π
-π π 2π W
0 π 2π W
Note: (t − to ) f (t) = f (t − to )
36
Digital Signal Processing / 4th Class/ 2024-2025
Example 2 :
37
Digital Signal Processing / 4th Class/ 2024-2025
Example 3:
38
Digital Signal Processing / 4th Class/ 2024-2025
Example 4: Find and plot the frequency response of a rectangular window filter if :
h(n) = 1 0≤n≤N–1 h(n)
0 elsewhere 1
…...
0 1 2 N-1 n
Solution:
N −1
1 − e− jWN
H(e jW
) = h(k) e − jWk
= e − jWk
=
k = − k=0 1 − e− jW
n
1 − an+1
By using ak =
k =0 1−a
, a1
sin(WN / 2)
Φ(e jW ) = − W ( N− 1) /2 + arg { }
sin(W / 2)
2π/5 4π/5
2π/5 4π/5
39
Digital Signal Processing / 4th Class/ 2024-2025
sin(wN / 2)
( w ) = − w( N − 1) / 2 + Arg
sin(w / 2 )
sin(wN / 2 )
0 , 2 , ... if 0
sin(w / 2 )
sin(wN / 2) sin(wN / 2 )
Arg = , 3 , ... if 0
sin(w / 2) sin(w / 2 )
sin(wN / 2 )
sin(w / 2 )
0 sin(wN / 2) 0 0 wN / 2 , 2 wN / 2 3 , …
0 w 2 / N , 4 / N w 6 / N , …
sin(wN / 2 )
sin(w / 2 )
0 sin(wN / 2) 0 wN / 2 2 , 3 wN / 2 4 ,…
2 / N w 4 / N , 6 / N w 8 / N , …
( w ) = − w ( N − 1) / 2 + 0 at 0 w 2 / N
= − w ( N − 1) / 2 + at 2 / N w 4 / N
= − w ( N − 1) / 2 + 2 at 4 / N w 6 / N
= − w ( N − 1) / 2 + 3 at 6 / N w 8 / N
( w ) = −2w at 0 w 2 / 5
= −2w + at 2 / 5 w 4 / 5
= −2w + 2 at 4 / 5 w 6 / 5
= −2w + 3 at 6 / 5 w 8 / 5
40
Digital Signal Processing / 4th Class/ 2024-2025
41
Digital Signal Processing / 4th Class/ 2024-2025
Z-Transform
5.1 Definition of Z.T
The z-transform is a very important tool in describing and analyzing digital systems. It
also offers the techniques for digital filter design and frequency analysis of digital signals. The z-
transform of a causal sequence x(n), designated by X(z) or Z(x(n)), is defined as:
Where, z is the complex variable. Here, the summation taken from n = 0 to n = ∞ is according to the
fact that for most situations, the digital signal x(n) is the causal sequence, that is, x(n) = 0 for n ≤ 0.
For non-causal system, the summation starts at n = -∞. Thus, the definition in Equation (5.1) is
referred to as a one-sided z-transform or a unilateral transform. The region of convergence is
defined based on the particular sequence x(n) being applied. The z-transforms for common
sequences are summarized below:
42
Digital Signal Processing / 4th Class/ 2024-2025
Solution:
5.2.2 Shift theorem (Delay) (without initial conditions): Given X(z), the z-transform of a
sequence x(n), the z-transform of x(n - m), the time-shifted sequence, is given by;
5.2.3 Convolution: Given two sequences x1(n) and x2(n), their convolution can be determined as
follows:
43
Digital Signal Processing / 4th Class/ 2024-2025
Solution:
44
Digital Signal Processing / 4th Class/ 2024-2025
Example (3): Find the inverse transform of X(z) using partial fraction method.
Solution:
Dividing both sides by z leads to
Therefore,
45
Digital Signal Processing / 4th Class/ 2024-2025
Example (4): Find the inverse z-transform sequence of the following signal using power series
expansion (Long Division) method.
Solution:
Represent the z-transform function X(z) in terms of z−1 by dividing z2 for both numerator and
denominator.
The long division procedure used in the example above can be carried out to any desired number of
steps.
The disadvantage of this technique is that it does not give a closed form representation of the
resulting sequence. In many applications, we need to obtain a closed-form result to infer general
qualitative insights into the sequence x(n). For most engineering investigation, the method of partial
fraction expansion and a good z-transform table is often sufficient to generate the desired closed form
solution.
46
Digital Signal Processing / 4th Class/ 2024-2025
Example (5): Solve y(n) – (3/2) y(n – 1) + (1/2) y(n – 2) = (1/4)n, y(-1) = 4, y(-2) = 10 for n ≥ 0
Solution:
47
Digital Signal Processing / 4th Class/ 2024-2025
Example (6): DSP system is described by the difference equation y(n)=0.2y(n-1)+x(n), find the
impulse response h(n).
Solution:
Take the Z transform of the both sides
Example (7): A relaxed (zero initial conditions) DSP system is described by the difference equation
a. Determine system response due to the impulse input sequence (i.e. determine the impulse response
h(n)).
b. Determine the system response due to the unit step input sequence (i.e. determine the step response
S(n)).
Solution:
a. Applying the z-transform on both sides of the difference equation, we yield
48
Digital Signal Processing / 4th Class/ 2024-2025
49
Digital Signal Processing / 4th Class/ 2024-2025
The algorithm transforming the time domain signal samples to the frequency domain
components is known as the discrete Fourier transform, or DFT. The DFT also establishes a
relationship between the time domain representation and the frequency domain representation.
Therefore, we can apply the DFT to perform frequency analysis of a time domain sequence. In
addition, the DFT is widely used in many other areas, including spectral analysis, acoustics,
imaging/ video, audio, instrumentation, and communications systems.
Where, k is the number of harmonics corresponding to the harmonic frequency of kf0 and
W0=2π/T0 and f0=1/T0 are the fundamental frequency in radians per second and the fundamental
frequency in Hz, respectively. To apply Equation (6.1), we substitute T0=NT, W0=2π/T0 and
approximate the integration over one period using a summation by substituting dt=T and t=nT. We
obtain:
Since the coefficients ck are obtained from the Fourier series expansion in the complex
form, the resultant spectrum ck will have two sides. Therefore, the two-sided line amplitude
spectrum │ck│ is periodic, as shown in Fig. 6.2.
50
Digital Signal Processing / 4th Class/ 2024-2025
Example (1): The periodic signal x(t) = sin (2πt) is sampled using the rate fs = 4 Hz.
a. Compute the spectrum ck using the samples in one period.
b. Plot the two-sided amplitude spectrum │ck│ over the range from −2 to 2 Hz
Solution:
a. Choosing one period, N = 4, we have x(0) = 0; x(1) = 1; x(2) = 0; and x(3) = −1. Using Eq. (6.2),
Similarly, c2= 0 and c3 = j0.5. Using periodicity, it follows that c-1 = c1= - j0.5, and c-2 = c2 =0.
51
Digital Signal Processing / 4th Class/ 2024-2025
2𝜋𝑘𝑛
−𝑗
𝑋(𝑘) = ∑𝑁−1
𝑘=0 𝑥(𝑛) 𝑒 𝑁 k=0,1,… , N-1
Example (2): Given a sequence x(n) for 0≤ n ≤ 3, where x(0) = 1, x(1) = 2, x(2) = 3, and x(3) = 4.
Evaluate its DFT X(k).
Solution:
−jπ/2
Since N=4, W4=e , then using:
𝜋𝑘𝑛
𝑋(𝑘) = ∑3𝑘=0 𝑥(𝑛) 𝑒 −𝑗 2 k=0,1,… , 3
52
Digital Signal Processing / 4th Class/ 2024-2025
Example (3): Find the inverse DFT for X(k) in Example 2 to determine the time domain sequence
x(n).
53
Digital Signal Processing / 4th Class/ 2024-2025
We can define the frequency resolution as the frequency step between two consecutive DFT
coefficients to measure how fine the frequency domain presentation is and achieve.
54
Digital Signal Processing / 4th Class/ 2024-2025
Solution:
The formulas for the DFT and IDFT may be expressed as:
55
Digital Signal Processing / 4th Class/ 2024-2025
=1 = -j = -1 =j
=1 = 0.707-0.707j = -j = -0.707-0.707j = -1
= -0.707+0.707j =j = 0.707+0.707j
56
Digital Signal Processing / 4th Class/ 2024-2025
Example (5): Compute the DFT of the four-point sequence using linear transformation .
H.W : Compute the IDFT of the previous example using linear transformation
57
Fast Fourier Transform (FFT)
Algorithms
58
For each value of k, the direct computation of X(k)
requires
4N real multiplications and (4N-2) real additions.
N complex multiplications and (N-1) complex
additions.
Total 4N2 real multiplications and N(4N-2) real
additions.
Total N2 complex multiplications and N(N-1) real
additions.
The amount of time required for computation
becomes large.
WNkn WNk ( n N)
WN( k N )n
WNkn N /2
WNkn
59
Fast Fourier Transform (FFT)
algorithms
Let N=2v; then divide x(n) into two N/2-point sequence.
60
Example 1: Calculate the percentage saving in calculations
of N = 1024 point FFT when compared to direct DFT?
Solution :
Decimation-In-Time FFT
(DITFFT)
.
61
The first iteration
62
Flow graph of 8-point decimation-in-
time FFT algorithm using the butterfly
computation
63
Example2: Given a sequence x(n) =[1 2 3 4] ,find
the FFT for the sequence using DITFFT?
Solution
64
Substituting the values of twiddle factor and computing the out of each stage. For
first stage value of twiddle factor is 1
Substituting the values of twiddle factor in second stage and computing the
out of second stage
65
Substituting the values of twiddle factor and computing the out of third stage.
Decimation-In-Frequency FFT
(DIFFFT)
We can get the decimation-frequency FFT
(DIFFFT) algorithm.
66
Flow graph of 8-point decimation-in-
frequency FFT algorithm using the butterfly
computation
67
Example 4: Find DFT of a sequence x(n)={1,2,3,4,4,3,2,1}using DIFFFT
algorithm
68
Inverse Fourier Transform
The inverse discrete Fourier can be calculated using the same method
but after changing the variable WN and multiplying the result by 1/N
Example 6: Given a sequence X(k)=[10 -2 -2+2j ]. Find the IFFT using
decimation in time method
Solution
8 4 1/4
X(0) =10 x(0) = 1
~
X(2) =-2
W40 1 12 8 1/4
x(1) = 3
-1 ~
x(n)=[1 3 2 4]
x(n)=[1 1 -1 -1 -1 1 1 -1]
69
Example 8: Given a sequence X(k)=[10 -2 -2+2j ]. Find the IFFT using
decimation in frequency method
Solution
x(n)=[1 2 3 4]
70
71
Digital Signal Processing/ 4th Class/ 2024-2025
-
Figure.1 A typical required frequency response for a low-pass filter design
A typical frequency response is shown in Fig. 1 showing the passband, transition band, and stopband.
The filter with this type of frequency response is called a low-pass filter as it
- Passes all frequencies less than a certain value Ωc, called the cutoff frequency.
- Attenuates or stops all frequencies past Ωr, the stopband critical frequency.
Other important basic types of filters are the high-pass (HP), bandpass (BP), and bandstop (BS) filters.
whose frequency responses are shown in Fig.2
Also shown are the frequency responses for the ideal LP, HP, BP, and BS filters which exhibit
no transition bands. It is known that the low-pass, high-pass, bandpass, and bandstop filters can be
obtained from a normalized low-pass filter via specific transformations in the S-plane. Therefore, prime
consideration will be given to low-pass filter design.
72
Digital Signal Processing/ 4th Class/ 2024-2025
In Fig. 3 the magnitude squared frequency response of the Butterworth filter is shown for several
different values of n.
73
Digital Signal Processing/ 4th Class/ 2024-2025
- The normalized low-pass Butterworth filter will be considered, which is, the case for Ωc = 1
rad/sec.
- The transfer function for any other Butterworth low-pass, high-pass, bandpass or bandstop filter
can be obtained by applying a transformation to the normalized low-pass filter specified by Hn(s).
- Starting with the magnitude squared frequency response we would like to find the system
function H(s) that gives the Butterworth magnitude squared response. For an analog system we
remember that the frequency response is obtained by letting s= jΩ in the transfer function H(s)
for the given system. Therefore, if Ω is replaced by s/j, the system function is determined. Setting
Ωc = 1 in Eq. (1) gives|Hn (jΩ)|2 for the normalized filter as follows:
1
|Hn (s)|2 = 𝐬 (2)
𝟏+( )𝟐𝐧
𝐣
The poles of |Hn (s)|2 are given by the roots of the denominator, i.e.,
𝐬 𝐬
𝟏 + ( 𝐣 )𝟐𝐧 = 𝟎 → ( 𝐣 )𝟐𝐧 = −𝟏 → 𝐬𝟐𝐧 = −𝟏(𝐣)𝟐𝐧 = −𝟏(𝐣𝟐 )𝐧 = −𝟏(−𝟏)𝐧 = (−𝟏)𝐧+𝟏 (3)
The roots of the above equation can be identified for the cases when n is odd and even. For n
odd, the poles of |Hn (s)|2 become the 2nth roots of 1, while for n even, the poles are the 2nth roots of -
1. That is,
kπ
For n odd : sk = 1∠ n
k=0,1,2,…,2n-1
kπ π
For n even : sk = 1∠ n
+ 2n k=0,1,2,…,2n-1
If we wish the filter Hn(s) to be a stable and causal filter, the poles of Hn(s) are selected to be
those in the left half plane and Hn(s) can be written in the following form:
1 1
Hn (s) = ∏ = (4)
LHP poles(s−sk ) Bn (s)
where sk are all the left half plane poles of |Hn (s)|2. The denominator, Bn(s), can be shown to be
a Butterworth polynomial of order n. Table 1 gives the first five Butterworth polynomials in a real
factored form.
74
Digital Signal Processing/ 4th Class/ 2024-2025
Example 1:Find the transfer function H1(s) for the normalized Butterworth filter of order 1.
Solution: Since n = 1 we have that the poles of H1(s)H1(-s)are given by
s1 = 1∠0 and s2 = 1∠π
Taking the left half plane pole s2, H1(s) can be written as
1 1
H1 (s) = 𝐬−(−𝟏) = 𝐬+𝟏
Example 2: Find the transfer function H2(s) for the normalized Butterworth filter of order 2.
kπ π
Solution: sk = 1∠ 2
+4 k=0,1,2,3
These poles are shown in Fig. 4, and using the left-half plane poles we can express the transfer function
as follows
Analog-to-Analog Transformations
Table 2 gives the transformations along with design equations for both forward and backward
development.
- If the transformation s → s/Ωu is applied to the low-pass structure as shown at the top of Table
2, the critical frequency Ωr will be transformed (forward) into Ωr`, which is Ωr time Ωu as seen
under the design equation column.
- The backward equation gives the value of Ωr that must be used such that going through the
transformation s → s/Ωu results in the required Ωr`. We have Ωr, equals Ωr`/ Ωu .
- Procedures will now be given for the design of non-normalized low-pass and bandpass filters,
and Table 2 provides both forward and backward design formulas for high-pass and bandstop
filter designs if desired
75
Digital Signal Processing/ 4th Class/ 2024-2025
A=(-w1^2+wl*wu)/(w1*(wu-wl))
B=(w2^2-wl*wu)/(w12wu-wl))
76
Digital Signal Processing/ 4th Class/ 2024-2025
1
10 log [ Ω ] = k2 (8)
1+( 2 )2n
Ωc
Dividing both sides of the above equations by 10 ,taking the antilog and simplifying yields
−k1
Ω
(Ω1)2n = 10 10 − 1 (9)
c
−k2
Ω
(Ω2)2n = 10 10 − 1 (10)
c
Dividing to cancel Ωc we have the following implicit equation relating Ω1 ,Ω2,Kl,K2, and n:
−k1
Ω 10 10 −1
(Ω1)2n = −k2 (11)
2
10 10 −1
A simple closed form answer for n is easily obtained from this expression and use the next larger
integer
−k1
10 10 −1
log10 −k
2
⌈ 10 10 −1 ⌉
n=⌈ 1 ⌉ (12)
2log10
⌈ Ωr
⌉
⌈ ⌉
Using this value for n results in two different selections for Ωc as seen from Eq. (9&10). If we wish to
satisfy our requirement at Ω1 exactly and do better than our requirement at Ω2 we use
Ω1
Ωc = −k1 1 (13)
(10 10 −1)2n
while if we wish to satisfy our requirement at Ω2 and exceed our requirement at Ω1 we use
Ω2
Ωc = −k2 1 (14)
(10 10 −1)2n
77
Digital Signal Processing/ 4th Class/ 2024-2025
Example.3: Design an analog Butterworth filter that has a -2 dB or better cutoff frequency of 20
rad/sec and at least 10 dB of attenuation at 30 rad/sec.
Solution: The critical requirements are
Ω1 = 20, K1=-2, Ω2 = 30, k2=-10
Substituting these requirements into Eq. (12) gives
𝟑𝟎
1- 𝛀𝐫 = 𝟐𝟎.
−(−2)
10 10 −1
log10 −(−10) 100.2 −1
⌈ 10 10 −1 ⌉ log10 1
10 −1 log10 0.065 −1.1872
2- 𝐧 = ⌈
2log10 30
1 ⌉ = ⌈ 2log10 2 ⌉ = ⌈ 2log10 2 ⌉ = ⌈ −0.3522⌉ = ⌈3.3708⌉ = 4
⌈ ( )
20 ⌉ 3 3
⌈ ⌉
3- The normalized low-pass Butterworth filter (Ωc = 1) for n =4, can be found from Table 1 as
1
H4 (s) = (s2 +0.76536s+1)(s2+1.84776s+1) .
20
4- Using this value of n in Eq. (13) to exactly satisfy the - 2 dB requirement gives Ωc = 1 =
(100.2 −1)8
0.20921×106
H4 (s) = (s2 +16.3686s+457.394)(s2+39.517s+457.394)
78
Digital Signal Processing/ 4th Class/ 2024-2025
k1 ≤ 20 log|H(jΩ)| ≤ 0 Ωl ≤ Ω ≤ Ωu (15)
20 log|H(jΩ)| ≤ k 2 Ω ≤ Ω1 , Ω ≥ Ω2 (16)
If Hlp(s) represents a unit bandwidth low-pass filter with critical radian frequency Ωr , then from Table
2 a bandpass filter with transfer function HBP(s) is given by :
HBP (s) = HLP (s)| s2 + Ω l Ω u (17)
s→
s(Ωu − Ωl )
Solving the above equation for Ωr and a similar equation to satisfy the k 2 requirement at Ω2 gives
Ω 2 − Ωl Ωu
Ωr = Ω 1(Ω (19)
1 u − Ωl )
Ω 2 − Ωl Ωu
Ωr = Ω 2(Ω (20)
2 u − Ωl )
The selection of Ωr becomes that given in the backward design equations for the low-pass to bandpass
transformation part of Table 2
Ωr = min{|A|, |B|} (21)
−Ω1 2 + Ωu Ωl
A= (22)
Ω1 (Ωu − Ωl )
Ω 2 − Ωu Ω l
B = Ω 2(Ω (23)
2 u − Ωl )
79
Digital Signal Processing/ 4th Class/ 2024-2025
Solution: The monotonic requirement can be satisfied with a Butterworth filter. From the specifications
above we can identify the following critical frequencies:
Ω1 = 2π(20) = 125.663 rad/sec
Ω2 = 2π(45). 103 = 2.82743 × 105 rad/sec
Ωu = 2π(20). 103 = 1.25663 × 105 rad/sec
Ωl = 2π(50) = 314.159 rad/sec
−125.6632 +1.25663×105 ×314.159
A= = 2.5053
125.663(1.25663×105 − 314.159)
1- Ωr = min{|2.5053|, |2.2545|}=2.2545
2- The low-pass Butterworth filter of order n can then be calculated :
100.30102 −1
log10
102 −1
n=⌈ 1 ⌉ = ⌈2.829⌉ = 3
2log10
2.2545
3- From the Butterworth Table 2 and n=3 we have the low-pass prototype as
1
HLP =
s3 +2s2 +2s+1
Chebyshev Filters
The Chebyshev response is a mathematical strategy for achieving a faster rolloff by allowing
ripple in the frequency response. Analog and digital filters that use this approach are called Chebyshev
filters . As the ripple increases (bad), the roll-off becomes sharper (good). There are two types of
Chebyshev filters, one containing a ripple in the passband (type 1) and the other containing a ripple in
the stopband (type 2). A type 1 low-pass normalized (unit bandswith) Chebyshev filter with a ripple in
the pass- band is characterized by the following magnitude squared frequency response:
1
|Hn (jΩ)|2 = (24)
1+ϵ2 T2 (Ω) n
80
Digital Signal Processing/ 4th Class/ 2024-2025
where Tn (Ω) is the nth order Chebyshev polynomial. The Chebyshev polynomials can be generated and
thus defined from the following recursive formula:
with T0(x) = 1 and T1(x) = x. A list of the first ten Chebyshev polynomials is given in Table 3 for
reference. It can easily be seen from the list of Chebyshev polynomials that
- Tn (x) at x = 0 is 1 when n is even and zero when n is odd, resulting :
- |Hn (jΩ)|2 to be 1/(1 + ϵ2 ) at Ω = 0 for n even and 1 at Ω = 0 for n odd.
The two general shapes of magnitude squared frequency response of the type 1 Chebyshev filter for n
odd and even are given in Fig. 7.
Figure. 7 Magnitude squared frequency responses for the normalized type 1 Chebyshev filter of
odd and even n.
The following properties are easily observable from Fig.7
(1) The magnitude squared frequency response oscillates between 1 and 1/(1 + ϵ2 ) within the passband,
the so-called equiripple, and has a value of 1/(1 + ϵ2 ) at Ω = 1, the so-called cutoff frequency.
(2) The magnitude squared frequency response |Hn (jΩ)|2 is monotonic outside the passband, including
both transition band and the stopband. The stopband begins at Ωr with magnitude squared frequency
response at value 1/A2.
81
Digital Signal Processing/ 4th Class/ 2024-2025
Selection of n
For low-pass filter design we are usually interested not only in the cutoff frequency but in the
stopband attenuation. Usual specifications might be that the magnitude squared frequency response is
less than a certain value 1/A2 at a frequency in the stopband as seen in Fig. 7. It has been shown that the
n that satisfies a specified ripple characterized by ϵ and a stopband gain of 1/A at a particular Ωr is given
by
log10(g+√g2 −1)
n=⌈ ⌉ (26)
log10(Ωr +√Ωr 2 −1)
1
A = |H (27)
n (jΩr )|
A2 −1
g=√ (28)
∈2
Example 5 : Design a low-pass 1 rad/sec bandwidth Chebyshev filter with the following characteristics:
(a) Acceptable passband ripple of 2 dB.
(b) Cutoff radian frequency of 1 rad/sec.
82
Digital Signal Processing/ 4th Class/ 2024-2025
table )
102 −1 log10(13.01 +√13.01 2 −1)
3- g = √0.764782 = 13.01 ,n = ⌈ ⌉=5
log10(1.3+√1.32 −1)
4- Using the 2-dB ripple part of Table 4 for n = 5, we have the desired Chebyshev unit bandwidth
low-pass filter as
k
H(s) = s5+b 4 3 2
4 s +b3 s +b2 s +b1 s+b0
n is odd
k = b0 = 0.08172
0.08172
H5 (s) = s5+0.70646s4+1.4995s3+0.6934s2+0.459349s+0.08172
0.08172
H5 (s) = (s+0.218303)(s2+0.134922s+0.95215)(s2+0.35323s+0.393119)
Therefore we need to design a normalized low-pass Chevyshev filter with 2-dB cutoff at 1 rad/sec and
a 20-dB attenuation at 1.3 rad/sec and then apply the transformation s → s/40. As it happens, just such
a low-pass filter was designed in Example 5. So, by using the H5(s) of Example 5, Hd(s) can be written
83
Digital Signal Processing/ 4th Class/ 2024-2025
8.366×106
= (s+8.73212)(s2 +5.3969s+1523.44)(s2+14.1292s+628.984)
Notes:
1. Chebshev Filter has a sharper cutoff; i.e., a narrower transition band ( best amplitude response) than
a Butterworth filter of the same order (n)
2. Chebshev Filter provides poorest phase response (most nonlinear). The Butterworth filter compromise
between amplitude and phase ( this is one of the reasons for its widespread popularity).
84
Digital Signal Processing/ 4th Class/ 2024-2025
85
Digital Signal Processing/ 4th Class/ 2024-2025
86
Digital Signal Processing/ 4th Class/ 2024-2025
87
Digital Signal Processing/ 4th Class/ 2024-2025
88
Digital Signal Processing / 4th Class/ 2024-2025
∑𝑀 𝑏 𝑒 −𝑗𝑤𝑘
𝐻(𝑒 𝑗𝑤 ) = ∑𝑁𝑘=0 𝑎𝑘𝑒 −𝑗𝑤𝑘 , 𝑧 = 𝑒 𝑗𝑤 (3)
𝑘=0 𝑘
89
Digital Signal Processing / 4th Class/ 2024-2025
Solution:
𝑌(𝑧) 0.2+0.4𝑧 −1
𝐻(𝑧) = 𝑋(𝑧) = ,b0=0.2 , b1=0.4 , a1=-0.5
1−0.5𝑧 −1
Using the inverse z-transform and shift theorem, we obtain the impulse response as
𝑌(𝑧) 0.2 0.4𝑧 −1 𝑧 1
𝐻(𝑧) = 𝑋(𝑧) = 1−0.5𝑧 −1 + 1−0.5𝑧 −1 = 0.2 𝑧−0.5 + 0.4 𝑧−0.5
1
Example : If 𝐻𝑎 (𝑠) = (𝑠+1)(𝑠+2) use the numerical solutions of differential equations to obtain
H(Z) for,
a) T = 1 sec., and b) FS = 100 Hz.
Solution:
1 1 1 1
a ) 𝐻(𝑧) = | −1 = = =
(𝑠+1)(𝑠+2) 𝑠→1−𝑧 (1−𝑧 −1 +1)(1−𝑧 −1 +2) (2−𝑧 −1 )(3−𝑧 −1 ) (6−5𝑧 −1 +𝑧 −2 )
𝑇
1 1 1
b) 𝐹𝑠 = 100 , 𝑇 = 100 = 0.01 , 𝐻(𝑧) = (𝑠+1)(𝑠+2) | 1−𝑧−1 = 1−𝑧−1 1−𝑧−1
𝑠→ ( +1)( +2)
𝑇 0.01 0.01
(6)
90
Digital Signal Processing / 4th Class/ 2024-2025
(7)
As (W/2) becomes smaller, we get more linear characteristics [ (W/2) << 1 ]. If the bilinear
transformation is applied to an Ha(S) with critical frequency Ωc, the digital filter will have critical
frequency Wc.
(8)
In bilinear transformation, the design of digital filter does not depend on the sampling rate (T =1,
prewarp case). For a low-pass filter, with S → S / Ωc .
Example 2: Design a digital low-pass filter using bilinear transformation method to satisfy the
following c/cs:
1. − 3.01 dB cutoff frequency of 0.5 π rad
2. Magnitude down at least 15 dB at 0.75 π rad.
Solution:
91
Digital Signal Processing / 4th Class/ 2024-2025
Step (2) :
Referring to provirus lecture, Table (1) to write the normalized Butterworth LPF equation, and then
using LP → LP transformation:
(9)
(10)
92
Digital Signal Processing / 4th Class/ 2024-2025
Example 3: Use Digital-to digital transformation method. Find H(z) for LP digital filter that
satisfies the following requirements:
1- A − 3.0102 dB cutoff digital frequency of 0.5 π rad.
2- Attenuation at and past 0.75 π rad is at least 15 dB
93
Digital Signal Processing / 4th Class/ 2024-2025
Solution:
Using Table (2) that gives HBn (Z) for normalized low-pass Butterworth digital filter
(13)
If an analog filter with system function Ha(s) is given, the corresponding impulse invariant design filter
has
(14)
Example 4:Find H(Z) corresponding to the impulse invariant design using sampling rate of (1/T)
samples / sec. for an analog filter Ha(s) specified as: Ha(s) = A / ( s + α )?
Solution:
In many cases the transfer function Ha(s) is given by a sum of N terms with unique αk as follows:
94
Digital Signal Processing / 4th Class/ 2024-2025
(15)
For this case the impulse invariant design H(z) is given by
(16)
The above result is easily shown by using the linearity of the Z transform
The logical question at this point is: How does the equivalent frequency response of the A/D-H(z)-
D/A structure using this H(z) compare to the frequency response of the original system specified by
Ha(s)? Using Example 4 for discussion purposes we have that the frequency response and the
magnitude of the frequency response of the given analog filter are as follows:
(17)
To obtain the equivalent frequency response of the A/D-H(z)-D/A structure one must first find the
frequency response of the discrete-time filter specified by H(z). This can be obtained by replacing
the z in H(z) by ejw to give
(18)
The analog frequency response of the equivalent analog filter is then determined by replacing w by
ΩT to give
(19)
95
Digital Signal Processing / 4th Class/ 2024-2025
Figure 2 Plots of Ha(jΩ) and Heq(jΩ) for impulse invariant design. Curve (a): a = 1, T=0.1,
curve (b):a= 1, T= 1.
The plots of |Heq(jΩ)| and | Ha(jΩ)| are shown in Fig. 2 for two different cases. It is seen in Figure 2
curve (a) that the magnitude of the two frequency responses |Heq(jΩ)| and | Ha(jΩ)| are very close,
while in Fig. 2 curve (b) that the magnitude plots are dramatically different. Therefore, good results
using the impulse invariant design are obtained provided the time between samples is selected small
enough.
5-Pole-Zero Placement Method for Simple Infinite Impulse Response Filters Design
This section introduces a pole-zero placement method for a simple IIR filter design. Let us first
examine effects of the pole-zero placement on the magnitude response in the z-plane shown in Fig .3.
(20)
Where, K is a scale factor to adjust the band-pass filter to have a unit pass-band gain
Example 5:A second-order bandpass filter is required to satisfy the following specifications:
1. Sampling rate = 8,000 Hz
2. A 3 dB bandwidth: BW = 200 Hz
3. Narrow passband centered at f0 = 1,000 Hz
4. Zero gain at 0 Hz and 4,000 Hz.
Find the transfer function using the pole-zero placement method ?
Solution:
(21)
Example 6: A second-order notch filter is required to satisfy the following specifications:
1. Sampling rate = 8,000 Hz
2. A 3 dB bandwidth: BW = 100 Hz
3. Narrow pass-band centered at f0 = 1,500 Hz:
Find the transfer function using the pole-zero placement approach.
Solution:
We first calculate the required magnitude of the poles
98
Digital Signal Processing / 4th Class/ 2024-2025
(a) (b)
Figure 4 Pole-zero placement for the first-order lowpass filter
Design formulas for lowpass filters using the pole-zero placement are given in the following equations:
, (22)
Example 7: A first-order lowpass filter is required to satisfy the following specifications:
1. Sampling rate = 8,000 Hz
2 A 3 dB cutoff frequency: fc = 100 Hz
3. Zero gain at 4,000 Hz.
Find the transfer function using the pole-zero placement method.
Solution: Since the cutoff frequency of 100 Hz is much less than fs / 4 = 2,000 Hz, we determine the
pole as:
99
Digital Signal Processing / 4th Class/ 2024-2025
which is above 0.9. Hence, we have a good approximation. The unit-gain scale factor is calculated by
Note that we can also determine the unit-gain factor K by substituting z=ej0=1 to the transfer function
H(z)=(z+1)/(z-α), then find a DC gain. Set the scale factor to be a reciprocal of the DC gain. This can
be easily done that is,
(a) (b)
Figure 5 Pole-zero placement for the first-order highpass filter
Formulas for designing highpass filters using the pole-zero placement are listed in the following equations:
, (23)
Example 8: A first-order highpass filter is required to satisfy the following specifications:
1. Sampling rate = 8,000 Hz
2. A 3 dB cutoff frequency: fc = 3800 Hz
3. Zero gain at 0 Hz.
Find the transfer function using the pole-zero placement method.
Solution:
Since the cutoff frequency of 3,800 Hz is much larger than f / 4 = 2,000 Hz, we determine the pole as:
s
100
Digital Signal Processing / 4th Class/ 2024-2025
,
Note that we can also determine the unit-gain scale factor K by substituting z=ej180 =-1 into the
transfer function H(z)=(z-1)/(z-α), finding a passband gain at the Nyquist limit fs/2=4,000 Hz. We
then set the scale factor to be a reciprocal of the passband gain. That is,
101
Digital Signal Processing / 4th Class/ 2024-2025
In many cases a linear phase c/cs is required throughout the pass-band of the filter to preserve the
shape of a given signal within the pass-band. Assume a LP filter with
(1)
y(n) = x (n – α )
The linear phase filter did not alter the shape of the original signal, simply translated it by an amount
α. If the phase response had not been linear, the output signal would have been a distorted version of
x(n).
In Fig.1 the responses of two different filters to the same input (a sum of two sinusoidal signals) is
presented. The filters have the same magnitude frequency responses but differ in their phases as one
has linear and the other a quadratic phase. For the filter with linear phase, the sinusoidal components
each go through a steady state phase change, but in such a way that the output signal is just a delayed
version of the input while the quadratic phase filter causes phase shifts in the two sinusoidal signals
resulting in an output that is a distorted version of the input signal.
It can be shown that a causal IIR filter cannot produce a linear phase characteristic and that only
special forms of causal FIR filters can give linear phase. This result is clarified in the following
theorem.
Theorem. If h(n) represents the impulse response of a discrete-time system, a necessary and sufficient
condition for linear phase is that h(n)
- It have finite duration N (for causal FIR filter, h(n) begins at zero and ends at N-1)
- It is symmetric about its midpoint.
h(n) = h( N-1-n) , n = 0, 1, …., N-1
102
Digital Signal Processing / 4th Class/ 2024-2025
103
Digital Signal Processing / 4th Class/ 2024-2025
Figure 2 General shapes of h(n) that give linear phase for odd and even N.
(2)
(3)
For N odd, the slope of (N–1) /2 causes a delay in the output of (N–1)/2 , which is an integer number
of samples, whereas for N even, the slope causes a non-integer delay. The non-integer delay will cause
the values of the sequence to be changed, which, in some cases, may be undesirable.
The easiest way to obtain an FIR filter is to simply truncate the impulse response of an IIR filter. If
hd(n) represents the impulse response of a desired IIR filter, then an FIR filter with impulse response
h(n) can be obtained as follows:
(4)
(5)
104
Digital Signal Processing / 4th Class/ 2024-2025
(6)
Rectangular window has a narrow main lobe and wide side lobes . The minimum stopband attenuation
is 21 dB.
2. Bartlett: The main-lobe width for the Bartlett window is 8π/N, which is twice of the
rectangular one. The maximum side lobe for the triangular window is 27 dB lower than the main lobe,
and the minimum stopband attenuation is 25 dB.
105
Digital Signal Processing / 4th Class/ 2024-2025
(7)
3. Hanning: It has a main-lobe width considerably larger than that of the Bartlett window, but
with much lower largest side-lobe peak, at about -32 dB. The side lobes also taper off much faster. It
has 8π/N between the two zeros surrounding the main lobe.
(8)
4. Hamming: Like the Hanning window, the Hamming window also belongs to a kind of the
raised cosine window, and thus exhibits similar characteristic to the Hanning window, but further
suppresses the first side lobe
(9)
For the Hamming window, 99.96% of the energy is in the main lobe. The maximum side lobe is 43 dB
lower than the main lobe, and the minimum stopband attenuation is 53 dB.
5. Blackman: The Blackman method is used to reduce variance of the estimator thus presents
improvement in stopband attenuation. As compared to other windows, the Blackman window
possesses good characteristics for audio processing,
(10)
The maximum side lobe for the Blackman window is 58 dB lower than the main lobe, which is three
times as that of rectangular window, and the minimum stopband attenuation is 74 dB.
106
Digital Signal Processing / 4th Class/ 2024-2025
107
Digital Signal Processing / 4th Class/ 2024-2025
An ideal LP filter with linear phase of slope −α and cutoff wc can be characterized in frequency
domain by:
(11)
The corresponding impulse response hd(n) can be obtained by taking the inverse Fourier transform of
Hd(ejw) and easily shown to be
(12)
A causal FIR filter with impulse response h(n) can be obtained by multiplying h d(n) by a window
beginning at the origin and ending at N - 1 as follows:
(13)
For h(n) to be a linear phase filter, a must be selected so that α = (N-1) / 2 , with N is odd.
Table (1) shows hd(n) for LPF, HPF, BPF, and BSF:
108
Digital Signal Processing / 4th Class/ 2024-2025
Notes:
- The stop-band gain for the LPF designed is relatively insensitive to the size of the window.
- The transition width of the designed LPF is approximately equal to the main lobe of the
window used.
Design procedure for an FIR filter
Requirements: k1, w1, k2, and w2 represents the cutoff and stop-band requirements for digital
filters.
1- From Table (2), select the window type such that the stop-band gain exceeds k2.
2- Select the number of points in the window to satisfy the transition width for the type of
window used
4- Find h(n) using the specified window type and Table (1).
Example 1: Design a LP digital filter to be used in A/D- H(Z) – D/A structure that will have a − 3 dB
cutoff of 30 π rad / sec. and an attenuation of 50 dB at 45 π rad/sec. The filter is required to have
linear phase. The system will use a sampling rate of 100 samples/sec.
Solution:
w1=Ω1T=30π/100=0.3π rad
w2=Ω2T=45π/100=0.45 π rad
1- To obtain a stopband attenuation of -50 dB or more, a Hamming, or Blackman window could
be used. The Hamming window is chosen since it has the smallest transition band thus giving
the smallest N.
2- The approximate number of points needed to satisfy the transition band requirement can be
found for w1 = 0.3 π and w2 = 0.45 π using the Hamming window ,
109
Digital Signal Processing / 4th Class/ 2024-2025
Example 2: An analog signal contains frequencies up to 10 KHz. The signal is sampled at 50 KHz.
Design an FIR filter having linear phase characteristic and transition band of 5 KHz. The filter should
provide minimum 50 dB attenuation at the end of transition band?
Solution:
f1=10 KHz , f2=(10+5)=15 KHz
w1=Ω1T=2πf1T=2π×10000/50000=0.4π rad
w2=Ω2T=2πf2T=2π×15000/50000=0.6 π rad
1- To obtain a stopband attenuation of -50 dB or more, a Hamming, or Blackman window could
be used. The Hamming window is chosen since it has the smallest transition band thus giving
the smallest N.
2- The approximate number of points needed to satisfy the transition band requirement can be
found for w1 = 0.4 π and w2 = 0.6 π using the Hamming window (k = 4) to be
N ≥ 8π /((0.6 − 0.4)π) = 40 →N= 41
Example 3: Design a LPF using Hanning window for the desired frequency response of a low pass
filter given by wc = 0.5π rad/sec, and take N=11. Find the values of h(n) at n=4 ,5?
Solution:
Since the type of window and N are given ,we start from step 3
3- wc =0.5π rad , and α = ( 11− 1 ) /2 = 5.
4- Using eq. (8) for wHan and the value of hd(n) from Table (1) to find h(n):
sin(0.5𝜋(𝑛−5)) 2𝜋𝑛
ℎ(𝑛) = [0.5(1 − cos( 10 )]
𝜋(𝑛−5)
at n=4
110
Digital Signal Processing / 4th Class/ 2024-2025
sin(0.5𝜋(𝑛−5)) 8𝜋
ℎ(4) = [0.5 (1 − cos ( 10 )] = 0.2879
𝜋(𝑛−5)
at n=5
0.5𝜋 10𝜋 𝑤𝑐
ℎ(5) = [0.5 (1 − cos ( 10 ))] = 𝜋[0.5(1 − (−1))] = 0.5 =
𝜋 𝜋
Example 4: Design a HP digital filter to be used in A/D- H(Z) – D/A structure that will have a − 3 dB
cutoff of 45 π rad / sec. and an attenuation of 50 dB at 30 π rad/sec. The filter is required to have
linear phase. The system will use a sampling rate of 100 samples/sec.
Solution:
w1=Ω1T=45π/100=0.45π rad
w2=Ω2T=30π/100=0.3 π rad
1-To obtain a stopband attenuation of -50 dB or more, a Hamming, or Blackman window could be
used. The Hamming window is chosen since it has the smallest transition band thus giving the
smallest N.
2- The approximate number of points needed to satisfy the transition band requirement can be
found for w2 = 0.3 π and w1 = 0.45 π using the Hamming window ,
N ≥ 8π / (0.45 − 0.3 ) π = 53.3 →N= 55
sin[0.45𝜋(𝑛−27)]
ℎ(𝑛) = − . {0.54 − 0.46cos(2𝜋𝑛/54}, 0 ≤ 𝑛 ≤ 54
𝜋(𝑛−27)
111
Digital Signal Processing/ 4th Class/ 2024-2025
(1)
Let x(n) and y(n) be the digital filter input and output, respectively. Taking z-transform:
Y(Z) = H(Z) X(Z) (2)
Where X(z) and Y(z) are the z-transforms of x(n) and y(n), respectively. If we substitute equation
(1) into H(z) in equation (2), we have
(3)
Taking the inverse of the z-transform of Equation (3), then:
y(n) = b0 x(n) + b1 x(n–1)+…+ bM x(n–M)
– a1 y(n–1) – a2 y(n–2) – … – aN y(n–N) (4)
This difference equation thus can be implemented by a direct-form I realization shown in Fig. (1.A).
Figure (1.B) illustrates the realization of the second-order IIR filter (M = N = 2).
112
Digital Signal Processing/ 4th Class/ 2024-2025
Note that the notation used in Figures (1.c) and (1.d) below;
2- Direct-Form II Realization
Considering Equations (1) and (2) with N = M, we can express
(5)
Also, defining a new z-transform function as
(6)
Realization of equation (6) becomes another direct-form II realization, which is demonstrated in
Fig. (2.A). Again, the corresponding realization of the second-order IIR filter is described in
Fig.(2.B).
113
Digital Signal Processing/ 4th Class/ 2024-2025
(8)
Respectively. The block diagram of the cascade, or series, realization is depicted in Fig.(3)
(10)
or
(11)
Respectively. The resulting parallel realization is illustrated in the block diagram in Fig.(4).
114
Digital Signal Processing/ 4th Class/ 2024-2025
Perform the filter realizations and write the difference equations using the following realizations:
1. Direct form I and direct form II.
2. Cascade form via the first-order sections.
3. Parallel form via the first-order sections.
Solution:
1. To perform the filter realizations using the direct form I and direct form II
Where, a1 = 1.3, a2 = 0.36, b0 = 0.5, b1 = 0, and b2 = − 0.5. Fig.(5 a) shows the direct-form I
realization .
The difference equation for the direct- form I realization is given by
y(n) = 0.5 x(n) – 0.5 x(n–2) – 1.3 y(n-1) –0.36 y(n–2)
The direct-form II realization shown in Fig.(5 b) where, the difference equations for the direct-form
II realization are expressed as:
w(n) = x(n) – 1.3 w(n–1) – 0.36 w(n–2)
y(n) = 0.5 w(n) – 0.5 w(n-2)
Using the H1(Z) and H2(Z), and with the direct-form II realization, we achieve the cascade form
115
Digital Signal Processing/ 4th Class/ 2024-2025
Notice that the obtained H1(Z) and H2(Z) are not unique selections for realization. For example,
there is another way of choosing them to yield the same H(Z).
3- In order to yield the parallel form of realization, we need to make use of the partial fraction
expansion,
Again, using the direct form II for each section, we obtain the parallel realization in Fig. (10.5d) The
difference equations for the direct-form II realization have three parallel sections, expressed as:
y1(n) = -1.39 x(n)
w2(n) = x(n) – 0.4 w2(n-1)
y2(n) = 2.1 w2(n)
w3(n) = x(n) – 0.9 w3(n-1)
y3(n) = -0.21 w3(n)
y(n) =y1(n) + y2(n) + y3(n)
The output is simply a weighted sum of present and past input values, as shown in Figure.
116
Digital Signal Processing/ 4th Class/ 2024-2025
Example (2): Given the FIR filter transfer function , Perform the FIR filter realization
Solution:
From the transfer function, we can identify that b0 = 1, b1 = 1.2, and b2 = 0.36, we find the FIR
realization to be as follows, we determine the DSP equation for implementation as
y(n) = x(n) +1.2x(n-1) + 0.36x(n-2):
117