Digital Signal
Processing
Naqib Sad Pathan
Assistant Professor
Department of Electrical and Electronic Engineering
Chittagong University of Engineering and Technology
Reference Books
Authors: Alan V.
Oppenheim and others
Chapter 2 : Discrete Time Signals and
Systems
Three most important
topics in this chapter:
1. Causality of a system
2.Convolution operation
3. Convolutional
properties of unit sample
function(δ[n]).
What is Signal?
Signal is a physical quantities that varies with time or other independent
variables.
A signal is a function that conveys information about a
phenomenon.
Example: Examples of signals include as temperature over time or
space, sound (speech, music, etc) over time, images over space, etc.
A signal carries information and contains energy.
Analog vs Digital Signal
Analog Signal Digital Signal
Continuous Time (CT) vs Discrete Time
(DT) Signal
CT Signal DT Signal
Example of Signals
CT- Analog CT- Digital
Signal Signal
DT- Analog DT-Digital
Signal Signal
A/D convertion
Sampling
Quantization
Encoding
Sampling Rate and
Nyquist Sampling
Theorem
The Nyquist Sampling Theorem states that:
A bandlimited continuous-time signal can be sampled and perfectly
reconstructed from its samples if the waveform is sampled over twice as
fast as it's highest frequency component.
Nyquist limit:
the highest frequency component that can be accurately represented:
Sampling Rate and
Nyquist Theorem
Nyquist frequency: sampling rate required to accurately represent up
to :
No information is lost if sampling above
No information is gained by sampling much faster than
Sampling Rate and Nyquist
Theorem: Sampling at Nyquist rate
Sampling Rate and
Nyquist Theorem:
Oversampled
Sampling Rate and Nyquist
Theorem: Under-Sampled
Sampling Rate and Nyquist Theorem:
Special case when Nyquist theorem fails
Digital to
Analog
Conversion
by
Reconstruction
Filter
These steps will be
revisited after studying
frequency domain
analysis of signals
Representation of Digital/
Discrete time signal
Functional and Graphical
Representation
For Signal 1,
For Signal 2,
Functional representation
Graphical representation
Tabular and Sequence Representation
Tabular and Sequence Representation
Basic Sequences: Unit sample
Sequence
Basic Sequences: Unit sample Sequence
[n]
2
seq
x[n]= [n]
0
-1
-3 -2 -1 0 1 2 3
Time, t (ms)
[n-1] [n-2]
2 2
seq seq
x[n]= [n-2]
1
x[n]= [n-1]
0 0
-1 -1
-2 -1 0 1 2 3 4 -1 0 1 2 3 4 5
Time, t (ms) Time, t (ms)
Basic Sequences: Unit sample Sequence
[n]
2
seq
x[n]= [n]
0
-1
-3 -2 -1 0 1 2 3
Time, t (ms)
[n+1] [n+2]
2 2
seq seq
x[n]= [n+1]
x[n]= [n+2]
1 1
0 0
-1 -1
-4 -3 -2 -1 0 1 2 -4 -2 0 2
Time, t (ms)
Basic Sequences: Unit Step
Sequence
Basic Sequences: Other
representation of u[n] and δ[n]
Basic Sequences: Some other common sequences
Power signal vs Energy signal
Power signal or Energy signal ?
Periodic signal vs Aperiodic signal
Discrete-Time System
Example Discrete-Time System
Example Discrete-Time System
Example Discrete-Time System
Example Discrete-Time System
Example Discrete-Time System
Linear or Non-linear?
Example Discrete-Time System
Example Discrete-Time System
Time variant
Systems:
Upsampling/downsampling
System.
See later
Causality
Stability
FIR and IIR System : Definition
FIR System: If Output of a system depends on current and past input only then that system is called FIR system.
Example y[n]=x[n]-x[n-1]
y[n]={x[n]}^2
IIR System: If Output of a system depends on past output then that system is called IIR system.
Example y[n]=y[n-1]+x[n]
Example of an FIR system
We can consider every system as a filtering
operation.
Putting, x[n]=δ[n] we get,
h[n]= δ[n] - δ[n-1]
Here, h[n] has only two values. So this is an FIR
filter
Example of an FIR system
We can consider every system as a filtering operation.
x[n]=[1 2 -2 3]
h[n]= δ[n] - δ[n-1]
find
x[-n+3]= δ[(n-3)] +2δ[(n-2)]- 2δ[(n-1)]+3 δ[n]
Calculate y[n]=x[-n+3]*h[n]
Example of an IIR system
Putting, x[n]=δ[n] we get,
T=y[n-1]+x[n]
Putting, x[n]=δ[n] we get,
h[n]= h[n-1] +δ[n]
Example of an IIR system
h[n]= h[n-1] +δ[n] =h[n-2]+ δ[n-1] +δ[n]=h[n-3]+ δ[n-2] +δ[n-1] +δ[n]
h[n-1]=h[n-2]+δ[n-1]
h[n-2]=h[n-3]+ δ[n-2]
X(t)=sinwt+sin2wt
I/O Relationship of an LTI System
Output of an LTI system
can be described as,
y[n]=x[n]*h[n]
Where h[n] is the
response of the system
I/O Relationship of an LTI System
Output of an LTI system
can be described as,
y[n]=x[n]*h[n]
Where h[n] is the
response of the system
What is response?
What is convolution?
And most importantly,
why convolution?
Response of a system h[n]
Consider a system, y[n]=x[n]-x[n-1]
Response of a system can be found by setting input, x[n]= δ[n].
Then,
y[n]= δ[n]*h[n]=h[n]
[n]
2
seq
1 y[0]=x[0]-x[-1]=δ[0]-δ[-1]=1
x[n]= [n]
0 y[1]=x[1]-x[0]= δ[1]-δ[0]=-1
-1
-3 -2 -1 0 1 2 3
Time, t (ms)
Response of a system h[n]
Consider a system, y[n]=x[n]-x[n-1]
Response of a system is defined by setting,
x[n]= δ[n]
y[-1]=x[-1]-x[-2]=δ[-1]-δ[-2]=0
y[0]=x[0]-x[-1]=δ[0]-δ[-1]=1
y[1]=x[1]-x[0]= δ[1]-δ[0]=-1
y[2]=x[2]-x[1]= δ[2]-δ[1]=0
y[n]=h[n]= […..0,1,-1,0,0,0……]
Response of a system h[n]
y[-1]=x[-1]-x[-2]=δ[-1]-δ[-2]=0
y[0]=x[0]-x[-1]=δ[0]-δ[-1]=1
y[1]=x[1]-x[0]=δ δ[1]-δ[0]=-1
y[2]=x[2]-x[1]= δ[2]-δ[1]=0
y[n]=h[n]= […..0,1,-1,0,0,0……]
h[n]= δ[n]- δ[n-1]
Response of a system h[n]
So we know response, h[n]= δ[n]- δ[n-1]
Consider, x[n]=[….2,3,-2,0,0,0….].
Then x[n]=2 δ[n+1]+3δ[n]-2δ[n-1]
Using the property of linearity,
y[n]=2 h[n+1]+3h[n]-2h[n-1]
=2(δ[n+1]- δ[n])+3(δ[n]- δ[n-1])-2(δ[n-1]-
δ[n-2])=………………………………..
Response of a system h[n]
So for, x[n]=[….0,0,2,3,-2,0,0,0….].
y[n]=[…0,2,1,-5,2,0]
Response of a Moving average system
x[n]=[….0,0,2,3,-2,0,0,0….].
x[n]=2 δ[n+1]+3δ[n]-2δ[n-1]
h[n]=δ[n]+δ[n-1]
Find y[n].
Response of a Moving average system
x[n]=[….0,0,2,3,-2,0,0,0….].
x[n]=2 δ[n+1]+3δ[n]-2δ[n-1]
h[n]= (1/3)⤫(δ[n+1] +δ[n]+δ[n-1])
Find y[n].
Comments on the property of system from
h[n]
• Causality
• Stability
• Memory/memoryless
• Time variance
Example:
h1[n]=δ[n]-δ[n-1]
h2[n]=δ[n+1]-δ[n-1]
h3[n]=nδ[n]
h4[n]= (accumulator system)
Properties of δ[n]
δ[n] is an even function:
δ[n] = δ[-n]
Convolution Properties:
x[n]*δ[n] = x[n]
The output of a system with response δ[n] is
same as input.
Properties of δ[n]
Convolution Properties:
x[n]*δ[n- nd] = x[n- nd]
x[n-nd1]* δ[n- nd2]= x[n- (nd1+nd2)]
y[n]= x[n] * h[n]
Multiplication with δ[n]:
x[n] δ[n]=x[0] δ[n]
x[n] δ[n- 1] = x[1] δ[n- nd]
Properties of δ[n]
Convolution Properties:
δ[n]*δ[n- nd] = δ[n- nd]
δ[n-nd1]* δ[n- nd2]= δ[n- (nd1+nd2)]
Examples:
δ[n]* δ[n]= δ[n]
δ[n]* δ[-n]= δ[n]* δ[n]=δ[n]
δ[n]* δ[n-3]= δ[n-3]
δ[n-1]* δ[n-3]= δ[n-4]
Properties of δ[n]
Examples:
δ[n+1]* δ[n]= δ[n+1]
δ[n+1]* δ[n-3]= δ[n-2]
δ[n+3]* δ[n-2]= δ[n+1]
δ[n+3]* δ[n+2]= δ[n+5]
Properties of δ[n]
Examples:
δ[n+1]* δ[-n]= δ[n+1]
δ[n+1]* δ[-n-3]= δ[n+1]* δ[-(n+3)]=
δ[n+1]* δ[n+3]= δ[n+4]
Properties of δ[n]
Exercise:
Given that, x1[n]=δ[n+1]-2δ[n]+3δ[n-1]
And
x2[n]=-2δ[n+1]+δ[n]+2δ[n-1]
Plot x1[n] and x2[n] and then
Find y[n]= x1[n]*x2[n]
Exercise of Convolution
x1[n]
3
-1
-2
-1 -0.8 -0.6 -0.4 -0.2 0 0.2 0.4 0.6 0.8 1
x2[n]
2
-1
-2
-1 -0.8 -0.6 -0.4 -0.2 0 0.2 0.4 0.6 0.8 1
Exercise of Convolution
y[n]= x1[n]*x2[n] =
( δ[n+1] -2δ[n] + 3δ[n-1] ) *
( -2δ[n+1] + δ[n] + 2δ[n-1] )=
δ[n+1]* -2δ[n+1] + δ[n+1]* δ[n]+ δ[n+1]*2δ[n-1]
-2δ[n]* -2δ[n+1] -2δ[n]* δ[n]-2δ[n]* 2δ[n-1] +
3δ[n-1]* -2δ[n+1] + 3δ[n-1]* δ[n] + 3δ[n-1]*
2δ[n-1]
Exercise of Convolution
y[n]= x1[n]*x2[n] =
-2 δ[n+2] +5 δ[n+1] -6 δ[n] - δ[n-1] +6 δ[n-1]
y[n]=[-2 5 -6 -1 6]
Auto-correlation
Auto-correlation of a sequence x[n] is defined as
r[n]= x[n]*x[-n]
where x[-n] is time reversal of x[n].
Exercise of Time Reversal
Exercise:
Given that, x[n]=δ[n+1]-2δ[n]+3δ[n-1]
Find x[-n].
Exercise of Time Reversal
x[n]
4
-2
-1 -0.8 -0.6 -0.4 -0.2 0 0.2 0.4 0.6 0.8 1
Time reversal of x[n]: x[-n]
4
-2
-1 -0.8 -0.6 -0.4 -0.2 0 0.2 0.4 0.6 0.8 1
Exercise of Time Reversal
x[n]= δ[n+1]-2δ[n]+3δ[n-1]
Putting n=-n we get,
x[-n]=δ[-n+1]-2δ[-n]+3δ[-n-1]
=δ[-(n-1)]-2δ[-(n)]+3δ[-(n+1)]
=δ[n-1]-2δ[n]+3δ[n+1]
=3δ[n+1]- 2δ[n]+ δ[n-1]
Exercise of Autocorrelation
Exercise:
Given that, x[n]=δ[n+1]-2δ[n]+3δ[n-1]
Find r[n]=x[n]*x[-n].
Exercise of Autocorrelation
r[n]=x[n]*x[-n]=
( δ[n+1]-2δ[n]+3δ[n-1] )* (3δ[n+1]- 2δ[n]+ δ[n-1])
Please calculate it.
Exercise of Autocorrelation
r[n]=x[n]*x[-n]=
( δ[n+1]-2δ[n]+3δ[n-1] )* (3δ[n+1]- 2δ[n]+ δ[n-1])
Please calculate it.
R[n]=[3 -8 14 -8 3]
Topics Covered yet
• Representation of DT sequence
• Systems
• Different representation of systems
• Response of a system
• Types of system from response
• Convolution
• Convolution of two sequence with unit sample sequence
• Autocorrelation
Extend of Convolution
• Sequence 1: n1:n2
• Sequence 2: n3:n4
• Convolution???
Extend of Convolution
• Sequence 1: n1:n2
• Sequence 2: n3:n4
• Convolution (n1+n3): (n2+n4)
Cross-correlation
Cross-correlation of two sequences x1[n] and
x2[n] is defined as
c[n]= x1[n]*x2[-n]
where x2[-n] is time reversal of x2[n].
Exercise of Cross-correlation
Exercise:
Given that, x1[n]=δ[n+1]-2δ[n]+3δ[n-1]
And
x2[n]=-2δ[n+1]+δ[n]+2δ[n-1]
Find c[n]= x1[n]*x2[-n]
Exercise of Cross-correlation
Exercise:
Given that, x1[n]=δ[n+1]-2δ[n]+3δ[n-1]
And
x2[n]=-2δ[n+1]+δ[n]+2δ[n-1]
Find c[n]= x1[n]*x2[-n]
C[n]=[2 -3 2 7 -6]
Extend of Correlation
• Sequence 1: n1:n2
• Sequence 2: n3:n4
• Correlation???
Extend of Covolution
• Sequence 1: n1:n2
• Sequence 2: n3:n4
• Correlation??? (n1-n4): (n2-n3)
Noise-free transmitted signal
Transmitted signal
Transmitted signal 1
1 sig
0.5
Voltage, V (V)
0.5
Voltage, V (V)
0 0
-0.5 -0.5
-1
0 1 2 3 4 -1
Time, t (ms)
0 1 2 3 4
Time, t (ms)
Continuous- time signal Discrete- time signal
Noise-free Received signal
Recieved signal with delay
1
sig
0.5
Voltage, V (V)
-0.5
-1
0 100 200 300 400 500
Time, t (ms)
Received Power in antenna and Definition of dB
-2= log(Psig/Pnoise)
Psig/Pnoise=10^-2
100*Psig=Pnoise
Noisy and Attenuated Received signal
Attenuated and Noise corrupted Recieved signal with delay Attenuated and Noise corrupted Recieved signal with delay
0.1
sig sig
0.04
Voltage, V (V)
0.05
Voltage, V (V)
0.02
0
0
-0.02
-0.04 SNR=20
-0.05 SNR=10
-0.06
0 100 200 300 400 500
-0.1
Time, t (ms) 0 100 200 300 400 500
Time, t (ms)
Attenuated and Noise corrupted Recieved signal with delay
0.1 Attenuated and Noise corrupted Recieved signal with delay
sig 0.2
sig
0.05
Voltage, V (V)
0.1
Voltage, V (V)
0
0
-0.05
-0.1 SNR=5 -0.1
SNR=0
0 100 200 300 400 500
-0.2
Time, t (ms) 0 100 200 300 400 500
Theory of Auto correlation
Suppose, transmitted signal is x[n].
Then Received Signal, y[n]=x[n]+w[n]
Where w[n] is the additive white Gaussian noise or completely random noise with all possible
frequency.
Now Auto correlation of y[n] can be defined as,
Ryy[n]= y[n] * y[-n] =
(x[n]+w[n])*(x[-n]+w[-n]) = x[n]* x[-n] + x[n]* w[-n] +w[n]* x[-n] + w[n] * w[-n]
=Rxx[n] +Rxw[n] +Rwx[n] +Rww[n]
=Rxx[n] + Rww[0]
Because, from the definition of random signal, it has no correlation with other signals and
In case of autocorrelation of random signal it has value at only zeroth lag.
So Ryy[n]= Rxx[n] + W δ[0]
where W is a constant.
Notes : Autocorrelation always preserves the frequency components of a signal
Auto-correlated Received signal
Attenuated and Noise corrupted Recieved signal with delay
SNR=20
sig
0.04
Voltage, V (V)
0.02
250
0
200
-0.02
150
-0.04
100
-0.06
0 100 200 300 400 500 50
Time, t (ms) 0
-50
-100
-150
-200
-500 -400 -300 -200 -100 0 100 200 300 400 500
Auto-correlated Received signal
Attenuated and Noise corrupted Recieved signal with delay SNR=10
0.1
sig
0.05
Voltage, V (V)
0
300
-0.05 250
200
-0.1
0 100 200 300 400 500 150
Time, t (ms) 100
50
-50
-100
-150
-200
-500 -400 -300 -200 -100 0 100 200 300 400 500
Auto-correlated Received signal
SNR=5
Attenuated and Noise corrupted Recieved signal with delay
0.1
sig
0.05
Voltage, V (V)
-0.05 400
-0.1
300
0 100 200 300 400 500
Time, t (ms) 200
100
-100
-200
-500 -400 -300 -200 -100 0 100 200 300 400 500
Auto-correlated Received signal
SNR=0
Attenuated and Noise corrupted Recieved signal with delay
0.2
sig
0.1
Voltage, V (V)
0
700
-0.1 600
500
-0.2
0 100 200 300 400 500 400
Time, t (ms)
300
200
100
-100
-200
-500 -400 -300 -200 -100 0 100 200 300 400 500
Auto-correlated Received signal
SNR=-10 and -20
6000
5000
4000
3000
104
5
2000
1000 4
0
3
-1000
-500 -400 -300 -200 -100 0 100 200 300 400 500 2
-1
-500 -400 -300 -200 -100 0 100 200 300 400 500
Theory of Cross-correlation
Suppose, transmitted signal is x[n].
Then Received Signal, y[n]=x[n]+w[n]
Now cross correlation of y[n] with x[n] can be defined as,
Ryy[n]= y[n] * x[-n] =
(x[n]+w[n])*x[-n] =
x[n]* x[-n] + w[n] * x[-n]
=Rxx[n]+Rwx[n]
=Rxx[n]
Cross-correlated Received signal
Attenuated and Noise corrupted Recieved signal with delay
SNR=20
sig
0.04
Voltage, V (V)
0.02
0
-0.02
-0.04 200
-0.06 150
0 100 200 300 400 500
Time, t (ms) 100
50
-50
-100
-150
-200
-500 -400 -300 -200 -100 0 100 200 300 400 500
Cross-correlated Received signal
Attenuated and Noise corrupted Recieved signal with delay SNR=10
0.1
sig
0.05
Voltage, V (V)
250
-0.05
200
-0.1 150
0 100 200 300 400 500
100
Time, t (ms)
50
-50
-100
-150
-200
-500 -400 -300 -200 -100 0 100 200 300 400 500
Cross-correlated Received signal
Attenuated and Noise corrupted Recieved signal with delay
SNR=5
0.1
sig
0.05
Voltage, V (V)
-0.05
200
-0.1
150
0 100 200 300 400 500
100
Time, t (ms)
50
-50
-100
-150
-200
-500 -400 -300 -200 -100 0 100 200 300 400 500
Cross-correlated Received signal
SNR=0
Attenuated and Noise corrupted Recieved signal with delay
0.2
sig
0.1
Voltage, V (V)
0
200
-0.1
150
-0.2
0 100 200 300 400 500 100
Time, t (ms) 50
-50
-100
-150
-200
-500 -400 -300 -200 -100 0 100 200 300 400 500
Auto-correlated Received signal
250 SNR=-10 and -20
200
150
100
50
-50
-100 150
-150
100
-200
-250 50
-500 -400 -300 -200 -100 0 100 200 300 400 500
-50
-100
-150
-200
-500 -400 -300 -200 -100 0 100 200 300 400 500