Signal Processing I
Discrete Time Signals and
Systems Lecture
1
Lecture Outline
• In this lecture, we’ll study the following
– Analogue to digital conversion
• Sampling, quantisation, coding, aliasing
– Basic operations of systems
2
Analogue to digital conversion
• Most real world recorded signals are analogue signals
• To process analogue signals by digital means (like using a PC), we need to convert
them to digital form
• I.e. to convert them to a sequence of numbers having finite precision
• This process is known as analogue to digital (A/D) conversion, which involves
• i) Sampling
• ii) Quantisation
• iii) Coding
Analogue to digital converter
x[n]
x(t) 0 1 0 11 .....
Sampler Quantiser Coder
Analogue signal Discrete-time signal Quantised signal Digital signal
3
The Sampling Process
• Often, a discrete time sequence x[n] is developed by uniformly sampling
an analogue signal x(t) as indicated below
• I.e. conversion of a continuous-time, continuous amplitude signal into
discrete-time signal (i.e. continuous-amplitude, discrete-time)
• Done by taking samples at specific uniform intervals of time
• The sampling interval is the time of one of these uniform intervals
• Sampling frequency is the number of uniform time intervals in one second
• The relation between the two signals are
Discrete-time Analogue signal
signal
4
Aliasing
• Aliasing
• Aliasing causes ambiguities in reconstruction, i.e. distorts the sampled
signal
• To avoid aliasing, the sampling frequency has to be more than twice of
the highest frequency contained in x(t)
• This is known as Nyquist theorem and the minimum frequency known
as Nyquist frequency(rate)
5
Aliasing problem – an example
• Consider the following sampling of analogue signal
Discrete-time
Analogue signal
signal
t t t
Sampling with high enough frequency – the signal is faithfully represented
Discrete-time
Longer interval sampling
signal
t t
Aliasing problem – effects of low sampling frequency
6
Aliasing demo – an example
• (from S.K.Mitra, DSP 3rd ed)
• The phenomenon of aliasing happens when the sampling frequency is less than twice
the highest frequency of the input signal
• In this example, the input signal is a sinusoidal signal of frequency 1.8KHz
• Three output sound signals are generated using sampling rates of 8KHz, 4KHz and
2.6667KHz
• Among these three outputs, aliasing arises only at sampling frequency of 2.6667KHz,
which is less than twice of the highest input frequency of 3.6KHz
• Tone Frequency = 1800Hz, Sampling Frequency = 8000Hz:
• Tone Frequency = 1800Hz, Sampling Frequency = 6000Hz:
• Tone Frequency = 1800Hz, Sampling Frequency = 2666.6667Hz:
7
Example – Nyquist rate computation
• Consider the analogue signal
• x(t)=3 cos 50t + 10 sin 300 t – cos 100 t
• What is the Nyquist frequency (rate) to sample this signal?
Answer
• Use the generic term, A cos 2ft (or A sin 2ft) to compute the
frequencies present in the signal => which are 25 Hz, 150 Hz and
50 Hz
• So, Nyquist frequency is 2* highest frequency= 2*150 Hz=300 Hz
• In practise, we normally sample at a much higher rate than
Nyquist frequency
8
Quantisation and coding
• Quantisation
– This is the conversion of discrete-time continuous amplitude
signal (after sampling) into discrete-time discrete amplitude
signal
• Quantisation levels
– The value of each sample is represented by a value selected
from a finite set of possible values
– Quantisation width= (xmax-xmin)/(No of levels -1)
– Quantisation error is the error in the quantisation process by
rounding to the nearest level
• Coding
– In the coding process, each discrete value is represented by a
certain number of bits
– Relationship between bits and levels: 2number of bits no of levels
9
Example of performing quantisation and coding
Example of quantisation and coding
• Eg: Assume after sampling, we have a sample, x(5)=1.66 volts
• Assume 9 levels are used to represent amplitude values of 0 V (min)
to 2 V (max)
• Quantisation width= (xmax-xmin)/(No of levels -1) =0.25 V
• The possible quantised values are 0, 0.25, 0.5, 0.75, 1.00, 1.25,
1.50, 1.75, 2.00
• So, x(5) =1.75 volts (rounded to nearest level) = 7th quantised level
• 2number of bits no of levels, so we need at least 4 bits
• After coding, it is 0111
10
Quantisation error
• Quantisation error
• 1.66 V is represented as 1.75 V, so there is an error of 0.09 V, this is
the quantisation error
• This error can be reduced by using more bits in coding thereby
increasing the number of quantisation levels
• In some hardware, the quantisation is done to the nearest lower level
(i.e. truncation), so it would 1.50 instead of 1.75
• But for the purpose of this course, we will round to the nearest level
11
Quantisation and coding – further example
• For the same example in the previous slide, what would be
the code and quantisation error if 17 levels were used?
– 17 levels in the range 0 V (min) to 2 V (max)
– Quantisation width= (xmax-xmin)/(No of levels -1) =0.125 V
– The possible quantised values are 0, 0.125, 0.25, 0.375, 0.5, 0.625,
0.75, 0.875, 1.00, 1.125, 1.25, 1.375, 1.50, 1.625, 1.75, 1.875, 2.00
– So, x(5) =1.625 volts (rounded to nearest level) = 13th quantised
level
– 2number of bits no of levels, so we need at least 5 bits
– After coding, it is 01101
• Quantisation error
– 1.66 V is represented as 1.625 V, so there is an error of 0.035 V, this
is the quantisation error
– This error is reduced by the increase of bits/quantisation levels
12
Sequences
• Sometimes, a discrete-time signal is known as a sequence and
vice versa
• A discrete-time signal may be a finite length or an infinite-length
sequence
• Eg: x[n]=3+4n3, -5n 4 is a finite length sequence with
length 4-(-5)+1=10
• x[n]=sin(0.1n) is an infinite-length sequence
• An N length sequence can be increased by padding with zeros
• Eg: length 3 changed to length 5
x[n] n 3 , 1 n 4
n3, 1 n 4
x pad [n ] {
0, 4 n 5
13
Discrete-time systems
• Discrete-time systems operates on an input sequence, according
to some prescribed transfer function and produces another output
sequence
x[n] Discrete time system y[n]
• Example, the input sequence could be a noisy ECG signal and the
system outputs a noise reduced ECG signal
Real ECG signal from MGH database Real ECG signal from MGH database (after noise reduction)
1.2 0.5
1 0.4
0.3
Amplitude (arbitrary units)
0.8
0.2
Amplitude (microV)
0.6
0.1
0.4
0.2
Discrete time system 0
-0.1
0 -0.2
-0.2 -0.3
-0.4
-0.4 0 100 200 300 400 500 600 700
0 100 200 300 400 500 600 700 Sampling points
Sampling points
• In this case, the discrete-time system is a band-pass filter
• There are some classifications and basic operations for discrete-
time systems, which we will study next
14
Basic system operations
• Product (modulation) This is the system!
• y[n]=x[n].w[n] modulator
x[n] X y[n]
w[n]
• Normally used in windowing – where a discrete time finite signal is
obtained from a discrete time infinite signal
• Addition
• y[n]=x[n] + w[n] adder
x[n] + y[n]
w[n]
• Multiplication
• y[n]=A.x[n]
multiplier
x[n] A y[n]
15
Basic system operations (cont.)
• Time reversal (folding)
• y[n]=x[-n]
• Important operation in filtering/convolution
• Arrow points to n=0
• Branching x[n] x[n]
• Used to provide multiple copies of the signal
x[n]
• Time shifting
z-N
• y[n]=x[n-N] (delay) x[n] y[n]
• y[n]=x[n+N] (advance) x[n] zN y[n]
16
Basic system operations (cont.)
• Time scaling (downsampling/upsampling)
• Downsampling, y[n]=x[nM]
• In downsampling, every Mth sample of the input sequence is kept and
M-1 in between samples are removed
• No. of samples is reduced
• Eg: y[n]=x[3n]
Figure from S.K.Mitra, DSP 3rd ed.
17
Basic system operations (cont.)
• Upsampling, y[n]=x[n/N]
• In upsampling, N-1 equidistant zero-values samples are inserted by
the upsampler between each consecutive samples of the input
sequence
• No. of samples is increased
• Eg: y[n]=x[n/3]
Figure from S.K.Mitra, DSP 3rd ed.
18
Combination of basic operations
• Often, a system includes a combination of operations
• Example - figure shows a discrete time system block diagram
19
Example – sequence computation
• For the following sequences, defined for 0 n 4 (length=5),
• a[n]={3 4 6 -9 0}
• b[n]={2 -1 4 5 -3}
• obtain the new sequences
• c[n]={a[n].b[n]}
• d[n]={a[n]+b[n]}
• e[n]=1.5{a[n]}
• Ans
• c[n]={6 -4 24 -45 0}
• d[n]={5 3 10 -4 -3}
• e[n]={4.5 6 9 -13.5 0}
• These are easy as both a[n] and b[n] have same length. What if
their lengths differ?
20
Example – differing sequence lengths
• If the lengths of sequences differ, then pad with zeros (in front or end or
in between) to obtain same length sequences and same defined ranges
BEFORE applying the operations
• Example, for the following sequence
• f[n]={-2 1 -3} defined for 0 n 2
• what would be g[n]=a[n]+f[n]?
• Hint: f[n] has length 3, while a[n] has length five, so pad f[n] with 2 zeros
• Sometimes, making a table will make it easier
• Answer
• a[n]={3 4 6 -9 0} defined for 0 n 4
• fpad[n]={-2 1 -3 0 0} defined for 0 n 4
• f[n] is padded with 2 zeros at the end as to make the defined ranges of
a[n] and fpad[n] equal.
• So, g[n]={1 5 3 -9 0}
21
Advanced example
• Consider the following sequences:
• x[n]={-4 5 1 -2 -3 0 2}, -3 n 3
• y[n]={6 -3 -1 0 8 7 -2}, -1 n 5 Answer
• w[n]={3 2 2 -1 0 -2 5}, 2 n 8 c[n]={2 0 -3 -2 1 5 -4}
• The sample values of each of the above d[n]={-2 7 8 0 -1 -3 6 0 0}
sequences outside ranges specified are all
zeros. Generate the following sequences e[n]={5 -2 0 -1 2 2 3 0 0}
(put an arrow at n=0):
u[n]={-4 5 1 -2 3 -3 1 0 8 7 -2}
• (a) c[n]=x[-n+2]
• (b) d[n]=y[-n-3]
• (c) e[n]=w[-n]
Continued in next slide
• (d) u[n]=x[n]+y[n-2]
• Hint: x(n+k) signal moves k
• x(n-k) signal moves k
• x(-n+k) signal moves k
• x(-n-k) signal moves k
22
Solution
• Prepare tables
• Min range, n=-3
• Max range, n=8
(a) c[n]=x[-n+2]
(b) d[n]=y[-n-3]
(c) e[n]=w[-n]
(d) u[n]=x[n]+y[n-2]
23
Study guide
• From this lecture, you should know
– A/D
– Sampling, quantisation, coding procedures
– Nyquist theorem
– Basic system operations
– Computation of combined sequence operations
– Obtaining output sequence given a discrete-time system block
diagram and vice versa
End of lecture
24