Chapter2 PDF
Chapter2 PDF
Chapter 2 25
Chapter 2: Digital Signal Processing
Fundamentals
2.1 Introduction
Digital Signal Processing (DSP) is a rapidly developing
technology for scientists and engineers. In the 1990s the digital
signal processing revolution started, both in terms of the
consumer boom in digital audio, digital telecommunications and
the wide used of technology in industry.
Chapter 2 26
video processing, seismic, radar and sonar processing and neural
computing.
Analogue signal
processor (e.g. low-
Analogue pass filter) Analogue
Input Signal Output Signal
s(t)
x(t) = s(t) + n(t)
signal noise
Chapter 2 27
analogue prefilter
or antialiasing filter analogue to digital
converter
dB 3 dB x[n] s[n] dB
x(t) s(t)
A/D Digital D/A
xa(t) Converter Signal converter
Processor
1 Digital to
fs analogue
T
discrete-time converter
Lowpass filtered signal reconstruction
fs signal filter (analogue
Sampling fs
2 filter) same as the
frequency 2 pre-filter
Note:
Chapter 2 28
2.3 Analogue to Digital Conversion Process
Before any DSP algorithm can be performed, the signal must be
in a digital form. The A/D conversion process involves the
following steps:
A/D converter
2B
xa(t) Logic circuit B bits
x[n]
1
Analogue Signal
(bandlimited)
close & open the digital
switch at fs Hz output
2.1.1.1.1.1.1 T
Figure 2.3: Analogue to digital conversion process
Chapter 2 29
Sample and hold (S/H) takes a snapshot of the analogue signal
every T sec and then holds that value constant for T secs until
the next snapshot is obtained.
xa(t)
Input signal
S/H output
1
fs
T
2.1.1.1.1.1.2 T t
Example:
Analogue
T = sampling Signal
period
12V x[n]
6V
0V
-6V Samples
-12V
n
Sampled Signal
Chapter 2 30
Example: 4-bit (B = 4) A/D converter (bipolar)
digital
5 0101
4 0100
3 0011
2 0010
1 0001
-1 1111 analogue
-2 1110
-3 1101
-4 1100
-5 1011
Chapter 2 31
6
Quantisation
Level 5
4
3
2
1
sampling instants
6
Quantisation 5
Level 3-bit A/D
4 Converter
3 (Unipolar)
2
1
3 bits code output
LSB 1 0 1 0 1
0 0 0 1 1
0 1 1 0 0
encoder output
12 bits -10V
Chapter 2 32
Note:
level n+1
Quantisation error = V (one
∆V 2
level n v ∆V/2
half of an LSB)
∆V/2
∆V = 4.9 mV / 2 = 2.45 mV
level n-1
sampling instant
V V
V B B
2 1 2
V-full scale range of the A/D converter with bipolar signal
inputs. The maximum quantisation error, for the case where the
V
values are rounded up or down .
2
For a sine wave input of amplitude A, the quantisation step size
becomes
2A A 2A
V
2B -A
e[ n] A Aq
actual amplitude quantized amplitude
Chapter 2 33
The probability density function of the error P(e) has the form as
shown below
1
1 P( e)
V V
V V
2 2
V 2
2
e for uniform quantisation
12
Chapter 2 34
(Note : Uniform quantisation - all steps are of equal size)
N N
1
x[ n]2
1
Pin
N n 1
and PN
N
e[ n]
n 1
2
V 2
or e
2
12
Pin
SQNR( dB ) 10 log
PN
N
x [ n]2
SQNR( dB ) 10 log n 1
N
e [ n]
n 1
2
Pin 12 Pin L2
SQNR( dB ) 10 log 10 log
( R / L) 2 R2
12
Chapter 2 35
Example:
A2
For the sine wave input, the average signal power is , i.e.
2
2
A rms value
2
A2 A2
SQNR 10 log 2 2 10 log 2
V
2 A / 2B
2
12 12
3 22B
10 log
2
Chapter 2 36
Example:
Consider the ramp x(t) = t over (0, 3). For a sampling interval
of 0.2s and number of levels, L = 6, the sampled signal,
quantized (by rounding) signal, and error signal are
x[n]={0, 0.2, 0.4, 0.6, 0.8, 1.0, 1.2, 1.4, 1.6, 1.8, 2.0, 2.2, 2.4, 2.6, 2.8, 3.0}
xQ[n] = {0, 0.0, 0.5, 0.5, 1.0, 1.0, 1.0, 1.5, 1.5, 2.0, 2.0, 2.0, 2.5, 2.5, 3.0, 3.0}
e[n] = {0, 0.2, -0.1, 0.1, -0.2, 0.0, 0.2, -0.1, 0.1, -0.2, 0.0, 0.2, -0.1, 0.1, -0.2, 0}
where {e[n]=x[n]-xQ[n]}
Method 1:
SQNRi 10 log
Pin
10 log
x 2 [ n]
10 log
49.6
22.2 dB
PN e [ n]
2
0.3
Method 2:
Method 3:
1 2
T
Pin x (t )dt 3
Chapter 2 37
2.5 Sampling of Analogue Signal
jt
Fourier Transform: X ( ) x (t ) e dt
1
X ( )e
jt
Inverse Fourier Transform: x(t ) d
2
xne
Discrete Time Fourier jn
Transform (DTFT): X ( )
n
xn
Inverse Discrete Time 1
jn
Fourier Transform X ( ) e d
(IDTFT): 2
1
x(t )
2
X ( )e jt d Inverse Fourier Transform
t=nT
xn
1
2
X ( )e jnT d (2.1)
Chapter 2 38
Now ejnT is a periodic function of period 2. Equation (2.1)
becomes
2 k
xn
1
2
k
2 k
X ( )e jnT d
1
1 2 j ( k 2T ) nT
2
k T
X ( k
T
)e dT
1 1 2 jnT
2 T k
X ( k
T
)e dT
Let T =
1 2 jn
xn
1
2
T X ( k T )e d … (2.2)
k
We have
xn
1
2
X ( ) e jn d … (2.3)
1 2
X ( ) X ( k ) - , (2.4)
T k T
Chapter 2 39
2.5.1 The Ideal Sampling Operation
1 2
fs or ws
T T
Chapter 2 40
2.6 Aliasing
Figure 2.7 illustrates the relationship between the digital
spectrum X() and the analogue spectrum X( ) for the case
X( ) = 0, or f f s .
T 2
Case 1: X( ) = 0, (sampling theorem holds)
T
X()
A Analogue spectrum
𝑓𝑠
2
X()
A/T Digital spectrum
fs
fs
2
Figure 2.7: Above: Frequency response of an analogue signal.
Below: Frequency response of the sampled analogue signal.
Note: corresponds to = (or f
fs
)
T 2
Chapter 2 41
3
Case 2: X( ) 0, , but X( ) = 0,
T 2T
X()
A
3 3
2T T T 2T
X()
A/T
3 3
-3 -2 - 2 3
2 2
aliasing
Chapter 2 42
This results in the familiar sampling theorem. The minimum
sampling frequency 1 for which equation
T
1 2
X ( )
T k
X ( k )
T
Aliasing Examples
f (kHz)
-4 -3 -2 2 3 4
|X()|
1/T
2
-2 -
f (kHz)
-3 -2 2 3
Chapter 2 43
Example: Consider the analogue signal
fs 2 f = 300 Hz
x[n]
xn 10 sin 300nT
300
10 sin n
n
fs
10 sin n
Chapter 2 44
xn 1 10 sin
n
Since cos(n) = (-1)n ,
f
x( n ) A cos 2 0 n (2.5)
fs
f f
s f0 s
2 2
f
xn A cos 2 k n
fs
( f kf s )
A cos 2 0 n
f s
f
A cos 2 0 n 2kn
fs
f
xn A cos 2 0 n (2.7)
fs
Chapter 2 45
which is identical to the discrete-time signal in equation (2.5). If
we are given a sequence x[n] there is an ambiguity as to which
continuous-time signal x(t) these values represent. We can say
the frequencies fk = f0+kfs are indistinguishable from the
frequency f0 after sampling and hence they are aliases of f0.
Note:
fs – sampling frequency
fs
corresponds to =
2
fs
is the highest frequency that can be represented uniquely
2
with a sampling rate fs
f2
is called half the sampling frequency or folding frequency.
2
f
T 2
fs
Chapter 2 46
(b) Assume now that we sample this signal x(t) using a
sampling rate fs = 5 kHz (samples/sec). What is the discrete-time
signal obtained after sampling?
First Method:
fs
fs = 5000Hz 2500
2
x(t) = 3cos(2 1000t) + 5sin(2 3000t) + 10cos(2 6000t)
1 2
xn 13 cos 2 n 5 sin 2 n
5 5
Second Method:
fs
f s 5kHz 2.5kHz
2
We have fk = f0 + kfs
Chapter 2 47
fs
The frequency f1 = 1000 Hz is (= 2500 Hz) and thus it is not
2
affected by aliasing.
However, the other two frequencies f2 & f3 are above the folding
frequency and they will be changed by the aliasing effect.
(c) What is the analogue signal y(t) we can reconstruct from the
samples if we use ideal interpolation.
Chapter 2 48
Example: An analogue signal x(t) = sin(480t)+3sin(720t) is
sampled 600 times per second.
Chapter 2 49
Second Method:
fs
f1 = 240 Hz and is (= 300 Hz) not affected by aliasing
2
f
f2 = 360 Hz and is s (= 300 Hz) affected by aliasing
2
Aliased frequency f0 = fk – k fs
= 360 – 1 600
= -240 Hz
240 240
xn sin 2 n 3 sin 2 n
600 600
4
2 sin n
5
240 n n
(d) y(n) 2 sin 2 n t nT
600 f s 600
y(t ) 2 sin480t
Chapter 2 50
Note: Fourier transform – analogue signal
e j1t e j1t
FT {cos(1t )} FT
2
1
2
1
FT e j1t FT e j1t
2
1 j1t jt 1 j1t jt
e e dt e e dt
2 2
1 j (1 ) t 1 j (1 )t
e dt e dt
2 2
dt 2 ( )
jt
e
2 (1 ) 2 (1 )
1 1
2 2
(1 ) (1 )
( 1 ) (1 )
( 1 ) ( 1 )
FT {cos(1t )} ( 1 ) ( 1 )
Chapter 2 51
Hence, Fourier transform of xa(t) is X a ( f ) ( f 500) ( f 500)
as shown below. Note that fmax = 500Hz < fs/2 = 2000Hz, so this
obeys the sampling theorem. Sampling produces copies
(aliases) of the analogue spectrum centred at multiples of 2 .
Chapter 2 52
An analogue signal x a (t ) e u(t ) is sampled.
at
Example:
Determine the resulting analogue and digital magnitude spectra.
1
Fourier transform tables gives us Xa( f ) , so
a j 2f
1
| X a ( f ) | , as shown below. Note that | X a ( f ) | 0 at all
a 2 2f
2
Chapter 2 53
2.7 Digital-to-Analogue Conversion (D/A) – Signal
recovery
The D/A conversion process is employed to convert the digital
signal into an analogue form after it has been digitally
processed. The reason for such conversion may be for example,
to generate an audio signal to drive a loudspeaker or to sound an
alarm. The D/A process is shown in Figure 2.9. A register is
used to buffer the D/A’s input to ensure that its output remains
the same until the D/A is fed the next digital input.
Note: The inputs to the D/A are series of impulses, while the
output of the DAC has a staircase shape as each impulse is held
for a time T sec.
reconstruction filter
y[n] or smoothing filter
yˆ (t )
n t
Chapter 2 54
By comparing its output yˆ (t ) and its input y[n], it is evident that
for each digital code fed into the D/A, its output is held for a
time T. The result is the characteristic staircase shape at the D/A
output.
1 0 t T 1
h(t )
0 otherwise
t
T
The corresponding frequency response is
H ( ) h(t )e jt dt
T
T
e j t
e dt
j t
0 j 0
T j2T j T
1 j
e e 2
[e jT 1] e 2
j j
j T
j T T
j T
e T j T sin
T 2
e 2
2
e 2
e 2
2 j T T
2
2 2
Chapter 2 55
The magnitude of H( ) is plotted in Figure 2.10.
|H()|
sin x T
x 2
6 4 2 2 4 6
0
7 7 7 7 7 7
Y()
input to the D/A
Chapter 2 56
The amplitude of the output signal spectrum is multiplied by the
sin x
function, which acts like a lowpass filter, with the high
x
sin x
frequencies heavily attenuated. The effect is due to the
x
holding action of the DAC and, in signal recovery, introduces an
amplitude distortion.
sin x
For a zero-order hold, the function falls to about 4 dB at
x
fs
half the sampling frequency giving an average error of
2
about 36.4%.
Chapter 2 57
2.7.2 Ideal D/A Converter (Sinc Interpolation)
H ( )
^
T
y[n] y(t) y(t)
Ideal D/A
T T
δ (t )
T H ( ) h(t) h(t)
1
1
t
t sin
h(t ) T
t
T
y (t ) h(t ) * yˆ (t )
sin(t / T )
* y ( n ) (t nT )
(t / T ) n
Chapter 2 58
y(t) can be written in this form.
sin( t / T )
y (t ) y n (t nT ) *
n
( t / T )
Using the property
x(t ) * (t t 0 ) x(t t 0 )
we can obtain
(t nT )
sin
y (t ) yn
T (2.8)
(t nT )
n
T
The original signal can be obtained by adding together an
sin x sin x
infinite number of pulses. The nth pulse here is
x x
shifted through a distance nT with respect to the origin and
multiplied (weighted) by a factor y[n]. This recovery process is
called interpolation. Figure 2.11 shows the implementation of
equation (2.8).
Chapter 2 59
y(1)
y(t) = x(t)
original signal
y(0)
y(2)
y(-1)
y(-2)
-T 0 T 2T t
Figure 2.11: Each discrete-time sample is multiplied by a shifted sinc function.
Summing these sinc functions will produce the original analogue signal.
The signal x(t) is reconstructed from the samples of xn yn
sin x
by summation of weighted and shifted pulse.
x
= 96000 bits/sec
Chapter 2 60
(c)
CD CD 16 bit lowpass AMP
16 bit fs= Reader D/A filter
44.1 kHz
bit rate
=1644100 bits/sec
16 bit fs = 44.1kHz
=0.7056 Mbits/sec
2.8 Summary
At the end of this chapter, it is expected that you should know:
Chapter 2 61