DSP Chapter One (2)

You might also like

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

EEng4091, Digital Signal Processing

Lecture 1:

1.1. Introduction to DSP

Signal
❑ Any physical quantity that varies with time, space or any other independent variables.
❑ a function of independent variable that carries information
❑ Eg. ECG, EEG, speech, image, voltages/currents in a circuit etc.
System
❑ An entity that processes one or more input signals in order to produce one or more output
signals

Input SYSTEM Output

Types of Signal processing


❑ Analog signal processing (ASP): If the input signal given to the system is analog then
system does analog signal processing. Eg. Resistor, capacitor or Inductor, OP-AMP etc.
❑ Digital signal processing (DSP): If the input signal given to the system is digital then
system does digital signal processing. Eg. Digital Computer, Digital Logic Circuits etc.

DSP (Digital signal Processing)


Most of the signals encountered in science and engineering are analog in nature. So, DSP operation
requires devices called as ADC (analog to digital Converter) it’s convert Analog signal into digital
and DAC (Digital to Analog Converter) does vice-versa.

ADVANTAGES OF DSP OVER ASP


❑ Physical size of analog systems is quite large while digital processors are more compact
and lighter in weight.
❑ Analog systems are less accurate because of component tolerance ex R, L, C and active
components. Digital components are less sensitive to the environmental changes, noise and
disturbances
❑ Digital system is most flexible as software programs & control programs can be easily
modified. (Analog system usually implies redesign the hard ware)
❑ Mathematical signal processing algorithm can be routinely implemented on digital signal
processing systems. Digital controllers are capable of performing complex computation
with constant accuracy at high speed.
❑ The cost of microprocessors, controllers and DSP processors are continuously going
down.
❑ Digital signals are easily stored on digital hard disk, floppy disk or magnetic tapes. Hence
becomes transportable.
❑ Digital signal processing systems are upgradeable since they are software controlled.

Disadvantages of DSP over ASP


❑ Additional complexity (A/D, D/A Converters & associated filters)
❑ Limit in frequency. High speed AD converters are difficult to achieve in practice. In high
frequency applications DSP are not preferred.
❑ Quantization noise and round off errors

Applications of DSP
❑ Telecommunication (cellphone, fax, modems, echo cancellations, etc)
❑ Consumer Electronics (flat screen TVs, television sets, MP3 players, video recorders, DVD
players, radio receivers, etc.)
❑ Image Processing (Compression, enhancement, animation, etc)
❑ Instrumentation and Control (function generator, process control, digital filter, etc)
❑ Military Applications (radar, intelligence, secure communications, etc)
❑ Speech Processing (speech recognition, speech to text conversion, …)
❑ Seismology (geophysical exploration such as oil, gas, nuclear and earth quake)
❑ Medicine (medical diagnostic instrumentation such as computerized tomography (CT), x-
ray scanning, Magnetic resonance imaging (MRI), Electroencephalography (EEG),
electrocardiography (ECG), etc)
Analog to Digital Conversion
Most signals of practical interest, such as speech, biomedical signals, seismic signal, radar signals,
solar signals and various communication signals such as audio and video signals are analog. To
process analog signals by digital means, it’s first necessary to convert them to digital form this
process is called (A-to-D) conversion. and the corresponding device are called analog-to-digital
converter or ADC

Analog Sampler Quantizer Encoder Digital


Signal Signal
Continuous in time and Discrete in time and Discrete in time and binary numbers
Amplitude Continuous in Amplitude Amplitude (encoded bits)

1. Sampling:
The process of converting a continuous time signal into a discrete time signal obtained by
taking samples of the continuous time signal at discrete time instants. Thus, if 𝑋𝑎 (𝑡) is the
input to the sampler, the output is 𝑋𝑎 (𝑛𝑇) = 𝑥(𝑛), where T is called sampling interval
(sampling period) and 𝑥(𝑛) is the discrete time signal obtained by taking samples of the analog
signal 𝑋𝑎 (𝑡) every T second.

Sampling Theorem: A finite energy function x(t) can be completely reconstructed from its
sampled value x(nTs), If a signal is sampled at a rate greater than or equal to twice the max
frequency component of the waveform, then the waveform can be exactly reconstructed from the
samples without any distortion”.

𝒇𝒔 ≥ 𝟐𝒇𝒎𝒂𝒙
➢ If the sample rate is not greater than the Nyquist rate, a problem called aliasing results,
which can cause severe distortion of signal.

2. Quantization (Quantizing) and Encoding:

Quantization: The process of mapping the sampled values of the amplitude by a finite set of
levels, which means converting a discrete time continuous valued signal into a discrete time
discrete valued signal. the value of each signal sample is represented by a value selected from
a finite set of possible values. These values are referred to as quantization levels.

Encoding: representing a finite set of levels by binary numbers (bits)

Quantization error: the difference between the unquantized sample 𝑥[𝑛] and the quantized
output 𝑥𝑄 [𝑛]

➢ The spacing between the two adjacent representation levels is called step-size.
𝑚𝑎𝑥−𝑚𝑖𝑛
∆= L is the number of quantization levels
𝐿

N = log 2 𝐿 N is the number of bits to encode each sampled value

Digital to Analog Conversion


❑ Reconstruction / Recovering the Analog Signal
❑ Interpolation:- zero order hold
❑ One way of recovering the original signal from sampled signal is pass it through a
Low Pass Filter (LPF)
Exercise
1. Consider the analog signal

𝑋𝑎 (𝑡) = 3𝑐𝑜𝑠100𝛱𝑡

a) Determine the minimum sampling rate required to avoid aliasing


b) Suppose that the signal is sampled at the rate 𝑓𝑠 = 200 𝐻𝑧 what is the discrete time signal
obtained after sampling
2. Consider the analog signal

𝑋𝑎 (𝑡) = 3𝑐𝑜𝑠50𝛱𝑡 + 10𝑠𝑖𝑛300𝛱 − 𝑐𝑜𝑠100𝛱𝑡

What is the Nyquist rate for this signal

1.2. Discrete time signals and systems


1.2.1. Discrete time signals
❑ A function that is defined only at discrete instants of time, that is denoted by 𝑥(𝑛)
❑ Define for every integer value n; −∞ < 𝑛 < ∞
❑ Derived by sampling a continuous time signal, 𝑥𝑎 (𝑡)

𝑥(𝑛) = 𝑥𝑎 (𝑛𝑇)

Where T is the sampling period (i.e., the time between successive samples)

Representation of discrete time signals


i. Graphical representation
ii. Functional representation
iii. Tabular representation
iv. Sequence representation

Example: Consider a signal x(n) with values

❑ x (-2) = 3, x (-1) = 2, x (0) = 0, x (1) = 3, x (2) = 1 and x (3) = 2


i. Graphical representation
ii. Functional representation

iii. Tabular representation

iv. Sequence representation

The arrow indicates the value of the samples when n=0

Basic discrete time signals

1. Unit sample: denoted by 𝛿(𝑛)

1 𝑓𝑜𝑟 𝑛 = 0
𝛿(𝑛) = {
0 𝑓𝑜𝑟 𝑛 ≠ 0
Shifted Unit sample
1 𝑓𝑜𝑟 𝑛 = 𝑘
𝛿(𝑛 − 𝑘) = {
0 𝑓𝑜𝑟 𝑛 ≠ 𝑘
2. Unit step, denoted by 𝑢(𝑛)
1 𝑓𝑜𝑟 𝑛 ≥ 0
𝑢(𝑛) = {
0 𝑓𝑜𝑟 𝑛 < 0

It related to unit sample by


𝛿(𝑛) = 𝑢(𝑛) − 𝑢(𝑛 − 1)
3. Unit ramp, denoted by 𝑢𝑟 (𝑛)

𝑛 𝑓𝑜𝑟 𝑛 ≥ 0
𝑢𝑟 (𝑛) = {
0 𝑓𝑜𝑟 𝑛 < 0

It related to unit step by


𝑢𝑟 (𝑛) = 𝑛𝑢(𝑛)
4. Exponential
𝑥(𝑛) = 𝑎𝑛 for all 𝑛
Where 𝑎 may be a real or complex number
real exponential sequence
if 𝑎 real, then 𝑥(𝑛) is a real signal
complex exponential sequence
when 𝑎 complex value, then 𝑥(𝑛) is complex signal. 𝑎 can be expressed as
𝑎 = 𝑟𝑒 𝑗𝜃 ,

Then 𝑥(𝑛) = 𝑟 𝑛 𝑒 𝑗𝜃𝑛

= 𝑟 𝑛 (𝑐𝑜𝑠𝜃𝑛 + 𝑗𝑠𝑖𝑛𝜃𝑛)
Since 𝑥(𝑛) is complex valued, it can be represented graphically by plotting the real
and imaginary part separately as a function of n
𝑥𝑅 (𝑛) = 𝑟 𝑛 𝑐𝑜𝑠𝜃𝑛, and 𝑥𝐼 (𝑛) = 𝑟 𝑛 𝑠𝑖𝑛𝜃𝑛

Simple manipulation of discrete time signals

The manipulation of signals are generally compositions of a few basic signal transformations.

a) Transformations of the independent variable n


i) Time shifting: a signal 𝑥(𝑛) can be shifted to the left or right by 𝑛𝑜
𝑥(𝑛 + 𝑛𝑜 )
If 𝑛𝑜 is positive 𝑥(𝑛) is shifted to the left (advance)
If 𝑛𝑜 is negative 𝑥(𝑛) is shifted to the right (delay)
ii) Time reversal/ folding: Replace the independent variable 𝑛 by −𝑛. the transformation is
simply involves “flipping” the signal 𝑥(𝑛) with respect to the index 𝑛 (folding of the signal
about the time origin 𝑛=0).
iii) Time scaling: 𝑥(𝛼𝑛), the sequence is formed by taking every 𝛼 sample of 𝑥(𝑛)
Down sampling: if 𝛼 > 1
Up sampling: if 0 < 𝛼 < 1

Shift, reversal and time scaling operations are order dependent.


b) Transformations of the amplitude of 𝒙(𝒏) (amplitude manipulations)
The most common types of amplitude transformations are addition/subtraction, multiplication and
scaling.
Consider two signals 𝑥1 (𝑛) and 𝑥2 (𝑛)
i) Addition/ Subtraction
𝑦(𝑛) = 𝑥1 (𝑛) ± 𝑥2 (𝑛) −∞ < 𝑛 < ∞
ii) Multiplication
𝑦(𝑛) = 𝑥1 (𝑛)𝑥2 (𝑛) −∞ < 𝑛 < ∞
iii) Scaling: amplitude scaling of a signal 𝑥(𝑛) by a constant 𝑐 is accomplished by
multiplying every signal value by 𝑐
𝑦(𝑛) = 𝑐𝑥(𝑛) −∞ < 𝑛 < ∞
1.2.2. Discrete time systems

a discrete time system is a device or algorithm that operate on a discrete time signal

𝑥(𝑛) Discrete time 𝑦(𝑛)


system
Input or excitation T[.] output or response
An input signal 𝑥(𝑛) is transformed by the system into an output signal 𝑦(𝑛), such that
𝑦(𝑛) = 𝑇[𝑥(𝑛)]
the notation 𝑇[. ] is used to represent a general system
𝑥(𝑛) 𝑇 𝑦(𝑛)
Classification of discrete time systems
The discrete time system can be classified in several ways, the most basic ones is based on
properties.
i. Linearity (linear vs nonlinear)
A system is said to linear if it satisfies the principle of superposition
𝑻[𝑎1 𝑥1 (n) + 𝑎2 𝑥2 (𝑛)] = 𝑎1 𝑻[𝑥1 (𝑛)] + 𝑎2 𝑻[𝑥2 (𝑛)]
Example: Check whether the following systems are linear or not:
1
a) 𝑦(𝑛) = 𝑥 2 (𝑛) b) 𝑦(𝑛) = 𝑛2 𝑥(𝑛) c) 𝑦(𝑛) = 𝑥[𝑠𝑖𝑛(𝑛)] d) 𝑥(𝑛)+2𝑥(𝑛−2)

ii. Causality (causal vs non causal)


A system is said to be causal (or non-anticipative) if the output of the system at any instant n
depends only on the present and past values of the input but not on future inputs.
✓ Causal systems are real time systems. They are physically realizable.
𝑦(𝑛)=F[x(n), x(n-1), x(n-2),……]
Example: Check whether the following systems are causal or not:
a) 𝑦(𝑛) = 𝑥(𝑛) + 𝑥(𝑛 − 1) b) 𝑦(𝑛) = 𝑥(𝑛2 ) c) 𝑦(𝑛) = 𝑥(2𝑛) d) 𝑦(𝑛) = 𝑎𝑥(𝑛)

iii. Stability (stable vs unstable)


BIBO Criteria: for a stable system the output should be bounded for bounded input at each and
every instant. (if and only if every bound input produce a bounded output)

Example: Check whether the following systems are stable or not:


a) 𝑦(𝑛) = 𝑥 2 (𝑛) b) 𝑦(𝑛) = 𝑛. 𝑥(𝑛) c) 𝑦(𝑛) = 𝑐𝑜𝑠𝑛. 𝑥(𝑛)

iv. Time invariance (time invariant vs time variant)


A system is called time invariant if its input- output characteristics do not change with time
1.3. Linear convolution and its property
The response of LTI systems to arbitrary input is computed by using convolution
𝑦[𝑛] = ∑∞
𝑘=−∞ 𝑥[𝑘]ℎ[𝑛 − 𝑘] 𝑦[𝑛] = 𝑥[𝑛] ∗ ℎ[𝑛]
Methods of computing convolution
✓ Graphical Method
✓ Using equation of convolution
✓ Tabulation method
Graphical Method
There are four basic steps to the calculation: (plot both sequence as a function of k)
1. Folding: folding ℎ(𝑘) about 𝑘 = 0 to obtain ℎ(−𝑘)
ℎ(𝑘) time reverse ℎ(−𝑘)

2. Shifting: shift ℎ(−𝑘) by 𝑛𝑜 to the right (left) if 𝑛𝑜 is positive (negative) to obtain ℎ(𝑛𝑜 −
𝑘)
ℎ(−𝑘) shift ℎ(𝑛𝑜 − k)
3. Multiplication: multiply 𝑥(𝑘) by ℎ(𝑛𝑜 − k) to obtain the product sequence

Multiply 𝑥(𝑘)ℎ(𝑛𝑜 − k)

4. Summation: sum all the value of the product sequence to obtain the value of the output at
time 𝑛 = 𝑛𝑜
Sum ∑∞
𝑘=−∞ 𝑥(𝑘)ℎ(𝑛𝑜 − k)

The process is repeated for all possible shifts, n


Tabulation Method
✓ The simplest method of computing discrete convolution for short sequences
Steps 1. Arrange x[n] in row and h[n] in column or vice versa
2. Multiply each corresponding element
3. Add product elements diagonally
Properties of convolution
a) Commutative:
𝑥[𝑛] ∗ ℎ[𝑛] = ℎ[𝑛] ∗ 𝑥[𝑛] or ∑∞ ∞
𝑘=−∞ 𝑥[𝑘]ℎ[𝑛 − 𝑘] = ∑𝑘=−∞ ℎ[𝑘]𝑥[𝑛 − 𝑘]

From a systems point of view, this property states that the system output is the same
when we interchange the role of 𝑥(𝑛) and ℎ(𝑛)

b) Associative:
[𝑥(𝑛) ∗ ℎ1 (𝑛)] ∗ ℎ2 (𝑛) = 𝑥(𝑛) ∗ [ℎ1 (𝑛) ∗ ℎ2 (𝑛)]
From a systems point of view, this property states that if two systems with unit sample
responses ℎ1 (𝑛) and ℎ2 (𝑛) are connected in cascade, an equivalent system is one that
has a unit sample response equal to the convolution of ℎ1 (𝑛) and ℎ2 (𝑛)
ℎ𝑒𝑞 (𝑛) = ℎ1 (𝑛) ∗ ℎ2 (𝑛)

c) Distributive:
𝑥(𝑛) ∗ [ℎ1 (𝑛) + ℎ2 (𝑛)] = 𝑥(𝑛) ∗ ℎ1 (𝑛) + 𝑥(𝑛) ∗ ℎ2 (𝑛)
From a systems point of view, this property states that if two systems with unit sample
responses ℎ1 (𝑛) and ℎ2 (𝑛) are connected in parallel, an equivalent system is one that
has a unit sample response equal to the sum of ℎ1 (𝑛) and ℎ2 (𝑛)
ℎ𝑒𝑞 (𝑛) = ℎ1 (𝑛) ∗ ℎ2 (𝑛)
Examples
1. compute the convolution of 𝑥[𝑛] = {1,2,3} 𝑎𝑛𝑑 ℎ[𝑛] = {1,1}
2. The impulse response of LTI system is
ℎ(𝑛) = {1, 2, 1, −1}

determine the response of the system to the input signal


𝑥(𝑛) = {1, 2, 3, 1}

3. Consider an input 𝑥(𝑛) and a unit impulse response ℎ(𝑛) given by


𝑥(𝑛) = 𝛼 𝑛 𝑢(𝑛) 𝑎𝑛𝑑 ℎ(𝑛) = 𝑢(𝑛)
with 0 < 𝛼 < 1, determine the response (determine the output) of the system

4. Determine the impulse response for the cascade of the two LTI system having impulse
responses
1 1
ℎ1 (𝑛) = ( )𝑛 𝑢(𝑛) 𝑎𝑛𝑑 ℎ2 (𝑛) = ( )𝑛 𝑢(𝑛)
2 4

5. compute the convolution of the signals


1
𝑥[𝑛] = { 3𝑛 0≤𝑛<6
0 𝑒𝑙𝑠𝑒 𝑤ℎ𝑒𝑟𝑒
1 −2 ≤ 𝑛 ≤ 2
ℎ[𝑛] = {
0 𝑜𝑡ℎ𝑒𝑟 𝑤𝑖𝑠𝑒
Reading assignment
Correlation of discrete time signals and their applications
- Auto correlation
- Cross correlation

You might also like