Dr. Md. Ekramul Hamid Associate Professor Department of Computer Science and Engineering University of Rajshahi SIGNALS AND SYSTEMS AND INTRODUCTION TO DIGITAL SIGNAL PROCESSING CSE, RU
Dec 25, 2015
Dr. Md. Ekramul HamidAssociate ProfessorDepartment of Computer Science and EngineeringUniversity of Rajshahi
SIGNALS AND SYSTEMSANDINTRODUCTION TO DIGITAL SIGNAL PROCESSINGCSE, RU
Digital Signal Processing Signal Processing deals with the enhancement, extraction,
and representation of information for communication or analysis Many different fields of engineering rely upon signal processing
technology Acoustics, telephony, radio, television, seismology, and radar are
some examples Initially, signal processing systems were implemented
exclusively with analog hardware However, recent advances in high-speed digital technology have
made discrete signal processing systems more popular. Digital systems have an advantage over analog systems in that
they can process signals with an extraordinary degree of precision
Unlike the resistive and capacitive networks of analog systems, digital systems can be built numerically with the simple operations of addition and multiplication.
Digital Signal Processing is a field of numerical mathematics
that is concerned with the processing of discrete signals This area of mathematics deals with the principles that underlie
all digital systems2
Goal of DSP
3
Typical System Components
4
Applications of DSP
5
Applications of DSP: MultimediaCompression: Fast, efficient, reliable
transmission and storage of dataApplied on audio, image and video
data for transmission over the Internet, storage
Examples: CDs, DVDs, MP3, MPEG4, JPEG
Mathematical Tools: Fourier Transform, Quantization, Modulation
6
Applications of DSP: Biological signal
Examples: Brain signals (EEG) Cardiac signals (ECG) Medical images (x-ray, PET, MRI)
Goals: Detect abnormal activity (heart attack) Help physicians with diagnosis
Tools: Filtering, Fourier Transform
7
Applications of DSP: Biometrics Identifying a person using
physiological characteristicsExamples:
Fingerprint Identification Face Recognition Voice Recognition
8
Applications of DSP: Audio Signal processing
Active noise cancellation: Adaptive filtering Headphones used in cockpits
Digital Audio Effects Add special music effects such as delay,
echo, reverbAudio signal separation
Separate speech from interference
9
Main Topics to be Covered:
o Signals And Systems – (Prerequisite of DSP)
o Linear Time Invariant Systems
o Convolution
o Correlation
10
Signals and Systems Defined
A signal is any physical phenomenon which conveys information
Systems respond to signals and produce new signals
Excitation signals are applied at system inputs and response signals are produced at system outputs
11
Signal
12
Signal (Example)
13
Independent Variable• Time is often the independent
variablefor a signal. x(t) will be used to representa signal that is a function of time, t.
• A temporal signal is defined by the relationship of its amplitude (the dependent variable) to time (the independent variable).• An independent variable can be 1D
(time), 2D (space), 3D (space) or even something more complicated.
• The signal is described as a function of this variable.
• There are many types of functions that can be used to describe signals (continuous, discrete, random).
14
Analog and Digital Signal
Signals can be analog or digital.Analog signals can have an infinite
number of values in a range.Digital signals can have only a
limited number of values.
15
Analog or continuous Time Signal
• Most of the signals in the physical world are CT signals, since the time scale is infinitesimally fine (e.g., voltage, pressure, temperature, velocity).
• Often, the only way we can view these signals is through a transducer, a device that converts a CT signal to an electrical signal.
• Common transducers are the ears, the eyes, the nose… but these are a little complicated.
• Simpler transducers are voltmeters, microphones, and pressure sensors.
16
Analog Signal
-5
-3
-1
1
3
5
-10 -5 0 5 10
-5
-4
-3
-2
-1
0
1
2
3
4
5
-10 -5 0 5 10
Amplitude
Phase
Frequency
f(x) = 5 cos (x)
f(x) = 5 cos (x + 3.14)
f(x) = 5 cos (3 x + 3.14) -5
-3
-1
1
3
5
-10 -5 0 5 10
17
Signal in Time Domain The Independent Variable is Time The Dependent Variable is the Amplitude Most of the Information is Hidden in the Frequency
Content
0 0.5 1-1
-0.5
0
0.5
1
0 0.5 1-1
-0.5
0
0.5
1
0 0.5 1-1
-0.5
0
0.5
1
0 0.5 1-4
-2
0
2
4
10 Hz
2 Hz
20 Hz
2 Hz +10 Hz +
20Hz
TimeTime
Time Time
Mag
nit
ud
e
Mag
nit
ud
e
Mag
nit
ud
e
Mag
nit
ud
e
18
Analog to Digital Recording Chain
ADC
Continuously varying electrical energy is an analog of the sound pressure wave.
Microphone converts acoustic to electrical energy. It’s a transducer.
ADC (Analog to Digital Converter) converts analog to digital electrical signal.Digital signal transmits binary numbers.
DAC (Digital to Analog Converter) converts digital signal in computer to analog for your headphones.
19
Instantaneous amplitudes of continuous analog signal, measured at equally spaced points in time.
A series of “snapshots”
ADC: Step1: Sampling
20
[a.k.a. “sample word length,” “bit depth”]Precision of numbers used for measurement: the more bits, the higher the resolution.
Example: 16 bit
Sampling RateHow often analog signal is measured
Sampling Resolution
[samples per second, Hz]Example: 44,100 Hz
Analog to Digital Overview
21
Nyquist Theorem:Sampling rate must be at least twice as high as the highest frequency you want to represent.
Determines the highest frequency that you can represent with a digital signal.
Capturing just the crest and trough of a sine wave will represent the wave exactly.
Sampling Rate
22
Recovery of a sampled sine wave for different sampling rates
23
Aliasing
What happens if sampling rate not high enough?
A high frequency signal
sampled at too low a rate
looks like …
… a lower frequency signal.
That’s called aliasing or foldover. An ADC has a low-pass anti-aliasing filter to prevent this.
Synthesis software can cause aliasing.24
Anti-Aliasing Filter
An anti-aliasing filter removes frequencies that are higher than half the sampling rate using what is called a low pass filter. A low pass filter lets the low frequencies “pass" and "cut" the high frequencies. Low pass filters are sometimes called high cut filters.
25
Effects of under sampling
26
Effects of required sampling
27
Common Sampling Rates
Sampling Rate Uses
44.1 kHz (44100) CD, DAT
48 kHz (48000) DAT, DV, DVD-Video
96 kHz (96000) DVD-Audio
22.05 kHz (22050) Old samplers
Most software can handle all these rates.
Which rates can represent the range of frequencies audible by (fresh) ears?
28
A/D: Step2: Quantization
Sampling results in a series of pulses of varying amplitude values ranging between two limits: a min and a max.
The amplitude values are infinite between the two limits.
We need to map the infinite amplitude values onto a finite set of known values.
This is achieved by dividing the distance between min and max into L zones, each of height
= (max - min)/L
29
Quantization Level
The midpoint of each zone is assigned a value from 0 to L-1 (resulting in L values)
Each sample falling in a zone is then approximated to the value of the midpoint.
30
Assigning Codes to Zones Each zone is then assigned a binary code. The number of bits required to encode the
zones, or the number of bits per sample as it is commonly referred to, is obtained as follows:
nb = log2 L Given our example, nb = 3 The 8 zone (or level) codes are therefore:
000, 001, 010, 011, 100, 101, 110, and 111
Assigning codes to zones: 000 will refer to zone -20 to -15 001 to zone -15 to -10, etc. 31
0
1
2
3
4
5
6
7
Am
plit
ud
e
Time — measure amp. at each tick of sample clock
A 3-bit binary (base 2) number has 23 = 8 values.
3-bit Quantization
32
4-bit Quantization
A 4-bit binary number has 24 = 16 values.
0
2
4
6
8
10
12
14
Am
plit
ud
e
A better approximation
Time — measure amp. at each tick of sample clock
33
Quantization Error
When a signal is quantized, we introduce an error - the coded signal is an approximation of the actual amplitude value.
The difference between actual and coded value (midpoint) is referred to as the quantization error.
The more zones, the smaller which results in smaller errors.
BUT, the more zones the more bits required to encode the samples -> higher bit rate
34
Quantization Noise
Round-off error: difference between actual signal and quantization to integer values…
Random errors: sounds like low-amplitude noise
35
A/D: step3: Coding
QuantizationQuantization is the process of converting the sampled analog voltages into digital words.
Data codingData coding separates the digital words so that they are more easily identified.
36
Digital to Analog Conversion: Sample and Hold
To reconstruct analog signal, hold each sample value for one clock tick; convert it to steady voltage.
0
1
2
3
4
5
6
7
Am
plit
ud
e
Time 37
DAC: Smoothing Filter
Apply an analog low-pass filter to the output of the sample-and-hold unit: averages “stair steps” into a smooth curve.
0
1
2
3
4
5
6
7
Am
plit
ud
e
Time 38
Discrete-Time Signal (Example) Discrete-time signals are represented by sequence of
numbers The nth number in the sequence is represented with
x[n] Often times sequences are obtained by sampling of
continuous-time signals In this case x[n] is value of the analog signal at xc(nT) Where T is the sampling period
0 20 40 60 80 100-10
0
10
t (ms)
0 10 20 30 40 50-10
0
10
n (samples)39
Signals With Symmetry: Periodic
The periodicity of sequence
then the is called a periodic sequence,and the value of N is called the fundamental period.
)(nx
)()( kNnxnx if: any integerk: positive integerN
40
0 10 20 30 40 50 60 70 80 90-1
-0.5
0
0.5
1
n
Am
plit
ud
e
periodic sequence
0 10 20 30 40 50 60 70 80 90-1
-0.5
0
0.5
1
n
Am
plit
ud
e
periodic sequence
periodic sequence)
8sin( n
)16
sin( n
Signals With Symmetry: Even/Odd
)()( nxnx
)()( nxnx
Even
Odd
42
Signals With Symmetry: Even/Odd
• Any signals can be expressed as a sum of even and odd signals.
That is:
• This is demonstrated to the right for a signal referred to as
a unit step.
2/)]()([)(
2/)]()([)(
:
)()()(
txtxtx
txtxtx
where
txtxtx
odd
even
oddeven
43
The Discrete-Time Signal: Sequences
Unit sample sequence
0,0
0,1)(
n
nn
0
00 ,0
,1)(
nn
nnnn
0,0
0,1)(
n
nnu
0
00 ,0
,1)(
nn
nnnnu
)1()()( nunun
0
)()(m
mnnu
Unit step sequence
Exponential sequence nA]n[x
-10 -5 0 5 100
0.5
1
1.5
-10 -5 0 5 100
0.5
1
1.5
-10 -5 0 5 100
0.5
1
46
The Discrete-Time Signal: Sequences
-10 -5 0 5 10 15 200
0.2
0.4
0.6
0.8
1
n
Am
plitu
de
unit sample sequence
-10 -5 0 5 10 15 200
0.2
0.4
0.6
0.8
1
n
Am
plitu
de
)(n
)5( n
47
The Discrete-Time Signal: Sequences
-5 0 5 10 15 200
0.2
0.4
0.6
0.8
1
n
Am
plitu
de
unit step sequence
-5 0 5 10 15 200
0.2
0.4
0.6
0.8
1
n
Am
plitu
de
)(nu
)5( nu
48
The Discrete-Time Signal: Sequences
Operations on sequence
Time-shifting operation
)()( Nnxny where is an integerN
delaying operation
0N
advance operation
0N
z-1)(nx )1()( nxnyUnit delay
z)(nx )1()( nxnyUnit advance
49
The Discrete-Time Signal: Sequences
-10 -5 0 5 10 15 20 25 300
0.1
0.2
n
Am
plitu
de
original sequence
-10 -5 0 5 10 15 20 25 300
0.1
0.2
n
Am
plitu
de
delayed sequence
-10 -5 0 5 10 15 20 25 300
0.1
0.2
n
Am
plitu
de
advanced sequence
Time-shifting operation
)(8.02.0 nun
)5(8.02.0 5 nun
)5(8.02.0 5 nun
Time-shifting operation
50
The Discrete-Time Signal: Sequences
Time-reversal (folding) operation
)()( nxny
Addition operation
)(nx )()()( nwnxny Adder
)(nw
Sample-by-sample addition )()()( nwnxny
51
The Discrete-Time Signal: Sequences
-20 -15 -10 -5 0 5 10 15 200
0.2
0.4
0.6
0.8
1
n
Am
plitu
de
original sequence
-20 -15 -10 -5 0 5 10 15 200
0.2
0.4
0.6
0.8
1
n
Am
plitu
de
folding sequence
folding operation )(8.0 nun
)(8.0 nun
folding operation
52
0 5 10 15 20 25 30 35 400
0.5
1
n
Am
plit
ud
e
x1(n)
0 5 10 15 20 25 30 35 40-1
0
1
n
Am
plit
ud
e
x2(n)
0 5 10 15 20 25 30 35 40-1
0
1
2
n
Am
plit
ud
e
x1(n)+x2(n)
addition operation )(8.0 nun
)()2.0cos( nun
)()2.0cos()(8.0 nunnun
The Discrete-Time Signal: Sequences
Scaling operation
)()( nAxny
)(nx )()( nAxny Multiplier A
Product (modulation) operation
)(nx )()()( nwnxny modulator
)(nw
Sample-by-sample multiplication )()()( nwnxny
54
0 20 40 60 80 100 120 140 160-0.1
0
0.1A
mp
litu
de
x1(n)
0 20 40 60 80 100 120 140 160-1
0
1
Am
plit
ud
e
x2(n)
0 20 40 60 80 100 120 140 160-0.1
0
0.1
Am
plit
ud
e
x1(n)*x2(n)
modulation operation n0125.0sin1.0
n125.0sin
)()( 21 nxnx
Decimation and Interpolation
Decimation---down-sampling
N
)()( mNxmy
x(n)
56
Decimation and Interpolation
N
)()( mNxmy
Decimation---down-sampling
57
Decimation and Interpolation
N
)()( mNxmy
y(m)
Decimation---down-sampling
58
Decimation and Interpolation
N
Interpolation --- up-sampling
59
Decimation and Interpolation
N
Interpolation --- up-sampling
60
The Discrete-Time Signal: Sequences
Sinusoidal sequence
nnAnx ),cos()( 0
amplitude
digital angular frequency
phase
A
0
) 205.0sin(5.1)(
) 205.0cos(5.1)(
2
1
nnx
nnx
61
The Discrete-Time Signal: Sequences
0 10 20 30 40 50 60-2
-1
0
1
2
n
Am
plitu
de
Sinusoidal sequence
0 10 20 30 40 50 60-2
-1
0
1
2
n
Am
plitu
de
) 205.0cos(5.1 n
) 205.0sin(5.1 n
62
The Discrete-Time Signal: Sequences
The periodicity of sinusoidal sequence
)cos()( 0 nAnx
)cos()( 00 NnANnx
k
NorkN
00
22
If , : any
integerN k
is a periodic sequence and its period is)(nx
0
2
k
N 0
min2N
63
The Discrete-Time Signal: Sequences
0min
2
N0
2
If is a integer
0
2
If is a noninteger rational number
QNkP
QkN
P
Q min
00
22
0
2
If is a irrational number
is an aperiodic sequence)(nx
)cos()( 0 nAnx
64
0 10 20 30 40 50 60 70 80 90-1
0
1
Am
plit
ud
e
x1(n)
0 10 20 30 40 50 60 70 80 90-1
0
1
Am
plit
ud
e
x2(n)
0 10 20 30 40 50 60 70 80 90-1
0
1
Am
plit
ud
e
x3(n)
Periodicity of sequence )8
sin( n
)103sin( n
)4.0sin( n
The Discrete-Time Signal: Sequencesns
Complex-valued exponential sequence
nenx nj ,)( )( 0
)()(
sincos)( 00
njxnx
njenenx
imre
nn
Attenuation factor
njenx
)85
1(2)(
66
0 5 10 15 20 25 30 35-0.5
0
0.5
1
1.5
2
n
Am
plit
ud
e
real part
0 5 10 15 20 25 30 35-0.5
0
0.5
1
1.5
n
Am
plit
ud
e
imaginary part
Complex-valued exponential sequence
nje
)85
1(2
The Discrete-Time System
A discrete-time system processes a given input sequence x(n) to generate an output sequence y(n) with more desirable properties.Mathematically, an operation T [ • ] is used.
y(n) = T [ x(n) ]
x(n): excitation, input signal
y(n): response, output signal
Introduction
68
Example: Accumulator
The input-output relation can also be written in the form:
This form is used for a causal input sequence, in which case y(-1) is called the initial condition
)()1()()()()(1
nxnynxlxlxnyn
l
n
l
0 ,)()1()()()(00
1
nlxylxlxny
n
l
n
ll
The output at time instant n is the sum of the input sample at time instant n and the previous output at time instant n-1, which is the sum of all previous input sample values from to n-1
)(ny)(nx
)1( ny
The Discrete-Time System
Classification
Linear System
Time-Invariant (Shift-Invariant) System
Linear Time-Invariant (LTI) System
Causal System
Stable System
Memory System
70
The Discrete-Time System
Linear System
A system is called linear if it has two mathematical properties: homogeneity and additivity.
)]([)]([)]()([ 2121 nxTnxTnxnxT
)]([)]([ nxaTnaxT
)]([)]([)]()([ 22112211 nxTanxTanxanxaT
Accumulator
71
The Discrete-Time System
Time-Invariant (Shift-Invariant) System
)()]([ then
)()]([ if
00 nnynnxT
nynxT
Accumulator
72
The Discrete-Time System
Linear Time-Invariant (LTI) System
A system satisfying both the linearity and the time-invariance properties is called an LTI system.
LTI systems are mathematically easy to analyze and characterize, and consequently, easy to design.
73
The Discrete-Time System
The output of an LTI system is called
linear convolution sum
)(*)()()()]([)( nhnxknhkxnxLTInyk
An LTI system is completely characterized in the time domain by the impulse response h(n).
74
0 5 10 15 20 25 30 35 40 45 500
0.5
1
1.5
Am
plit
ud
e
x(n)
0 5 10 15 20 25 30 35 40 45 500
0.5
1
1.5
Am
plit
ud
e
h(n)
0 5 10 15 20 25 30 35 40 45 500
5
10
Am
plit
ud
e
y(n)
return
)(9.0)( nunh n
)()( 10 nRnx
)()()( nhnxny
The Discrete-Time System
Causal System
For a causal system, changes in output samples do not precede changes in the input samples.
In a causal system, the -th output sample
depends only on input samples for
and does not depend on input samples for
0n)(nx 0nn
0nn
)2()1()()( 321 nxanxanxanye.g.
76
The Discrete-Time System
An LTI system will be a causal system if and only if :
0,0)( nnh
An ideal low-pass filter is not a causal system !
0,0)( nnx
A sequence is called a causal sequence if :
)(nx
77
The Discrete-Time System
Stable System
A system is said to be bounded-input bounded-
output (BIBO) stable if every bounded input
produces a bounded output, i.e.
PnyMnx )( then ,)( if
An LTI system will be a stable system if and only if :
n
nhS )(
78
The Discrete-Time System
Memory: A system is memoryless if y[n] = f ( x[n]
)▪ i.e. it sees only present values.
A system has memory if y [n] depends on previous values ▪ it can also depend on present and future
values!
79
Consider the DT SISO system:
If the input signal is and the system has no energy at , the output is called the impulse response of the system
DT Unit-Impulse ResponseDT Unit-Impulse Response
[ ]y n[ ]x n
[ ]h n[ ]n
[ ] [ ]x n n[ ] [ ]y n h n
System
System
0n
80
Consider the DT system described by
Its impulse response can be found to be
ExampleExample
[ ] [ 1] [ ]y n ay n bx n
( ) , 0,1,2,[ ]
0, 1, 2, 3,
na b nh n
n
81
Linear Time-Invariant Systems and Convolution
82
Linear Time-Invariant Systems and Convolution
83
Linear Time-Invariant Systems and Convolution
84
Linear Time-Invariant Systems and Convolution
85
Linear Time-Invariant Systems and Convolution
86
Linear Time-Invariant Systems and Convolution
87
Correlation
Correlation addresses the question: “to what degree is signal A similar to signal B.”
An intuitive answer can be developed by comparing deterministic signals with stochastic signals. Deterministic = a predictable signal equivalent
to that produced by a mathematical function Stochastic = an unpredictable signal equivalent
to that produced by a random process
88
Correlation
Correlation is maximum when Two signals are similar in shape And are in phase (or unshifted)
Correlation is measure of similarity between two signals as a function of time shift between them
89
Correlation functions shows how similar two signals are, and how long they remain similar when one is shifted with respect to the other
Correlation
90
Autocorrelation
Correlating a signal with itself
91
Autocorrelation
Autocorrelation can be used to extract a signal from noise
92
Autocorrelation to locate a signal
Cross correlation can be used to detect and locate known reference signal in noise
93
Xcorrelation to identify a signal
Cross correlation can be used to identify a signal by comparison with a library of known reference signal
94
Convolution and Correlation
R[n]= x[k]y[n+k] Vs. C[n] = x[k]y[n-k]
95
Convolution and Correlation
If one signal is symmetric, convolution and correlation are identical
96
Thanks for your attention
97