Digital Signal Processing: Mustansiriyah University College of Engineering Electrical Engineering Department 4 Class

Download as pdf or txt
Download as pdf or txt
You are on page 1of 119

Mustansiriyah University

College of Engineering
Electrical Engineering Department
4th Class

Digital Signal Processing


(EE402)

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

Introduction to Digital Signal Processing


Signal (flow of information):
Signal is defined as any physical quantity that varies with Time, Space, or any other
independent variables. For Example:
• Measured quantity that varies with time (or position).
• Electrical signal received from a transducer (Microphone, Thermometer, Accelerometer,
Antenna, etc.)
• Electrical signal that controls a process.
Example:

A. Continuous-Time Signal or Analog Signal:


The analog signal is defined for every value of time and they take on values in the
continuous interval as shown in Fig. 1.

Fig. 1. Continuous or analog signal

• 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

• Continuous in amplitude but discrete in time.


• Only defined for certain time instances.
• Can be obtained from analog signals via sampling.

C. Digital Signal:
Digital signal is the signal that takes on values from a finite set of possible values as
shown in Fig. 3.

Fig. 3. Digital signal with four different amplitude values

• Discrete in amplitude & discrete in time.


• Can be obtained from discrete signals via quantization.

Finite and infinite length signal:


Finite length signal is nonzero over a finite interval tmin< t< tmax as shown in Fig. 4.

Fig. 4. Finite length signal

In contrast, the infinite length signal is nonzero over all real numbers.

What is signal processing?


Signals may have to be transformed in order to
• Amplify or filter out embedded information.
• Detect patterns.
• Prepare the signal to survive a transmission channel.
• Undo distortions contributed by a transmission channel.
• Compensate for sensor deficiencies.
• Find information encoded in a different domain.

2
Digital Signal Processing / 4th Class/ 2024-2025

Fig. 5 explains the main idea of the signal processor.

Fig. 5. Signal Processor

Analog signal processing:


Fig. 6 shows a basic block diagram of a typical analog signal processing system.

Fig. 6. A typical analog signal processing system

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.

Limitations of analog signal processing:


➢ Accuracy limitations due to
▪ Component tolerances
▪ Undesired nonlinearities
➢ Limited repeatability due to
▪ Tolerances
▪ Changes in environmental conditions
▪ Temperature
▪ Vibration
➢ Sensitivity to electrical noise
➢ Limited dynamic range for voltage and currents
➢ Inflexibility to changes

3
Digital Signal Processing / 4th Class/ 2024-2025

➢ Difficulty of implementing certain operations


▪ Nonlinear operations
▪ Time-varying operations
➢ Difficulty of storing information

Digital signal processing (DSP) system:


Digital signal processing (DSP) is one of the most powerful technologies that will
shape science and engineering in the twenty-first century. Revolutionary changes have already
been made in aboard range of fields: communications, radar and sensor. DSP converts signals
that naturally accrue in analog form (such as sound, video and information from sensors) to
digital form and uses digital techniques to enhance and modify analog signal data for various
applications. Fig. 7 shows a basic block diagram of a typical digital signal processing system.

Fig. 7. A typical digital signal processing (DSP) system

The system consists of an analog filter, an analog-to-digital conversion (ADC) unit, a


digital signal processor (DSP), a digital-to-analog conversion (DAC) unit, and a
reconstruction (anti-image) filter.

As shown in the diagram, the analog input signal, which is continuous in time and
amplitude, is generally encountered in our real life. Examples of such analog signals include
current, voltage, temperature, pressure, and light intensity. Usually a transducer (sensor) is
used to convert the 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.

2- Digital processing is inherently stable and reliable.

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

5- It is easy to Change, Correct, or Update applications (software changes), such as-that


needed in implementing adaptive circuits.

6- Sensitivity to electrical noise is minimal.

7- Digital information can be encrypted for security.

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.

2- Digital telephone: Speech recognition, high-speed modems, echo cancellation, speech


synthesizers, DTMF (dual-tone multi frequency) generation and detection, answering
machines.
5
Digital Signal Processing / 4th Class/ 2024-2025

3- Automobile industry: GPS, Active Noise Cancellation, Cruise Control, Parking.

4- Electronic communications: Cellular phones, digital telecommunications, wireless LAN


(local area networking), satellite communications.

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.

7- Military: Radar, sonar, space photographs, remote sensing.

8- Mechanical: Motor control, process control, oil and mineral prospecting.

6
Digital Signal Processing / 4th Class/ 2024-2025

Signal Sampling and Reconstruction


Analog to digital (A/D) conversion:
The analog-to-digital conversion is basically a 2 step process:
❑ Sampling
• Converts continuous-time analog signal xa(t) to discrete-time continuous value signal
x(n).
• It is obtained by taking the ”samples” of xa(t) at discrete-time intervals, Ts
❑ Quantization
• Converts discrete-time continuous valued signal to discrete time discrete valued signal.
These steps are shown in Fig. 8.

Fig. 8. Basic steps of ADC

Sampling of continuous signal


Sampling is the processes of converting continuous-time analog signal, xa(t), into a
discrete-time signal by taking the “samples” at discrete-time intervals.
➢ Sampling analog signals makes them discrete in time but still continuous valued.
➢ If done properly (Nyquist theorem is satisfied), sampling does not introduce distortion.
Fig. 9 shows an analog (continuous-time) signal (solid line) defined at every point over
the time axis and amplitude axis. Hence, the analog signal contains an infinite number of
points.

Fig. 9. Display of analog (continuous) signal and digital samples versus the sampling time instants

7
Digital Signal Processing / 4th Class/ 2024-2025

It is impossible to digitize an infinite number of points. Furthermore, the infinite points


are not appropriate to be processed by the digital signal processor or computer, since they
require an infinite amount of memory and infinite amount of processing power for
computations. Sampling can solve such a problem by taking samples at the fixed time interval,
as shown in Fig. 9 and Fig. 10, where the time T represents the sampling interval or
sampling period in seconds. As shown in Fig. 10, each sample maintains its voltage level
during the sampling interval T to give the ADC enough time to convert it. This process is
called sample and hold.

Fig. 10. Sample-and-hold analog voltage for ADC

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

fs=1/T Samples per second (Hz)


➢ If the signal is slowly varying, then fewer samples per second will be required than if the
waveform is rapidly varying. So, the optimum sampling rate depends on the maximum
frequency component present in the signal.

Nyquist sampling theorem or Nyquist criterion:


If an analog signal is not appropriately sampled, aliasing will occur, which causes
unwanted signals in the desired frequency band (i.e. if the sampling is performed at a proper
rate, no info is lost about the original signal and it can be properly reconstructed later).
”If a signal is sampled at a rate at least, but not exactly equal to twice the max frequency
component of the waveform, then the waveform can be exactly reconstructed from the samples
without any distortion“. The condition is described as

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.

Sampled signal spectrum:


Fig. 11 depicts the sampled signal xs(t) obtained by sampling the continuous signal x(t)
at a sampling rate of fs samples per second. Mathematically, this process can be written as the
product of the continuous signal and the sampling pulses (pulse train):

xs(t) = x(t) p(t)


Where, p(t) is the pulse train with a period T = 1/ fs.

Fig. 11. The simplified sampling process

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.

Fig. 12. Plots of 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

the spectral replicas is produced.

Fig. 13. Filter o/p in case of fs > 2B

Fig. 14. Filter o/p in case of fs < 2B

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.

Fig. 15. Signal notations at reconstruction stage

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.

Example: Assuming that an analog signal is given by

x(t) = 5cos(2π.2000t) +3cos(2π.3000t) for t ≥ 0, and it is sampled at the rate of 8,000 Hz,

a. Sketch the spectrum of the sampled signal up to 20 kHz.


b. Sketch the recovered analog signal spectrum if an ideal lowpass filter with a cutoff
frequency of 4 kHz is used to filter the sampled signal (y(n)=x(n) in this case) to recover the
original signal.
Sol.
a. Using Euler’s identity, we get

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

Aliasing noise level


Given the DSP system shown in Fig. 16, where we can find the percentage of the
aliasing noise level using the symmetry of the Butterworth magnitude function and its first
replica. Then:

Fig. 16. DSP system with anti-aliasing filter

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

Digital Signal and Systems


Discrete-Time Signals:
In digital signal processing, signals are represented as sequence of numbers called
“samples”. A sample value of a typical discrete-time signal or sequence is denoted as “x[n]”
with the argument “n” being an integer in the range (-∞ and ∞). It should be noted that x[n] is
defined only for integer values of “n” and undefined otherwise.

The most common basic sequences are described as follows:


❑ delta function or unit-impulse (sample) sequence δ(n)

❑ unit-step sequence U(n)

15
Digital Signal Processing / 4th Class/ 2024-2025

❑ unit-ramp sequence r(n)

❑ 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

For analog sine x(t)=sin(wt), the discrete sine x(n)=sin(wnTs)

w0=wTs where w=2πfm and Ts=1/fs

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.

1. x(n)=x(nTs)= 10 e − 5000  0.000125 n u(nT s ) = 10e − 0.625 n u(n)


2. x(n)=x(nTs)= 10sin(2000  0.000125n)u(nTs ) = 10 sin(0.25 n)u(n)

Periodic Sequences:
A sequence x(n) is defined to be periodic with period N if

Where; N is an integer number.

Example: Is the sequence x (n) = cos( n / 4) periodic, find N.


sol.
Suppose it is periodic sequence with period N
x(n)=x(n+N)
cos(πn/4)=cos(π(n+N)/4)
πn/4+2πk= πn/4+πN/4 N=2πk/(π/4)= 2πk/w0=8k K: integer
for k=1, N=8

Example: Is the sequence x (n) = cos(3 n / 8) periodic. If yes, find N.


sol.
Suppose it is periodic sequence with period N
x(n)=x(n+N)
cos(3πn/8)=cos(3π(n+N)/8)
3πn/8+2πk= 3πn/8+3πN/8 N=2πk/w0=2πk/(3π/8) K: integer
for k=3, N=16

Example: Is the sequence x (n) = cos(n) periodic. If yes, find N.


sol.
Suppose it is periodic sequence with period N
x(n)=x(n+N)
cos(n)=cos(n+N)
for n+2πk=n+N , K: integer There is no integer N Non-periodic sequence

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:

(ii) Time shifting: y(n) = x(n – n0)


• If n0˃0, called delay. y(n)=x(n-6).
• If n0<0, called predictor. y(n)=x(n+4)

(iii) Reflection (Time reversal): y(n) = x(-n)

❑ 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

(ii)Product (multiplier or modulation):


y(n)=x1.x2={x1(n) x2(n)}

Sequence Representation Using Delay Unit:


Any arbitrary sequence x(n) can be represented in terms of delayed and scaled impulse
sequence δ[n] as shown in the figure

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

Energy and Power of a Sequence:


Energy of a sequence is defined by
n= 

2
E= x (n)
n= − 
Power of a sequence is defined by

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

Discrete-Time Systems (Digital Processors):


A discrete-time system is a device or algorithm that operates on a discrete-time signal
called the input or excitation (e.g. x(n)), according to some rule (e.g. T[.]) to produce another
discrete-time signal called the output or response (e.g. y(n)). The transformation T[.], (also
called operator or mapping) or processing performed by the system on x(n) to produce y(n).

Interconnections of Systems:
1. Series or cascade interconnection. The output of System 1 is the input to System 2.

2. Parallel interconnection. The same input signal is applied to Systems 1 and 2.

20
Digital Signal Processing / 4th Class/ 2024-2025

3. Combination of both cascade and parallel interconnection.

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.

Classification of Discrete-Time Systems:


❑ Static (Memoryless) and Dynamic (Memory) Systems.
❑ Linear and Nonlinear Systems.
❑ Time-Invariant (TI) and Time-Varying Systems.
❑ Causal and Non-Causal Systems.
❑ Stable and Unstable Systems.

Static (Memoryless) and Dynamic (Memory) systems:


A discrete-time system is called static or memoryless if its output at any time instant n
depends on the input sample at the same time, but not on the past or future samples of the input.
For example y(n) =αx(n), y(n) =nx(n)+bx3(n).
In the other case, the system is said to be dynamic or to have memory, if the output of a
system at time n depends not only on the value of input at the same instant n, but also on past or
future values of the input. For example
N 
y[n] =αx[n]+ βx[n−1], y(n) =  h(k ) x(n − k ) , y(n) =  h(k ) x(n − k ) .
k =0 k =0
Linear and Nonlinear Systems:
A discrete-time system is called linear if only if it satisfies the linear superposition
principle. In the other case, the system is called non-linear. If y1(n) and y2(n) are the responses to
the inputs x1(n) and x2(n) respectively, then the input x(n)=ax1(n)+bx2(n) gives the output
y(n)=ay1(n)+by2(n).

21
Digital Signal Processing / 4th Class/ 2024-2025

x1 T[.] y1 ax1(n)+bx2(n) T[.] y

x2 T[.] y2 a y1+by2 =? y

Example: Test the linearity of the system


y(n) = 1/3(x(n+1)+x(n)+x(n-1))
sol.
The input x1 then the output y1(n)= (1/3)a(x1(n+1)+x1(n)+x1(n-1))
The input x2 then the output y2(n)= (1/3)b(x2(n+1)+x2(n)+x2(n-1))
a y1(n)+b y2(n)= (1/3)a(x1(n+1)+x1(n)+x1(n-1))+ (1/3)b(x2(n+1)+x2(n)+x2(n-1))

The input: x(n)=ax1(n)+bx2(n), then the output


y(n)=1/3(ax1(n+1)+bx2(n+1)+ax1(n)+bx2(n)+ax1(n-1)+bx2(n-1))
= (1/3)a(x1(n+1)+x1(n)+x1(n-1))+(1/3)b(x2(n+1)+x2(n)+x2(n-1))
Then, y(n)= a y1(n)+b y2(n) → The system is linear.

Example: Test the linearity of the accumulator system


n
y (n) =  x (k )
k = −
sol.
The input x1 then the output 𝑦1 (𝑛) = ∑𝑛𝑘=−∞ 𝑥1 (𝑘)
The input x2 then the output 𝑦2 (𝑛) = ∑𝑛𝑘=−∞ 𝑥2 (𝑘)
a y1(n)+b y2(n)= 𝑎 ∑𝑛𝑘=−∞ 𝑥1 (𝑘)+𝑏 ∑𝑛𝑘=−∞ 𝑥2 (𝑘)

The input: x(n)=ax1(n)+bx2(n), then the output


𝑦(𝑛) = ∑𝑛𝑘=−∞(𝑎𝑥1 (𝑛) + 𝑏𝑥2 (𝑛)) = 𝑎 ∑𝑛𝑘=−∞ 𝑥1 (𝑘)+𝑏 ∑𝑛𝑘=−∞ 𝑥2 (𝑘)
Then, y(n)= a y1(n)+b y2(n) → The system is linear.

22
Digital Signal Processing / 4th Class/ 2024-2025

Example: Test the linearity of the system


y(n) = x2(n)
Sol.
The input x1 then the output 𝑦1 (𝑛) = 𝑥1 2 (𝑛)
The input x2 then the output 𝑦2 (𝑛) = 𝑥2 2 (𝑛)
a y1(n)+b y2(n)= 𝑎𝑥1 2 (𝑛)+𝑏𝑥2 2 (𝑛)
The input: x(n)=ax1(n)+bx2(n), then the output
2
𝑦(𝑛) = (𝑎𝑥1 (𝑛) + 𝑏𝑥2 (𝑛)) = 𝑎2 𝑥1 2 (𝑛) + 2𝑎𝑏𝑥1 (𝑛)𝑥2 (𝑛) + 𝑏 2 𝑥2 2 (𝑛)
Then, y(n)  a y1(n)+b y2(n) → The system is nonlinear.

Time-Invariant (TI) and Time-Varying Systems:


A Time-Invariant (TI) system is one in which if y(n) is the output when the input x(n) is
applied, then y(n-n0) is the output when x(n–n0) is applied. In the other case, the system is called
time-variable. Conceptually, a system is TI if the behavior and the input-output characteristics do
not change with time. For example the system y(n) =αx(n).

Example: Given the linear systems:


a. y(n) = 2x(n − 5)
b. y(n) = 2x(3n)
c. y(n) = n x(n)
Determine whether each of the following systems is time-invariant.
sol.
a. Let the input and output be x1(n) and y1(n), respectively; then the system output is y1(n) =
2x1(n − 5). Again, let x2(n) = x1(n − n0) be the shifted input and y2(n) be the output due to the
shifted input. We determine the system output using the shifted input as
y2(n) = 2x2(n −5) = 2x1(n −5− n0):
Meanwhile, shifting y1(n) = 2x1(n − 5) by n0 samples leads to

23
Digital Signal Processing / 4th Class/ 2024-2025

y1(n − n0) = 2x1(n − n0− 5)


We can verify that y2(n) = y1(n − n0). Thus the shifted input of n0 samples causes the system
output to be shifted by the same n0 samples, thus, the system is time-invariant.

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.

Causal and Non-Causal Systems:


A causal system is one in which the output y(n) at time n depends only on the current
input x(n) at time n, its past input sample values such as x(n − 1), x(n− 2), . . . For example y[n]
= αx[n] + βx[n-1]. Otherwise, if a system output depends on the future input values, such as x(n
+ 1), x(n + 2), . . . , the system is noncausal. For example y[n] =αx[n]+ βx[n +1]. The noncausal

24
Digital Signal Processing / 4th Class/ 2024-2025

system cannot be realized in real time.

Example: Given the linear systems:


a. y(n) = 0.5x(n) + 2.5x(n − 2), for n ≥ 0
b. y(n) = 0.25x(n − 1) + 0.5x(n + 1) − 0.4y(n − 1), for n ≥ 0,
2
c. y(n) =  h(k ) x(n − k )
k = −2
Determine whether each is causal.
sol.
a. Since for n ≥ 0, the output y(n) depends on the current input x(n) and its past value x(n−2),
the system is causal.

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:

Where h(k) = unit impulse response.

Example: Given the systems:


a. y[n] = (x[n])2
n
b. Accumulator system y[n] =  x[k ] ,
k = −
Determine whether each is stable.
sol.

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 n0
Then y[n] =  x[k ] =  u[k ] = n + 1 n0
: not bounded
k = − k = − 
Thus, the accumulator system is unstable.
n 0 n0
Note:  u[k ] = n + 1 n0
k = − 

System Representation Using Its Impulse Response:


Any discrete-time can be characterized by one of the representations:
1) Difference Equation
2) Impulse Response h(n)
3) Transfer Function H(z)
4) Frequency Response H(W)
In this section, a Linear Time-Invariant (LTI) system will be represented by its impulse
response (h(n)).
A LTI system can be completely described by its unit-impulse response, which is defined
as the system response due to the impulse input δ(n) with zero initial conditions, depicted in the
following figure. Here x(n) = δ(n) and y(n) = h(n).

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=−

Alternatively, h[n] is the first order difference of S[n]

h[n] = y[n] x[n]=  [n] = S[n] − S[n − 1]

Example: For a LTI system described by the following difference equation:

26
Digital Signal Processing / 4th Class/ 2024-2025

y(n) = 0.8y(n-1) + x(n)


a. Find and sketch the first four sample values of the impulse and step responses.
b. Determine the final value of the step response as n ∞.
sol.
a. By setting x(n)=δ(n) in the system difference equation, then y(n)=h(n) so,
h(n)=0.8h(n-1)+δ(n)
for n=0, h(0)=(0.8)h(-1)+δ(0)=1
for n=1, h(1)=(0.8)h(0)+ δ(1)=0.8
for n=2, h(2)=(0.8)h(1)+δ(2)=(0.8)2=0.64
for n=3, h(3)=(0.8)h(2)+δ(3)=(0.8)3=0.512
b. By setting x(n)=u(n) in the system difference
equation, then y(n)=S(n) so,
S(n)=0.8S(n-1)+u(n)
for n=0, S(0)=(0.8)S(-1)+u(0)=1
for n=1, S(1)=(0.8)S(0)+u(1)=0.8+1=1.8
for n=2, S(2)=(0.8)S(1)+u(2)=0.8(0.8+1)+1=1+0.8+(0.8)2=2.44
for n=3, S(3)=(0.8)S(2)+u(3)=0.8(1+0.8+(0.8)2)+1=1+0.8+(0.8)2+(0.8)3=2.952
 1
Then, for n=∞, S(∞)=1+0.8+(0.8)2+(0.8)3+(0.8)4+ . . . +(0.8)∞=  (0.8) n = =5
n=0 1 − 0.8

 1 N 1− x ( N +1)
Note:  ( x) n =
1− x
and  ( x) n =
1− x
n= 0 n= 0

Example: Given the linear time-invariant system


y(n) = 0.5x(n) + 0.25x(n − 1) with an initial condition x(−1) = 0
a. Determine the unit-impulse response h(n).
b. Draw the system block diagram.
c. Write the output using the obtained impulse response.
sol.
a. h(n) = 0.5 δ(n) + 0.25 δ(n − 1) , where h(0)= 0.5, h(1) = 0.25 and h(n) = 0 elsewhere.
b.

27
Digital Signal Processing / 4th Class/ 2024-2025

c. y(n) = h(0) x(n) + h(1) x(n − 1)


From this result, it is noted that if the difference equation without the past output terms, y(n −
1), . . . , y(n − N), that is, the corresponding coefficients a , . . . , a , are zeros, the impulse
1 N

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

b. The system block diagram is given below

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

N= N1+N2-1. Where N1 = number of samples of x(n), N2= number of samples of h(n),


and N= total number of samples. This operation is represented symbolically as x(n)*h(n).
Let nx is position of x sequence ,nh is position of h sequence ,then the position
sequence of y (ny) can be found as
ny=[nx(0)+nh(0) … nx(N1-1)+nh(N2-1)]
Properties of Convolution:
1- Commutatively: Convolution is a commutative operation, meaning signals can be
convolved in any order.

2- Associativity (Cascaded Connection)


Convolution is associative, meaning that convolution operations in series can be done
in any order.

3- Distributivity (Parallel Connection)


Convolution is distributive over addition

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

c. Table Lookup Method:

Matrix by Vector Method:

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

Sol: N =maximum( 3 , 4 )=4 ,ny=[0 1 2 3] Applying the equation of circular convolution


1-Direct method : y(n) = ∑3k=0 x1 (k)x2 ((n − k) mod4) = ∑3k=0 x1 (k)x2 ((n − k) ∎4)
, ∎=mod addition
n=0 , y(0) = ∑3k=0 x1 (k)x2 ((−k) mod4)
y(0) = x1 (0)x2 (−0 ∎4) + x1 (1)x2 (−1 ∎4) + x1 (2)x2 (−2 ∎4) + x1 (3)x2 (−3 ∎4)
y(0) = x1 (0)x2 (0) + x1 (1)x2 (3) + x1 (2)x2 (2) + x1 (3)x2 (1)
𝐲(𝟎) = 1 × 0 + 2 × 3 + 2 × 2 + 0 × 1 = 𝟏𝟎
n=1 , y(1) = ∑3k=0 x1 (k)x2 ((1 − k) mod4)
y(1) = x1 (0)x2 (1 ∎4) + x1 (1)x2 (0 ∎4) + x1 (2)x2 (−1 ∎4) + x1 (3)x2 (−2 ∎4)
y(1) = x1 (0)x2 (1) + x1 (1)x2 (0) + x1 (2)x2 (3) + x1 (3)x2 (2)
𝐲(𝟏) = 1 × 1 + 2 × 0 + 2 × 3 + 0 × 2 = 𝟕
n=2 , y(2) = ∑3k=0 x1 (k)x2 ((2 − k) mod4)
y(2) = x1 (0)x2 (2 ∎4) + x1 (1)x2 (1 ∎4) + x1 (2)x2 (0 ∎4) + x1 (3)x2 (−1 ∎4)
y(2) = x1 (0)x2 (2) + x1 (1)x2 (1) + x1 (2)x2 (0) + x1 (3)x2 (3)
𝐲(𝟐) = 1 × 2 + 2 × 1 + 2 × 0 + 0 × 3 = 𝟒
n=3 , y(3) = ∑3k=0 x1 (k)x2 ((3 − k) mod4)
y(3) = x1 (0)x2 (3 ∎4) + x1 (1)x2 (2 ∎4) + x1 (2)x2 (1 ∎4) + x1 (3)x2 (0 ∎4)
y(3) = x1 (0)x2 (3) + x1 (1)x2 (2) + x1 (2)x2 (1) + x1 (3)x2 (0)
𝐲(𝟑) = 1 × 3 + 2 × 2 + 2 × 1 + 0 × 0 = 𝟗
2- Concentric Circle
1
0

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]

Example: If y(n) = [12 10 14 6] and h(n) = [4 2] find x(n) .


2 3
Solution: y = 12 + 10 x + 14 x + 6 x , and h = 4 + 2 x. Applying long division, we obtain
2
result = 3 + x + 3 x . Then x(n) = [3 1 3]
34
Digital Signal Processing / 4th Class/ 2024-2025

Frequency response and Sinusoidal Steady State Response

The Frequency domain representation:


In continuous linear time invariant (CLTI) system, it was important to know the
frequency response of a system ( H(jΩ ) ) , which could be used to find the steady-state response
of the system. For discrete linear time invariant (DLTI) system, H(ejW) will be used to find the
frequency response of the system.
W = Ω Ts rad/sample digital frequency.
Ω=2πf rad/sec. analog frequency.
Ts = 1 / f s sec. where, sampling rate = 1 / Ts.

Response to a complex exponential sequence:


If x(n) = ej nW (4.1)
  
y(n) =  h(k) x(n − k) =  h(k) e =e h(k) e
jW(n−k) jnW − jW k
And (4.2)
k =− k =− k= −

Let H(e ) = h(k) e−jWk


jW
(4.3)
k=−

 y(n) =e jnnW H (e jW ) (4.4)

H(ejW) = HR (ejW) + j HI(ejW) = │ H(ejW) │Φ(ejW) (4.5)

│ H(ejW) │ = [ { HR (ejW) }2 + { HI(ejW) }2 ] 1/2


(4.6.a)

Φ(ejW) =argument(H(ejW) )= tan -1 [HI(ejW) / HR (ejW) ] (4.6.b)


Response to a sinusoidal sequence:
A j jWon − j − jWon
If x(n) = A cos ( Wo n + θ ) = (e e +e e ) (4.7)
2
Substituting equation (4.7) into equation (4.4), and rearrange the terms, then:
jWo j
y(n) = 2 Re [0.5 A H ( e ) ejn Wo e ]
jWon
jWo
y(n) = A │ H (e ) │ cos [ n Wo + θ + Φ( e )] (4.8)

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:

a) H(e ) = h(n) e−jWn


jW
= 0.5 e-0 + e –jW + 0.5 e-j2W
n=−

= e –jW [ 0.5 e jW +1 + 0.5 e –jW ] = e –jW ( 1 + cos W )

│H(e jW )│= │ e –jW │.│( 1 + cos W )│= 1 + cos W

Φ(e jW ) = tan-1 (e –jW) + arg (1 + cos W ) = − W

│H(ejW)│ Φ(ejW)
2 π

-π π 2π W
0 π 2π W

b) Applying equation (4.8), where, W0 = π / 4


jWo
│H(e )│= │H(e jπ/4 )│= 1 + cos (π / 4 ) = 1.707
jWo
Φ( e )=−π/4
Then y(n) = 5 ( 1.707) cos [ (n π / 4 ) − ( π / 4 ) ] = 8.535 cos [π ( n – 1) / 4 ]

C) │H(e j 3 π / 4 )│= 1 + cos ( 3π / 4 ) = 0.2928


jWo
Φ( e )=−3π/4
y(n) = 5 ( 0.2928) cos [ (n π/4 ) − ( 3 π / 4 ) ] = 1.4644 cos [ 3 π ( n – 1) / 4 ]
In part (b) the input signal is amplified, while in part (c) the input signal is attenuated.
y(n) 2
d) y(n) = x(n)  h(n)
1.5
= 0.5 x(n) + x(n – 1) + 0.5 x(n – 2) 0.5 …….

= 0.5 u(n) + u(n – 1) + 0.5 u(n – 2) 0 1 2 3 n

Note:  (t − to )  f (t) = f (t − to )

36
Digital Signal Processing / 4th Class/ 2024-2025

Properties of frequency response:


1- H(e jW ) is a continuous function in W.

2- H(e jW ) is periodic in W with period 2π.

3- │H(e jW )│ is an even function of W and symmetrical about π.

4- Φ(e jW ) is an odd function of W and anti-symmetrical about π.

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
, a1

e− jWN / 2 ( e jWN / 2 − e− jWN / 2 ) sin(WN / 2)


H (e jW ) = e − jW ( N −1) / 2
e− jW / 2 ( e jW / 2 − e− jW / 2 ) sin(W / 2)
sin(WN / 2)
│H(e jW )│ =
sin(W / 2)

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

For w rad, let N=5 samples

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

Example (1): Find Z.T including region of convergence of x(n) = an u(n)

Solution:

5.2 Properties of Z.T:

5.2.1 Linearity: The z-transform is a linear transformation, which implies

Where; a and b are constants. ROC = ROC1∩ ROC2

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

5.2.4 Multiplication by exponential:

5.2.5 Initial and final value theorems:

5.2.6 Multiplication by n (Differentiation of X(z)):

5.3 Inverse of Z.T

The inverse z-transform may be obtained by the following methods:


1. Using properties.
2. Partial fraction (P.F) expansion method.
3. Power series expansion (the solution is obtained by applying long division because the
denominator can't be analyzed. It is not accurate method compared with the above three
methods).

Example (2): Find x(n) using partial fraction method, if:

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.

By examination, the sequence x(n) is

x(n) = δ(n) + 4 δ(n-1) + 8 δ(n-2) + 8 δ(n-3) + …

x(0)=1, x(1)=4, x(2)=8, x(3)=8, …

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

5.4 Solution of linear constant coefficient difference equation using Z.T

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:

5.5 Relations between system representations:

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

𝑍{𝑦(𝑛) = 0.2𝑦(𝑛 − 1) + 𝑥(𝑛)}

𝑌(𝑧) = 0.2𝑧 −1 𝑌(𝑧) + 𝑋(𝑧)

𝑌(𝑧) − 0.2𝑧 −1 𝑌(𝑧) = 𝑋(𝑧)

𝑌(𝑧)(1 − 0.2𝑧 −1 ) = 𝑋(𝑧)

Divide Y(z) by X(z) to get H(z)


𝑌(𝑧) 1 𝑧
𝐻(𝑧) = 𝑋(𝑧) = 1−0.2𝑧 −1 = 𝑧−0.2

Take inverse Z transform


𝑧
ℎ(𝑛) = 𝑍 −1 {𝑧−0.2 } = (0.2)𝑛 𝑢(𝑛)

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

Discrete Fourier Transform (DFT)


6.1 Definition of DFT
In time domain, representation of digital signals describes the signal amplitude versus the
sampling time instant or the sample number. However, in some applications, signal frequency
content is very useful than as digital signal samples.

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.

6.2 Fourier Series Coefficients of Periodic Digital Signals


To estimate the spectrum of a periodic digital signal x(n), sampled at a rate of fs Hz with
the fundamental period T0=NT, where there are N samples within the duration of the fundamental
period and T=Ts= 1/fs is the sampling period. Fig. 6.1 shows periodic digital signal.

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

As displayed in Figure 6.2 we note the following points:


a. Only the line spectral portion between the frequency −fs/2 and frequency fs/2 (folding
frequency) represents the frequency information of the periodic signal.
b. The spectrum is periodic for every Nf0 Hz.
c. For the kth harmonic, the frequency is f = kf0 Hz. f0 is called the frequency resolution.

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

b. The amplitude spectrum for the digital signal is sketched below:

6.3 Discrete Fourier Transform Formulas


Given a sequence x(n), 0 ≤ n ≤ N − 1, its DFT is defined as:

2𝜋𝑘𝑛
−𝑗
𝑋(𝑘) = ∑𝑁−1
𝑘=0 𝑥(𝑛) 𝑒 𝑁 k=0,1,… , N-1

The inverse DFT is given by:


2𝜋𝑘𝑛
1 𝑗
𝑥(𝑛) = ∑𝑁−1
𝑘=0 𝑋(𝑘) 𝑒 𝑁 n=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

Mapping the frequency bin k to its corresponding frequency is as follows:

Since ws = 2 π fs, then:

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

Example (4): In example (2), if the sampling rate is 10 Hz,


a. Determine the sampling period, time index, and sampling time instant for a digital sample
x(3) in time domain.
b. Determine the frequency resolution, frequency bin number, and mapped frequency for each of
the DFT coefficients X(1) and X(3) in frequency domain.

Solution:

6.4 The DFT as a Linear Transformation

The formulas for the DFT and IDFT may be expressed as:

55
Digital Signal Processing / 4th Class/ 2024-2025

Cyclic property of twiddle factors

For a 4-point DFT

=1 = -j = -1 =j

For an 8-point DFT

=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

Direct Computation of the DFT


To indicate the importance of efficient
computation schemes, it is instructive to
consider the direct evaluation of the
DFT equation, Since x(n) may be
complex, we can write

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.

Goal of an Efficient computation


Most of the computations can be eliminated

using the symmetry and periodicity properties

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.

This procedure can be repeated again and again.

At each stage the sequences are decimated and the smaller


DFTs combined.

The resulting procedure is called the decimation-in-time FFT


(DIF-FFT) algorithm, for which the

Total number of complex additional is= N*log2N;

Total number of complex multiplications = N/2*log2N

FFT and DFT computations

Algorithms DFT FFT

Complex multiplications N2 N/2*log2N

Complex additions N(N-1) Nlog2N

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

The second iteration

62
Flow graph of 8-point decimation-in-
time FFT algorithm using the butterfly
computation

Flow graph of 4-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

Example 3: Given x(n)=[0,1,2,3,4,5,6,7], find X[k]


using DITFFT algorithm?

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.

Its signal flowgraph is a transposed structure of the


DIT-FFT structure.

66
Flow graph of 8-point decimation-in-
frequency FFT algorithm using the butterfly
computation

Flow graph of 4-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

X(k)=[20 -5.827-j2.424 0 -0.173-j0.414 0 -0.173+j0.414 0 -5.827+j2.424 ]

Example :Given a sequence x(n) =[1 2 3 4] ,find


the FFT for the sequence using DIFFFT?
Solution:

X(k)=[10 -2+j2 -2 -2-j2]

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(1) = -2+2j -4 W40 1 12 1/4


x(2) = 2
~ -1
W40 1 j4 W41
~
j 16
X(3) = -2-2j 1/4 x(3) = 4
-1 -1

x(n)=[1 3 2 4]

Example 7: Given a sequence X(k)=[0 2+2j 4j 2-2j 0 2+2j 4j 2-2j]. Find


the IFFT using decimation in time method?

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]

Example 9: Find 8-point IDFT of a sequence


X[k]={36,-4+j9.7,-4+j4,-4+j1.7,-4, -4-j1.7,-4-4j,-4-j9.7} using DIFFFT algorithm.

70
71
Digital Signal Processing/ 4th Class/ 2024-2025

Analog Filter Design


Introduction:
A very important approach to the design of digital filters is to apply a transformation to an
existing analog filter. For this method, it is necessary to have a base or catalog of analog filters that can
serve as the prototypes for the transformation. In this lecture design procedures and tables for the analog
Butterworth and Chebyshev filters are presented to establish that base.
These analog procedures normally begin with a specification of the frequency response for the
filter describing how the filter reacts in the steady state to sinusoidal inputs.
- If an input sinusoid is not attenuated or attenuated less than a specified tolerance as it goes
through the system, it is said to be in a passband of the filter.
- If it is attenuated more than a specified value it is said to be stopped and within the stopband of
the filter.
- Input sinusoids with neither a little nor a large amount of attenuation are said to be in the
transition band.

-
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

Figure.2 Basic types of frequency responses


Butterworth Filters
A linear time invariant analog filter can be characterized by its system function H(s) or its
corresponding frequency response H(jΩ). The Butterworth filter of order n is described by the
magnitude squared of its frequency response given below:
𝟏
|𝐇𝐧 (𝐣𝛀)|𝟐 = 𝛀 𝟐𝐧 (1)
𝟏+( )
𝛀𝐜

In Fig. 3 the magnitude squared frequency response of the Butterworth filter is shown for several
different values of n.

Figure.3 The magnitude squared frequency response for a Butterworth filter.


The following properties are easily determined:
1. |Hn (jΩ)|2 |Ω=0 = 1 for all n.
2. |Hn (jΩ)|2 |Ω=Ωc = 0.5 for all finite n.
This implies that |Hn (jΩ)||Ω=Ωc = 0.707 , And 20 log|Hn (jΩ)||Ω=Ωc = −3.0103.
3. |Hn (jΩ)|2 is a monotonically decreasing function of Ω.
4. As n gets larger, |Hn (jΩ)|2 approaches an ideal low pass filter frequency response.
5. |Hn (jΩ)|2 is called maximally flat at the origin since all order derivatives exist and are zero.

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,

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.

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

Figure.4 Poles of |H1(s)|2 for a normalized Butterworth filter of order 2.


1 1 1
H2 (s) = (𝐬−𝐬 = (𝐬−(−𝟎.𝟕𝟎𝟕−𝐣𝟎.𝟕𝟎𝟕))(𝐬−(−𝟎.𝟕𝟎𝟕+𝐣𝟎.𝟕𝟎𝟕)) = s2+√2s+1
𝟐 )(𝐬−𝐬𝟑 )

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

Table 2 Analog to Analog Transformation

A=(-w1^2+wl*wu)/(w1*(wu-wl))
B=(w2^2-wl*wu)/(w12wu-wl))

Design of Low-Pass Butterworth Filters


The filter requirements are normally given in terms of a set of critical frequencies, say Ω1, Ω2 and gains
K1 and K2. A common set of conditions for the low- pass response given in Fig. 5 are
k1 ≤ 20 log|H(jΩ)| ≤ 0 for all Ω ≤ Ω1 (5)
20 log|H(jΩ)| ≤ k 2 for all Ω ≥ Ω2 (6)

76
Digital Signal Processing/ 4th Class/ 2024-2025

Figure.5 Desired filter requirements in dB form for a low-pass filter


As seen from Eq. (1), the Butterworth LP frequency response is characterized by only two parameters,
n, the order of the filter, and Ωc, the cutoff frequency. If we replace H(jΩ) in Eqs. (5) and (6) by the
Butterworth magnitude squared function Eq. (1) and consider that the equalities hold, n and Ωc must
satisfy the following:
1
10 log [ Ω ] = k1 (7)
1+( 1 )2n
Ωc

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

Producer for Design Butterworth filters:


1- Find the critical frequency 𝛀𝐫 according table .2 .
2- Find the order of the filter n according the equation
−k1
10 10 −1
log10 −k2
⌈ 10 10 −1 ⌉
n=⌈ 1 ⌉
2log10
⌈ Ωr

⌈ ⌉
3- Calculate the 𝐇(𝐬) using n and table 1.
4- Applying an analog-to-analog transformation, s → (…) using table 2.

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

21.3868 ,Applying a low-pass to low-pass transformation, s → s/Ωc, with Ωc =21.3868 gives


the desired transfer function as follows:
1
H(s) = H4 (s)|s→ s = s s s s
21.3868 (( )2 +0.76536 +1)(( )2 +1.84776 +1)
21.3868 21.3868 21.3868 21.3868

0.20921×106
H4 (s) = (s2 +16.3686s+457.394)(s2+39.517s+457.394)

Design of Bandpass Butterworth Filters


The design of a bandpass filter is also based on applying a transformation to a low-pass
normalized Butterworth filter of the proper order. The typical filter requirements shown in Fig. 6 can be
written as

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 )

Figure.6 Typical bandpass requirements.


For the bandpass filter to satisfy the k 2 requirement at Ω1 we must have equality within the
transformation, that is,
(jΩ)2 + Ωl Ωu
jΩr = (18)
jΩ(Ω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 )

Example.4: Design an analog bandpass filter with the following characteristics:


(a) a -3.0103 dB upper and lower cutoff frequency of 50 Hz and 20 kHz
(b) a stopband attenuation of at least 20 dB at 20 Hz and 45 kHz
(c) a monotonic frequency response

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)

(2.82743×105 )2 −1.25663×105 ×314.159


B= = 2.2545
2.82743×105 (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

4- The required analog-to-analog transformation is determined from Ωu and as Ωl


s 2 + Ωl Ωu s2 + 3.94784×107
s→ =
s(Ωu − Ωl ) s(1.25349×105 )

HBP (s) then is finally seen to be


1
HBP (s) =
s2
+ 3.94784 × 3 + 2(107 s2
+ 3.94784 × 107 2 s 2 + 3.94784 × 107
( ) ) + 2( )+1
s(1.25349 × 105 ) s(1.25349 × 105 ) s(1.25349 × 105 )
1.969530 × 1015 s 3
=
s6 + 2.5069909 × 1015 s5 + 3.15434 × 1010 s4 + 1.9893 × 1015 s3 +
1.245285 × 1018 s 2 + 3.9072593 × 1020 s + 6.15289108 × 1022

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:

Tn (x) = 2xTn−1 (x) − Tn−2 (x) n>2 (25)

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

Table.3 The First ten (10) Chebyshev Polynomials

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

Design Steps of Chebeshev LPF, HPF, BPF, and BSF :


1- Use the backward design equations from Table 2 to obtain normalized LPF requirements Ωr .
2-Calculate A using eq. (27)
3-Calculate g from eq. (28), then apply eq.(26) to find the order n.
4- Use Table 4 and Table 5 to find the Chebeshev Filter equation with order n.
5- Apply LP → LP or HP or BP or BS transformation (Table 2) and rearrange the equation obtained in
step 4.

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

(c) Stopband attenuation of 20 dB or greater beyond 1.3 rad/sec.


Solutions: This filter is a protype filter since Cutoff radian frequency is 1 rad/sec .
1- Ωr = 1.3 rad/sec
𝑘2
1
2- 20log|Hn (j1.3)| = 20log A = −20 , A = 10(−20) → A =10
1 1
20log|Hn (j1)| = 20log √1+ϵ2 = 10log 1+ϵ2 = −2 → ϵ = 0.76478 ( It can be taken from the

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

Using poles from Table (5):


H5 (s) =
0.08172
(s+0.218303)(s−(−0.06746+j0.97345))(s−(−0.06746−j0.97345))(s−(−0.1766151+j0.6016))(s−(−0.1766151−j0.6016))

0.08172
H5 (s) = (s+0.218303)(s2+0.134922s+0.95215)(s2+0.35323s+0.393119)

Example 6 : Design a Chebshev filter to satisfy the following specifications:


1-Acceptable pass-band ripple of 2dB
2-Cutoff frequency of 40 rad/sec.
3- Stop-band attenuation of 20 dB or more at 52 rad/sec.
Solution.
The required Ωr for the normalized filter is obtained from the backward design equation of Table 2 as
Ω′ 52
1- Ωr = Ω r = 40 = 1.3
u

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

The step 2 to 4 are equal are taken form example 5


0.08172
5- Hd (s) = H5 |s→ s = s s2 s s2 s
40 ( +0.218303)( +0.134922 +0.95215)( +0.35323 +0.393119)
40 40 40 40 40

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

Digital Filter Design


Introduction
A discrete time filter takes a discrete time input sequence x(n) and produces a discrete time output
sequence y(n).
A special class of a discrete time shift-invariant system can be characterized by a unit sample response
h(n), a system function H(Z), or difference equation.
∑𝑁 𝑀
𝑘=0 𝑎𝑘 𝑦(𝑛 − 𝑘) = ∑𝑘=0 𝑏𝑘 𝑥(𝑛 − 𝑘) (1)
∑𝑀 𝑏 𝑧 −𝑘
𝐻(𝑧) = ∑𝑁𝑘=0 𝑎𝑘𝑧 −𝑘 (2)
𝑘=0 𝑘

∑𝑀 𝑏 𝑒 −𝑗𝑤𝑘
𝐻(𝑒 𝑗𝑤 ) = ∑𝑁𝑘=0 𝑎𝑘𝑒 −𝑗𝑤𝑘 , 𝑧 = 𝑒 𝑗𝑤 (3)
𝑘=0 𝑘

A filter may be required to have a given frequency response, or specific response to an


impulse, step, or ramp, or simulate a continuous analog system. The simulation of analog filter is
shown in Fig. (1).

xa(t) x(n) Discrete y(n) D/A converter ya(t)


A/D converter time filter
(1/T) samples / H(Z) (1/T) samples /
sec. sec.

Figure .1 Equivalent analog filter


A/D converter consists of sampler, quantizer, and coder.
D/A converter consists of decoder, sample and hold, and low-pass filter.
Definitions
- If unit sample response h(n) is of finite duration, the system is said to be a Finite Impulse
Response (FIR) system. Eq. (1) represents FIR system if a0≠ 0 and ak = 0 for k=1, 2,..N.
- If unit sample response h(n) is of infinite duration, the system is said to be an Infinite Impulse
Response (IIR) system.
- IIR filter is usually implemented by recursive realization (is one in which the present value of
the output depends on both the input present and or past values), i.e., with feedback.
- FIR filter is usually implemented by either a nonrecursive realization (without feedback) or an
FFT realization.
Infinite Impulse Response (IIR) filter format
Example 1: Given the following IIR filter y(n) = 0.2 x(n) + 0.4 x(n − 1) + 0.5 y(n − 1), Determine the
transfer function, nonzero coefficients, and impulse response.

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

ℎ(𝑛) = 0.2(0.5)𝑛 𝑢(𝑛) + 0.4(0.5)𝑛−1 𝑢(𝑛 − 1)


Comparison between FIR and IIR filters
FIR IIR
1- Finite impulse response h(n) 1- Infinite impulse response h(n)
n1 ≤ n ≤ n2 n1 ≤ n ≤ ∞
2-Complex requires large number of 2- Simple, does not require large
Computations number of computations
3- Due to large number of computations, 3- Dose not require large memory
it requires large memory
4- Always stable because its poles lie at 4- Stable only if its poles lie inside the
the origin unit circle of the Z-plane
5- Linear phase characteristics 5- Nonlinear phase characteristics

Techniques for designing H(Z) for IIR filter:


1- Design by using numerical solutions of differential equations:
H(z) can be obtained by replacing s in Ha(s) by (1 – z-1)/T, that is,
𝐻(𝑧) = 𝐻𝑎 (𝑠)| 1−𝑧−1 (4)
𝑠→
𝑇

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

2-Bilinear transformation (BLT) Design method


2 1−𝑧 −1
H(z) can be obtained by replacing s in Ha(s) by , that is,
𝑇 1+𝑧 −1

𝐻(𝑧) = 𝐻𝑎 (𝑠)| 2 1−𝑧−1 (5)


𝑠→
𝑇 1+𝑧−1

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

Figure 1 Required frequency response

Step (1): applying eq. (6), where T=1 (prewarp case)

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:

Step (3): Applying bilinear transformation, eq.( 5), T = 1

3- Digital-to Digital transformation design method


1- Use digital specifications to calculate the order of digital unit bandwidth low-pass Butterworth
prototype and corresponding critical frequency Wp. The order of the digital filter can be
obtained by using eq. (6) of the prewarped digital frequencies Ωu and Ω` in the standard
formula for the analog Butterworth filter , as:
2-

(9)

(10)

3- From Table (1), calculate (11)


4- Table (2) gives HBn(z) for normalized low-pass Butterworth digital filter. Calculate
𝐻(𝑧) = 𝐻𝐵𝑛 (𝑧)| 𝑧−1 −𝛼 (12)
𝑧 −1 →
1−𝛼𝑧−1

92
Digital Signal Processing / 4th Class/ 2024-2025

Table 1 Digital-to digital transformation

Table 2 Normalized Butterworth Digital Filters of Order 1

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

Applying eq.(12) , then:

4 Impulse invariant design method


If ha(t) represents the response of an analog filter to a unit impulse δ(t), then the unit sample
response of a discrete-time filter used in an A/D-H(Z)-D/A structure is selected to be the sampled
version of h(n).

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

Figure 3 Effects of pole-zero placement on the magnitude response.


In the z-plane, when we place a pair of complex conjugate zeros at a given point on the unit circle with
an angle θ, we will have a numerator factor of (z − ejθ)(z − e−jθ) in the transfer function. Its magnitude
contribution to the frequency response at z = ejW is (ejW − ejθ)(ejW − e−jθ). When W = θ, the magnitude
will reach zero.
When a pair of complex conjugate poles are placed at a given point within the unit circle, we
have a denominator factor of (z − rejθ)(z − re−jθ), where r is the radius chosen to be less than and close
to 1 to place the poles inside the unit circle. The magnitude contribution to the frequency response at
W = θ will rise to a large magnitude, since the first factor (ejθ − rejθ) = (1 − r )e+jθ gives a small
magnitude of 1 − r, which is the length between the pole and the unit circle at the angle W = θ. Note
96
Digital Signal Processing / 4th Class/ 2024-2025

that the magnitude of e+jθ is 1.


Therefore, we can reduce the magnitude response using zero placement, while we increase the
magnitude response using pole placement. Placing a combination of poles and zeros will result in
different frequency responses. such as lowpass, highpass, bandpass, and bandstop. It is easy to
compute filter coefficients for simple IIR filters. Practically, the pole-zero placement method has good
performance when the bandpass and bandstop filters have very narrow bandwidth requirements and
the lowpass and highpass filters have either very low cutoff frequencies close to the DC or very high
cutoff frequencies close to the folding frequency (the Nyquist limit).
5.1 Second-Order Bandpass Filter Design
Poles in a band-pass filter are complex conjugate, with the magnitude r controlling the bandwidth and
the angle θ controlling the center frequency. The zeros are placed at z = 1, corresponding to DC, and z
= -1, corresponding to the folding frequency.
The poles will raise the magnitude response at the center frequency while the zeros will cause zero
gains at DC (zero frequency) and at the folding frequency. The following equations give the band-pass
filter design formulas using pole-zero placement:

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

First, we calculate the required magnitude of the poles ,


which is a good approximation. Use the center frequency to obtain the angle of the pole location
97
Digital Signal Processing / 4th Class/ 2024-2025

,compute the unit-gain scale factor as

Finally, the transfer function is given by

5.2 Second-Order Bandstop (Notch) Filter Design


For this type of filter, the pole placement is the same as the bandpass filter. The zeros are placed on the
unit circle with the same angles with respect to the poles. This will improve passband performance.
The magnitude and the angle of the complex conjugate poles determine the 3 dB bandwidth and the
center frequency, respectively

(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

which is a good approximation. We use the center frequency to obtain the


angle of the pole location

The unit-gain scale factor is calculated as

98
Digital Signal Processing / 4th Class/ 2024-2025

Finally, we obtain the transfer function

5.3 First-Order Low-pass Filter Design


The first-order pole-zero placement can be operated in two cases. The first situation is when the
cutoff frequency is less than fs /4. Then the pole-zero placement is shown in Fig. 4a.
As shown in Fig.4a, the pole z = α is placed in the real axis. The zero is placed at z = -1 to ensure zero
gain at the folding frequency (Nyquist limit). When the cutoff frequency is above fs /4, the pole-zero
placement is adopted as shown in Fig.4b.

(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

Last, we can develop the transfer function as

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,

5.4 First-Order High-pass Filter Design


Similar to the low-pass filter design, the pole-zero placements for first-order high-pass filters in two
cases are shown in Figures 5a and 5b.

(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

The unit-gain scale factor and transfer functions are obtained as

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

Hence, K = 1/12:7307 =0.07854

101
Digital Signal Processing / 4th Class/ 2024-2025

Finite Impulse Response (FIR) filter

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.

Design of FIR filters using Windows

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

Figure 3 Frequency response obtained by rectangularly windowing ideal LP impulse response.


As shown in Fig.3, the convolution produces a smeared version of ideal LP frequency response Hd(
ejW). In general, the narrower the main lobe ( larger N), the closer │H( ejW)│comes to │Hd( ejW)│.

Some of the most commonly used windows are:


1. Rectangular: A rectangular window is a function that is constant inside the interval and zero
elsewhere. The simple direct truncation window has the narrowest main lobe width 4π/N, also the
largest side-lobe peak, at about -13 dB. The truncation to a length N-1 is equivalent to multiplying the
signal by a rectangular window, defined as

(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

Table (2) Design table for FIR LPF

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

3- Select the wc and α for the impulse response as

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

N ≥ 8π / (0.45 − 0.3 ) π = 53.3 →N= 55

3- wc= w1= 0.3 π rad , and α = ( N− 1 ) /2 = 27.


4- Using eq. (9) for wHam and the value of hd(n) from Table (1) to find h(n):
sin⁡[0.3𝜋(𝑛−27)]
ℎ(𝑛) = ⁡. {0.54 − 0.46⁡cos⁡(2𝜋𝑛/54}⁡, 0 ≤ 𝑛 ≤ 54⁡
𝜋(𝑛−27)

H.W: Find the value of h(n) at n= 13,27,50 ?

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

3- wc= w1= 0.4 π rad , and α = ( 41− 1 ) /2 = 20.


4- Using eq. (9) for wHam and the value of hd(n) from Table (1) to find h(n):
sin⁡[0.4(𝑛−20)]
ℎ(𝑛) = ⁡. {0.54 − 0.46⁡cos⁡(2𝜋𝑛/40}⁡, 0 ≤ 𝑛 ≤ 41⁡
𝜋(𝑛−20)

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

3- wc= w1= 0.45 π rad , and α = ( N− 1 ) /2 = 27.


4- Using eq. (9) for wHam and the value of hd(n) from Table (1) to find h(n):

sin⁡[0.45𝜋(𝑛−27)]
ℎ(𝑛) = − ⁡. {0.54 − 0.46⁡cos⁡(2𝜋𝑛/54}⁡, 0 ≤ 𝑛 ≤ 54⁡
𝜋(𝑛−27)

111
Digital Signal Processing/ 4th Class/ 2024-2025

Realization of Digital Filters


A - Realization of IIR Filters
Digital filters described by the transfer function H(z) may be generally realized in the
following forms:
1. Direct form I realization.
2. Direct form II realization.
3. Cascade realization.
4. Parallel realization.
1-Direct-Form I Realization
A digital filter transfer function, H(z), is given by:

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

Fig.(1) (A) Direct-form I realization. (B) Direct-form I realization with M = 2.

112
Digital Signal Processing/ 4th Class/ 2024-2025

Note that the notation used in Figures (1.c) and (1.d) below;

Fig.(1.1c) Notations Fig.(1.1d) Notations

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

Fig.(2) (A) Direct-form II realization. (B) Direct-form II realization with M = 2.

113
Digital Signal Processing/ 4th Class/ 2024-2025

3.Cascade (Series) Realization


An alternate way to filter realization is to cascade the factorized H(z) in the following form:
H(Z) = H1(Z) . H2(Z) … Hk(Z) . (7)
Where Hk(z) is chosen to be the first- or second-order transfer function (section), which is defined by

(8)
Respectively. The block diagram of the cascade, or series, realization is depicted in Fig.(3)

Fig.(3) Cascade realization.


4. Parallel Realization
Now we convert H(z) into the following form
H(Z) = H1(Z) + H2(Z)+ … + Hk(Z) (9)
Where Hk(z) is defined as the first- or second-order transfer function (section) given by

(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

Example (1): Given a second-order transfer function

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)

Fig.(5) (a) Direct-form I realization (b) Direct-form II realization


2- To achieve the cascade (series) form realization, we factor H(z) into two first-order sections to yield

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

depicted in Fig.(5 c).

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)

B. Realization of FIR Filters


A causal FIR filter is characterized by:

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

You might also like