E. Ambikairajah Australia: Part A: Chapter 3 (C) : Digital Signal Processing
E. Ambikairajah Australia: Part A: Chapter 3 (C) : Digital Signal Processing
ja
ira
Digital Signal Processing
a
lia ik
3.1 Introduction to Digital Signal Processing
b
3.2 Analogue to Digital Conversion Process
tra m
3.3 Quantisation and Encoding
3.4 Sampling of Analogue Signals
us . A
3.5 Aliasing
3.6 Digital to Analogue Conversion
3.7 Introduction to digital filters
,A E3.7.1 Non-Recursive Digital filters
3.7.2 Recursive Digital filters
or
3.8 Digital filter Realisation
3.8.1 Parallel Realisation
SW ss
ja
(a) State an application where a constant group delay filter is used.
ira
• Filtering music signals or video signals
a
lia ik
(b) Draw a parallel and a cascade realisation of the filter
b
2
H ( z) =
tra m
1 −1 1
(1 − z )(1 − z −1 )
2
x(n)
y(n)
us . A
+ +
2 4
cascade z-1 z-1
,A E +
4
0.5 0.25
or
z-1
x(n)
+ y(n)
SW ss
2 4 2
= − 0.5
⎛ 1 −1 ⎞⎛ 1 −1 ⎞ ⎛ 1 −1 ⎞ ⎛ 1 −1 ⎞
⎜1 − z ⎟⎜1 − z ⎟ ⎜1 − z ⎟ ⎜1 − z ⎟
U ofe
⎝ 2 ⎠⎝ 4 ⎠ ⎝ 2 ⎠ ⎝ 4 ⎠
-2
parallel
z-1
Pr
0.25
N
h
3.10 Minimum-phase, Maximum-phase
ja
and Mixed phase systems [11]
a ira
Let us consider two FIR filters:
lia ik
b
1 −1
tra m
H1 ( z) = 1 + z
us . A
2
1
H 2 ( z ) = + z −1
,A E
2
or
SW ss
ρ = -0.5
U ofe
|z|=1
1
Pr
= −2
ρ |z|=1
N
h
ja
H2(z) is the reverse of the system H1(z). This is due
ira
to the reciprocal relationship between the zeros of
a
H1(z) & H2(z).
lia ik
b
1 − jθ 1
H 1 (θ ) = 1 + e & H 2 (θ ) = + e − jθ
tra m
2 2
us . A
5
| H 1 (θ ) |=| H 2 (θ ) |= + cosθ
,A E
4
or
SW ss
ja
−1
Phase: φ2 (θ ) = tan
ira
1
+ cos θ
2
a
lia ik
sin θ
φ1 (θ ) = tan −1
b
2 + cos θ
tra m
us . A
φ2 (θ) φ1(θ)
,A E π
π
or
SW ss
-π π θ -π π θ
U ofe
-π -π
Pr
N
h
Note: If we reflect a zero z = ρ that is inside
ja
ira
1
the unit circle into a zero z = outside the unit
a
ρ
lia ik
circle the magnitude characteristic of the system is
b
tra m
us . A
unaltered, but the phase response changes.
,A E
We observe that the phase characters φ1(θ) begins
or
at zero phase at frequency θ = 0 and terminates at
SW ss
phase change.
Pr
ira
filter with the zero outside the unit circle undergoes a
net phase change
a
lia ik
φ2 (π ) − φ1 (0 ) = −π radians
b
tra m
As a consequence of these different phase
us . A
characteristics, we call the first filter a minimum-
,A E
phase system and the second system is called a
or
maximum-phase system.
SW ss
ira
carries over to IIR filter.
a
B( z )
lia ik
Let us consider H ( z ) =
b
A( z )
tra m
us . A
is called minimum phase if all its poles and
zeros are inside the unit circle.
,A E
or
|z|=1
SW ss
U ofe
Minimum phase
Re(z)
Pr
N
h
ja
If all the zeros lie outside the unit circle, the
ira
a
lia ik
b
tra m
|z|=1
us . A
,A E
Maximum phase
or
Re(z)
SW ss
U ofe
Pr
N
h
ja
If zeros lie both inside and outside the unit
ira
a
lia ik
b
tra m
us . A
,A E
Mixed phase
Re(z)
or
SW ss
|z|=1
U ofe
Pr
N
h
ja
Note: For a given magnitude response,
ira
the minimum-phase system is the
a
lia ik
causal system that has the smallest
b
tra m
magnitude phase at every frequency
us . A
(θ). That is, in the set of causal and
,A E
stable filters having the same
or
h
ja
ira
Consider a fourth-order all-zero filter containing a
double complex conjugate set of zeros located at
a
lia ik
π
±j
b
z = 0 .7 e.4
tra m
The minimum-phase, mixed phase and maximum
us . A
2
2
ρ
U ofe
4
4 4
2
Pr
ρ=0.7 1/ρ 2
N
ja
the three systems are shown below: The minimum-
ira
phase system seems to have the phase with the
a
smallest deviation from zero at each frequency.
lia ik
|H(θ)|
b
tra m
us . A
π θ
,A E
φ(θ) minimum phase
or
SW ss
θ
-π
U ofe
-3π
N
-4π
maximum phase
h
Example:
ja
ira
A third order FIR filter has a transfer function
G(z) given by
a
G ( z ) = (6 − z −1 − 12 z −2 )(5 + 2 z −1 )
lia ik
b
From G(z), determine the transfer function of an
tra m
us . A
to that of G(z) and has a minimum phase
,A E
response.
or
G ( z ) = (2 − 3 z )(3 + 4 z )(2 + 5 z −1 )
−1 −1
SW ss
U ofe
3 −1 4 −1 5 −1
G(z) = 12(1 − z )(1 + z )(1 + z )
2 3 2
Pr
N
>1
h
ja
ira
lm(z)
a
lia ik
2 3
b
3 2
tra m
- 5 4 3 2 Re(z)
− − − −
us . A
-
2 3 4 5
,A E |z|=1
or
SW ss
U ofe
2 −1 3 −1 2 −1
The Minimum phase filter P ( z ) = k (1 − z )(1 + z )(1 + z )
3 4 5
Pr
N
h
3.11 All-Pass Filters [11]
ja
ira
An all-pass filter is one whose magnitude response is
a
constant for all frequencies, but whose phase
lia ik
response is not identically zero.
b
tra m
[The simplest example of an all-pass filter is a pure
us . A
described by −1 − L +1
a L + a L −1 z + L + a1 z + a0 z − L
U ofe
H ( z) =
1 + a1 z −1 + L + a L z − L
Pr
h
ja
ira
If we define the polynomial A(z) as
a
lia ik
L
A( z ) = ∑ ak z
b
−k
a0 = 1
tra m
k =0
us . A
A( z −1 )
∴ H ( z ) = z −L
,A E ⇒| H (θ ) |2 = H ( z ) ⋅ H ( z −1 ) | z =e jθ = 1
A( z )
or
SW ss
h
Furthermore, if z0 is a pole of H(z), then is a
ja
z0
zero of H(z) {ie. the poles and zeros are reciprocals
ira
of one another}. The figure shown below illustrates
a
lia ik
typical pole-zero patterns for a single-pole, single-
b
zero filter and a two-pole, two-zero filter.
tra m
|z|=1
us . A
|z|=1
,A E (1/r, θ0)
r
θ0
or
0 a 0
SW ss
1 (r, -θ0)
a
U ofe
(1/r, -θ0)
All-pass filter All pass filter
Pr
1 −1
1− z
N
ja
constant.
ira
H (θ ) | 2 = H (θ ) ⋅ H * (θ ) = H ( z ) ⋅ H ( z −1 ) | z =e− jθ
a
lia ik
b
1 − jθ 1 jθ 2 1
1− e 1− e 1 − cos θ + 2
tra m
a a a a = a2
= ⋅ =
us . A
1 − ae − jθ 1 − ae jθ 1 − 2a cos θ + a 2
,A E
Phase response:
or
1 − jθ
1− e
SW ss
jθ
a 1 − ae 2 − ( a + a −1
) cos θ − j ( a − a −1
) sin θ
H (θ ) = ⋅ =
U ofe
− jθ jθ
1 − ae 1 − ae 1 − 2a cos θ + a 2
⎡ − ( a − a −1
) sin θ ⎤
Pr
∴φ (θ ) = tan ⎢
−1
⎥
⎣ 2 − (a + a ) cos θ ⎦
−1
N
h
φ(θ)
ja
ira
π
a = 0.5
a
π
lia ik
θ
b
tra m
a = -0.5 a= -0.8
-π
us . A
When 0 < a < 1, the zero lies on the positive real
,A E
axis. The phase over 0 ≤ θ ≤ π is positive, at θ = 0 it
or
zero.
U ofe
ja
ira
x[n] y[n]
a
+ r p1 θ0
lia ik
b
-b1 z-1
tra m
p2
us . A
,A E z-1
-b2
p1 = re jθ 0 = r cos θ 0 + jr sin θ 0
or
p2 = re − jθ 0 = r cos θ 0 − jr sin θ 0
SW ss
U ofe
1 z2
H ( z) = −1 −2
= 2 (A)
1 + b1 z + b2 z z + b1 z + b2
Pr
N
ja
H ( z) = 2 = =
z + b1 z + b2 ( z − p1 )( z − p2 ) ( z − re jθ 0 )( z − re − jθ 0 )
−1
a ira
z2 z2
H ( z) = =
lia ik
jθ 0 − jθ 0
(B)
z − r (e
2
+ e )z + r 2
z 2 − 2r cos θ 0 z + r 2
b
tra m
Comparing (A) and (B), we obtain
us . A
b1 = −2r cos θ 0 ,
,A E b2 = r 2
∴
or
− b1 2πf 0
Cosθ 0 = θ0 =
SW ss
2 b2 fs
U ofe
θ0 = resonant frequency
Pr
N
h
3.13 Stability of a second-order filter
ja
a ira
Consider a two-pole resonant filter given by
lia ik
b
z2 1
tra m
H ( z) = 2 =
z + b1 z + b2 1 + b1 z −1 + b2 z − 2
us . A
,A E
b1 & b2 are coefficients
or
SW ss
b1 b1 − 4b2
Pr
p1 , p 2 = − ±
N
2 2
h
ja
The filter is stable if the poles lies inside the unit
ira
circle i.e. |p1| < 1 & |p2| < 1
a
lia ik
For stability b2 < 1. If b2 = 1 then the system is an
b
tra m
oscillator (Marginally stable)
us . A
Assume that the poles are complex
,A E
or
i.e. b12 – 4b2 < 0 ⇒ b12 < 4b2 and b1 < ±2 b2 , b2 > 0
SW ss
U ofe
ja
coefficient plane (b1, b2) which is in the form of a
ira
triangle (see below)
a
lia ik
The system is only stable if and only if the point
b
tra m
(b1, b2) lie inside the stability triangle.
us . A
2
b
parabola b2 = 1
,A E 4
b2
b2 = 1
or
SW ss
1
U ofe
-2 -1 0 1 2
Real Poles b1
N
b2 = −b1 − 1 -1 b2 = b1 − 1
h
ja
Stability Triangle
ira
If the two poles are real then they must have
a
lia ik
a value between -1 and 1 for the system to
b
be stable.
tra m
us . A
− b1 ± b12 − 4b2
,A E −1 < <1
2
or
− 2 + b1 < ± b12 − 4b2 < 2 + b1
SW ss
ja
parabola b2 = 1
4
ira
b2
b2 = 1
a
1
lia ik
Complex Conjugate Poles
b
tra m
-2 -1 0 1 2
Real Poles b1
us . A
b 2 = − b1 − 1 -1 b 2 = b1 − 1
,A E
The region below the parabola (b12 > 4b2)
or
corresponds to real and distinct poles.
SW ss
ja
ira
A digital oscillator can be made using a second order
a
discrete-time system, by using appropriate
lia ik
coefficients. A difference equation for an oscillating
b
tra m
system is given by
p[n] = A cos(nθ )
us . A
,A E
From the table of z-transforms we know that the
or
z-transform of p[n] above is
SW ss
U ofe
−1
1 − cos θz
P( z ) =
1 − 2 cos θz −1 + z −2
Pr
N
h
ja
Y ( z) 1 − cos θz −1
Let P( z ) = =
ira
X ( z ) 1 − 2 cos θz −1 + z − 2
a
lia ik
Taking inverse z-transform on both sides, we obtain
b
tra m
y[n] − 2 cosθy[n − 1] + y[n − 2] = x[n] − cosθx[n − 1]
us . A
,A E
or
No Input term for an oscillator
SW ss
x[n] = 0, x[n-1] = 0
U ofe
a ira
and its structure is shown below.
lia ik
b
tra m
y[n] = A cos(nθ)
us . A
y[n-2]
,A E z-1 y[n-1] z-1
+
or
b1 = 2cosθ
SW ss
U ofe
Pr
N
b2 = -1
h
ja
To obtain y[n] =Acos(nθ), use the following initial
ira
conditions:
a
lia ik
y[0] = A cos(0.θ) = A
b
y[-1] = A cos(-1.θ) = A cosθ
tra m
us . A
The frequency can be tuned by changing the coefficient
,A E
b1 (b2 is a constant). The resonant frequencyθ of the
or
oscillator is,
SW ss
− b1
U ofe
b1
cos θ = = − (For an oscillator b2 = 1)
2 b2 2
Pr
N
h
Example:
ja
ira
A digital sinusoidal oscillator is shown below.
a
lia ik
x[n] y[n] = A sin(n+1)θ
b
+
tra m
z-1
us . A
,A E -b1 z-1
or
SW ss
U ofe
a
lia ik
K
b
=
tra m
z 2 − r ( e jθ 0
+ e − jθ 0 ) z + r 2
us . A
K
= 2
,A E
z − 2r cos θ 0 z + r 2
or
SW ss
∴b1 = -2 r cosθ
U ofe
0 ; b 2 = r2
∴b
Pr
a
Assuming
lia ik
x[n] = (Asinθ0)δ[n], and y(-1) = y(-2) = 0.
b
tra m
us . A
Show, by analysing the difference equation, that the
,A E
application of an impulse at n = 0 serves the purpose of
or
beginning the sinusoidal oscillation, and prove that the
SW ss
ja
ira
y[n] = 2 cosθ 0 y[n − 1] − y[n − 2] + A sin θ 0δ [n]
a
lia ik
n=0
b
y[0] = 2cosθ0 y[-1] – y[-2] + A sinθ0 δ[0]
tra m
us . A
0 0 1
y[0] = A sinθ0
,A E
or
n=1 0 0
SW ss
ira
y[2] = 2 cosθ0 y[1] – y[0] + A sinθ0δ[2]
a
= 2 cosθ0 Asin2θ0 – A sinθ0
lia ik
= 2A cosθ0 [2 sinθ0cosθ0] - sinθ0
b
tra m
= A sinθ0 [4 cos2θ0 –1 ] = A[3sinθ0 – 4 sin3θ0]
us . A
where sin3θ0 = 3sinθ0 – 4 sin3θ0
,A E
or
y[2] = A sin3θ0 and so forth.
SW ss
U ofe
Pr
N
h
ja
By setting the input to zero and under certain initial
ira
conditions, sinusoidal oscillation can be obtained
using the structure shown above. Find these initial
a
lia ik
conditions.
b
tra m
y[n] = 2 cosθy[n − 1] − y[n − 2] + x[n]
us . A
,A E
(x[n] = 0 for an oscillator)
or
n=0 y[0] = 2cosθ0 y[-1] – y[-2]
SW ss
ja
ira
Sinusoidal oscillators can be used to deliver the
carrier in modulators. In modulation schemes, both
a
lia ik
sines and cosines oscillators and needed. A structure
b
that delivers sines and cosines simultaneously is
tra m
shown below:
us . A
z-1
,A E cosθ
or
+ y[n]= cos(nθ)
sinθ
SW ss
U ofe
-sinθ
cosθ
Pr
+
x[n]= sin(nθ)
N
z-1
Proof:
h
ja
Trigonmetric equation for cos(n+1)θ is:
ira
cos(n+1)θ = cos(nθ)cosθ - sin(nθ) sinθ
Let y[n] = cos(nθ) and x[n] = sin(nθ)
a
∴ y[n+1] = cosθ y[n] – sinθ x[n]
lia ik
b
tra m
Replace n by n-1
y[n] = cosθ y[n-1] – sinθ x[n-1]
us . A
(A)
,A E
Similarly
sin(n+1)θ = sinθ cos(nθ) + sin(nθ) cosθ
or
Replace n → n-1
U ofe
h
ja
ira
An oscillator is given by the following coupled
difference equations expressed in matrix
a
lia ik
form.
b
⎡ yc [n]⎤ ⎡cos θ 0 − sin θ 0 ⎤ ⎡ yc [n − 1]⎤
tra m
⎢ y [n]⎥ = ⎢ sin θ ⎥ ⎢
cosθ 0 ⎦ ⎣ ys [n − 1]⎦ ⎥
us . A
,A E⎣ s ⎦ ⎣ 0
difference equations.
h
yc [n] = cosθ 0 yc [n − 1] − sin θ 0 y s [n − 1]
ja
ira
y s [n] = sin θ 0 yc [n − 1] + cosθ 0 y s [n − 1]
a
lia ik
b
z-1
tra m
cosθ0
us . A
,A E + yc[n]
sinθ0
or
SW ss
-sinθ0
U ofe
cosθ0
+
Pr
ys[n]
N
z-1
h
ys[0] = sinθ0 (A cosθ0) + cosθ0 (-Asinθ0) = 0
ja
n=0
ira
n=0 yc[0] = cosθ0 (Acosθ0) - sinθ0(-Asinθ0) = A
a
lia ik
b
n=1 yc[1] = cosθ0.A - sinθ0 .0 = Acosθ0
tra m
us . A
n=1 ys[1] = A sinθ0 + 0 = A sinθ0
,A E
n=2 yc[2] = cosθ0 yc[1] - sinθ0 ys[1]
or
ja
The transfer function of a second order digital oscillator with an oscillation frequency of θ0 is
ira
given by z
H ( z) = 2 ; b1 = 2 cosθ 0
z − b1 z + 1
a
(a) Show that the impulse response corresponding to the system function H(z) is given by
lia ik
sin( nθ 0 ) u (n)
h( n) =
b
[3 marks]
sin(θ 0 )
tra m
z sin(θ 0 ) sin(nθ 0 )u (n) z
From z - transform table : Z{sin(nθ 0 )u (n)} = ⇒ → 2 = H ( z)
us . A
z − 2 z cos(θ 0 ) + 1
2
sin(θ 0 ) z − 2 z cos(θ 0 ) + 1
sin(nθ 0 )u (n)
⇒ h( n) =
,A E sin(θ 0 )
(c) The frequency of oscillation of the system H(z) can be determined using b1. Show that
or
− f s Δb1
Δf 0 =
SW ss
f [4 marks]
4π sin(2π 0 )
fs
where fs=sampling frequency and f0 =desired frequency of oscillation and Δ f0 is the
U ofe
2πΔf 0
Δb1 = −2 sin(θ 0 )Δθ 0 = −2 sin(θ 0 )
Pr
fs
N
− f s Δb1 − f s Δb1
∴ Δf 0 = =
4π sin(θ 0 ) 4π sin( 2π f 0 )
fs
h
3.15 Notch filters [4]
ja
ira
When a zero is placed at a given point on the
a
z-plane, the frequency response will be zero
lia ik
at the corresponding point. A pole on the
b
other hand produces a peak at the
tra m
corresponding frequency point.
us . A
,A E
Poles that are close to the unit circle give rise
or
large peaks, where as zeros close to or on
SW ss
(notch filters).
h
Example:
ja
ira
Obtain, by the pole-zero placement method,
the transfer function of a sample digital notch
a
lia ik
filter (see figure below) that meets the
b
following specifications: [4]
tra m
us . A
Notch Frequency: 50Hz
,A E3db width of the Notch: ±5Hz
Sampling frequency: 500 Hz
⎛ Δf ⎞
or
The radius , r of the poles is determined by : r = 1 − ⎜⎜ ⎟⎟π
SW ss
⎝ fs ⎠
|H(f)|
U ofe
Pr
N
0 50 250 f (Hz)
h
To reject the component at 50Hz , place a pair of
ja
complex zeros at points on the unit circle corresponds to
ira
50
50Hz. i.e. at angles of 3600 × = ±360 = ±0.2π
a
500
lia ik
To achieve a sharp notch filter and improved amplitude
b
tra m
response on either side of the notch frequency , a pair of
us . A
complex conjugate zeros are placed at a radius r < 1.
,A E |z| =1
⎛ Δf ⎞
⎟π = 1 − ⎛⎜
10 ⎞
r = 1 − ⎜⎜ ⎟π = 0.937
or
⎟
⎝ fs ⎠ ⎝ 500 ⎠
SW ss
U ofe
360
Pr
360
N
0.937
h
(z − e )(z − e )
ja
− j 0.2π j 0.2π
ira
H ( z) =
(z − 0.937e − j 0.2π
)(z − 0.937e j 0.2π
)
a
lia ik
j 0.2π − j 0.2π
z + 1 − (e +e
b
2
)
= 2
tra m
j 0.2π − j 0.2π
z + 0.878 − 0.937(e +e )z
us . A z + 1 − 2 cos(0.2π )
,A E 2
= 2
or
−1 −2
1 − 1.6180 z + z
U ofe
= −1 −2
1 − 1.5161z + 0.878 z
Pr
N
h
Summary of part A Chapter 3
ja
ira
At the end of this chapter, it is expected that you should know:
a
lia ik
A block diagram of the conversion from analog to digital and
b
back to analog form, including descriptions of the blocks
tra m
us . A
Analog to digital conversion, in particular amplitude
,A E
quantization and quantization error. Be able to calculate the
signal-to-quantization error ratio.
or
SW ss
ira
sketched magnitude spectrum plots.
a
lia ik
Digital to analog conversion and the role of the
b
reconstruction filter. Show your understanding using
tra m
both mathematical and hand-sketched explanations.
us . A
,A E
Calculations of aliased frequencies: f0 = fk –kfs, where
or
fk is the frequency outside the Nyquist frequency.
SW ss
Pr
ira
Understanding of phase delay and group delay
a
Definition of linear phase filters
lia ik
b
tra m
IIR (Recursive, all-pole or pole-zero) Filters
us . A
Cascaded, parallel, and canonic structures
,A E
or
Calculation of 3 dB cut-off frequency and 3 dB
SW ss
ja
filters based on the difference equations or transfer
ira
functions for both FIR and IIR
a
lia ik
b
Given an FIR filter (difference equation or transfer
tra m
function), be able to draw the magnitude and phase
us . A
responses, and be able to explain the relationship
,A E
between magnitude and phases responses.
or
SW ss
ira
response is constant but their phase response is non-zero.
a
lia ik
Be able to derive the transfer function for a second order
b
tra m
resonator filter, and be able to analyse its stability
us . A
properties using the stability triangle and pole positions.
,A E
Be able to understand the range the filter coefficients can
or
take in order to preserve stability.
SW ss
U ofe