Review Notes: Digital Signal Processing ELEC96010 (EE3-07)
Review Notes: Digital Signal Processing ELEC96010 (EE3-07)
ELEC96010 (EE3-07)
Aidan O. T. Hogg {[email protected]}
Imperial College London, (last updated: May 31, 2021)
Please email Aidan O. T. Hogg {[email protected]} if you have any suggestions or comments
about this document.
Contents
1.6 Z-Transform . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 6
2.5 Symmetries . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 12
2.7 Zero-Padding . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 13
3 Module 3 - Convolution 19
Imperial College London ELEC96010 (EE3-07) - Digital Signal Processing
4.1 Filters . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 23
5.7 Resampling . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 45
It is now common practice to process analog signals digitally due to the many advantages of digital
signal processing. This process is shown above. First an analog low-pass filter is used to remove any
frequencies that could cause aliasing and thus is aptly named the ‘anti-aliasing filter’. Secondly the anolog
signal is sampled and held to allow time for the analog-to-digital conversion to take place. The output
analog-to-digital converter is then a digital signal that can be processed using different digital signal
processing techniques including: delaying, multiplying and adding to extract the desired information from
the signal. This desired signal can then be converted back into an analog signal using a digital-to-analog
converter. The ouput of the digital-to-analog converter is then passed through a low-pass filter to remove
higher frequency components that are created by the sampling process; this filter is normally referred to
as the reconstruction filter due to the fact that it reconstructs the analog signal at the output.
Let xa (t) be a analog signal that is sampled at internals of T , creating a signal xs (t) where:
Now let xa (t) have the Fourier transform Xa (jΩ), where Ω denotes the analog radian frequency (Ω =
2πF ), defined by: Z ∞
Xa (jΩ) = xa (t)e−jΩt dt
−∞
So in order to discover the interrelationship between Xa (jΩ) and Xs (jΩ), we need to idealize the sampling
waveform to a sequence of impulses, given by sT (t):
∞
X
sT (t) = δ(t − nT )
n=−∞
xa (t) × xs (t)
sT (t)
To get a better conceptual understanding of this sampling process it has been visualised below.
(a) xa (t): continuous-time signal (b) sT (t): impluse train (c) xs (t): sampled signal
This result comes from the compact representation of the Fourier Series which uses complex exponentials:
∞
1 T /2 1 T /2
Z Z
X 1
sT (t) = ck ejkΩs t , where ck = sT (t)e−jkΩs t dt = δ(t)e−jkΩs t dt =
T −T /2 T −T /2 T
k=−∞
Thus it can be seen that Xs (jΩ) is a periodic function of frequency Ω, consisting of the sum of shifted
and scaled replicas of Xa (jΩ), shifted by integer multiples of Ωs and scaled by T1 .
|Xa (jΩ)|
1
Ω
−Ωm Ωm
(a) Spectrum of the original continuous-time signal xa (t)
1
|ST (jΩ)|
T
Ω
−Ωs Ωs 2Ωs 3Ωs
(b) Spectrum of the sequence of impulses sT (t)
1
|Xs (jΩ)|
T
Ω
−Ωs −Ωm Ωm Ωs 2Ωs 3Ωs
(c) Spectrum of the sampled signal xs (t)
For example, instead of designing a 1 kHz low-pass filter for fs = 44.1 kHz it would often be easier to
design a 0.0227 kHz filer for fs = 1 kHz.
It is common to use F for ‘real’ frequencies and Ω for ‘real’ angular frequencies. The scaled versions being
f for normalised frequency and ω for normalised angular frequency where the units of ω are ‘radians per
sample’ and f are ‘cycles per sample’. Therefore:
Ω 2πΩ 2πF F
ω= = = = 2πf, where f =
Fs Ωs Fs Fs
thus
∞
1 X
Xs (jΩ) = Xa (j(Ω + kΩs ))
T
k=−∞
can be written as
∞
jω
1 X ω 2πk ω 2π
X e = Xa j + where Ω = and Ωs = 2πFs =
T T T T T
k=−∞
Warning: several MATLAB routines scale time so that fs = 2 Hz. Non-standard, weird and irritating.
Definition:
Ωs
|Ωm | ≤ , where Ωs = 2πFs = 2π/T =⇒ |ω| ≤ π
2
The frequency 2Ωm is called the Nyquist rate. Sampling above this frequency is called oversampling,
conversely, sampling below this frequency is called undersampling. Lastly sampling at a frequency exactly
equal to the Nyquist rate is called critical sampling.
It can be seen earlier that the continuous-time signal xa (t) can be recovered by passing the signal xs (t)
through an ideal low-pass filter H(jΩ) with cuffoff frequency Ωc , where Ωm < Ωc < (Ωs − Ωm ) to avoid
aliasing.
The impulse response of h(t) of this low-pass filter can be obtained by taking the inverse Fourier transform
of its frequency response H(jΩ):
(
T, |Ω| ≤ Ωc
H(jΩ) =
0, |Ω| > Ωc
which is given by
Z ∞ Z Ωc
1 T T h 1 jΩt iΩc T h 1 jΩc t i h 1 −jΩc t i
h(t) = H(jΩ)ejΩt dΩ = ejΩt dΩ = e = e − e
2π −∞ 2π −Ωc 2π jt −Ωc 2π jt jt
T jΩc t T sin(Ωc t)
= e − e−jΩc t = sin(Ωc t) = , −∞ < t < ∞
j2πt πt Ωs t/2
Therefore the output of the low-pass filter x̂a (t) is given by xs (t) ∗ h(t), which can be written as
∞
X
x̂a (t) = x[n]h(t − nT )
n=−∞
Assuming for simplicity that Ωc = Ωs /2 = (2πFs )/2 = π/T by substitution of h(t) we arrive at
∞ ∞
sin[π(t − nT )/T ] (t − nT )
X X
x̂a (t) = x[n] = x[n] sinc
n=−∞
π(t − nT )/T n=−∞
T
as a result, x̂a (nT ) = x[n] = xa (nT ) for n ∈ Z in the range −∞ < n < ∞, whether or not the Nyquist
theorem has been satisfied, however, x̂a (t) = xa (t) is only true if Ωs ≥ 2Ωm (Nyquist condition).
(a) x[n]: sampled signal (b) sinc interpolation (c) x̂a (t): reconstructed signal
1.6 Z-Transform
The z-transform converts a discrete-time signal, x[n], into a function, X(z), of an arbitrary
complex-valued variable z.
Definition:
∞
X
Z{x[n]} = X(z) = x[x]z −1 (1)
n=−∞
which only exists for particular values of z for which the series converges
The values of z for which X(z) converges is called the ‘Region of Convergence (ROC)’. X(z) will always
converge absolutely inside the ROC and may converge on some, all, or none of the boundary.
P∞
• Converge absolutely ⇔ n=−∞ |x[n]z n | < ∞
• Absolutely summable ⇔ X(z) converges for |z| = 1
• Causal ⇒ X(∞) converges
• Anticausal ⇒ X(0) converges
Geometric series:
1
1 + r + r2 + r3 + · · · = , for |r| < 1
1−r
Proof:
s = 1 + r + r2 + r3 + · · ·
rs = r + r2 + r3 + r4 + · · ·
s − rs = 1, given |r| < 1
1
s= , for |r| < 1
1−r
Examples:
16/7 4/7 8 1 1 1
Partial Fractions: H(z) = − = × − ×
(2 + z −1 ) (4 − 5z −1 ) 7 (1 + 12 z −1 ) 7 (1 − 54 z −1 )
Warning: The zeros at z = 0 can be easily missed when H(z) is written as a function of z −1 .
1 1 1
(a) Right-sided and unstable (b) Left-sided and unstable (c) Two-sided and stable
(a) For the ROC defined by |z| > |1.25|, the impulse response is a right-sided sequence given by the
sum of two causal sequences which is given by:
8 1 n 1 5 n
h[n] = − u[n] − u[n]
7 2 7 4
Since the second sequence on the right-hand side in the above equation is not absolutely summable
the LTI system is unstable.
(b) For the ROC defined by |z| < |0.5|, the impulse response is a left-sided sequence given by the sum
of two anticausal sequences which is given by:
8 1 n 1 5 n
h[n] = − − u[−n − 1] + u[−n − 1]
7 2 7 4
Since the first sequence on the right-hand side in the above equation is not absolutely summable
the LTI system is unstable.
(c) For the ROC defined by |0.5| < |z| < |1.25|, the impulse response is a two-sided sequence given by
the sum of a causal sequence and an anticausal sequence which is given by:
8 1 n 1 5 n
h[n] = − u[n] + u[−n − 1]
7 2 7 4
Both of the sequences in the above equation are absolutely summable so, therefore, the LTI system
is stable. Note that the ROC contains the unit circle.
Definition: I
1
x[n] = X(z)z n−1 dz (2)
2πj
where the integral is anti-clockwise around a circle within the ROC, z = Rejθ
Proof:
I ∞
I X
1 1
X(z)z n−1
dz = x[m]z −m z n−1 dz
2πj 2πj m=−∞
∞ I
(i) X 1
= x[m] z n−m−1 dz
m=−∞
2πj
∞
(ii) X
= x[m]δ[n − m] = x[n]
m=−∞
(i) Depends on the circle with radius R lying within the ROC
I
(ii) Cauchy’s theorem: 1
z k−1 dz = δ[k] for z = Rejθ anti-clockwise
2πj
I Z 2π
dz jθ 1 k−1 1
= jRe ⇒ z dz = Rk−1 ej(k−1)θ × jRejθ dθ
dθ 2πj 2πj θ=0
Rk 2π jkθ
Z
= e dθ
2π θ=0
= Rk δ(k) = δ(k) [R0 = 1]
In practice the inverse z-transform is found using a combination of partial fractions and a table of
z-transforms.
The power of discrete-time signal , x[n], is the average of x2 [n] in ‘energy per sample’
N
1 X 1
P = lim |x[n]|2 = lim EN
N →∞ (2N + 1) N →∞ (2N + 1)
n=−N
Note: P is same value as the power of pre-sampled signal x(t) in ‘energy per second’ provided there is
no aliasing.
A discrete-time energy signal is defined as one for which 0 < E < ∞ and a discrete-time power signal
is defined as one for which 0 < P < ∞ . It is possible for a discrete-time signal to be neither an energy
signal nor a power signal.
Note: The behaviour of an LTI system is completely defined by its impulse response: h[n] = H (δ[n])
Proof:
∞
X
x[n] = x[r]δ[n − r]
r=−∞
∞
X ∞
X
H x[n] = H x[r]δ[n − r] = x[r]H (δ[n − r])
r=−∞ r=−∞
∞
X
= x[r]h[n − r]
r=−∞
= x[n] ∗ h[n]
Suppose the output y[n] corresponding to the input x[n] is given by the convolution sum:
∞
X
y[n] = x[n − r]h[r]
r=−∞
Let’s again suppose the output y[n] is given by the convolution sum:
∞ ∞
X X
|y[n]| = x[n − r]h[r] ≤ |x[n − r]||h[r]|
r=−∞ r=−∞
Definitions:
Strong convergence:
Weaker convergence:
2. The DTFT is just the z-transform evaluated on the unit circle, i.e. z = ejω
∞
X
X(z) = x[n]z −n
n=−∞
3. The DTFT is the same as the CTFT of a signal comprising of impulses at the sample times
∞
X ∞
X
xs (t) = x[n]δ(t − nT ) = xa (t) × δ(t − nT )
n=−∞ n=−∞
Proof:
∞ ∞ Z ∞
t
X X
−jωn
jω
X(e ) = x[n]e = x[n] δ(t − nT )e−jω T dt
n=−∞ n=−∞ −∞
Z ∞ ∞ ∞
t
X X
= x[n]δ(t − nT )e−jω T dt, allowed if |x[n]| < ∞
−∞ n=−∞ n=−∞
Z ∞
= xs (t)ejΩt dt, due to ω = ΩT
−∞
2π
Case 1: x[n] = 0 for n ∈
/ [0, N − 1] DFT is the same as DTFT at ωk = N k
Case 2: x[n] is periodic with period N DFT equals the normalised DTFT
2.5 Symmetries
It is useful to note that if a signal x[n] has a special property in the time domain then there will be a
corresponding property in the frequency domain, X(ejω ) and X[k].
2.7 Zero-Padding
Zero padding is the process of added extra zeros onto the end of x[n] before performing the DFT.
This is only for additional insight into how matrices play a very important role in DSP. It will also
hopefully give you a better understanding of the FFT.
2π 2π
Here is the DFT matrix of FN for N = 4. Where w = e−j N (i.e w = e−j = −j)
4
1 1 1 1 1 1 1 1
1 w w2 w3 1 −j −1 j
DFT Matrix: F4 = 1 w2
=
w4 w6 1 −1 1 −1
1 w3 w6 w9 1 j −1 −j
The columns of F4 are all orthogonal, this means the inner product of any column with any other column
should be zero.
However, the inner product of column 1 and 3 apears to be 4: (column 1)T (column 3) = 1 + 1 + 1 + 1 = 4
But this is wrong. These vectors are complex vectors, therefore, to get the correct inner product we must
take the complex conjugate of one of the vectors: (column 1)T (column 3) = 1 + (j · j) + 1 + (−j · −j) = 0
The
√ inner product of every vector with itself is: 1 + 1 + 1 + 1 = 4. All the vectors of F4 have length
4=2
T T
( √1N F N )( √1N FN ) = I means that the inverse is FN−1 = N1 F N = N1 FN∗ (Note: the DFT matrix is
symmetric, so transposing has no effect. The inverse matrix just divides by N and replaces j by −j)
To reconstruct X[k] we want to multiply by FN times x as quickly as possible. The matrix has N 2
entries so we would normally have to perform N 2 separate multiplications. However, we can do better!
The key to the idea is to connect FN with the half-size DFT matrix FN/2 .
Assume N is a power of 2 (say N = 210 = 1024). we can connect F1024 to F512 or rather two copies of
F512 . When N = 4:
1 1 1 1 1 1
(−j)2 (−j)3
1 (−j) F2 0 1 −1
F4 = and =
1 (−j)2 (−j)4 (−j)6 0 F2 1 1
1 (−j)3 (−j)6 (−j)9 1 −1
Key idea:
1 1 1 1 1
1 −j 1 −1 1
F4 =
1 −1 1 1 1
1 j 1 −1 1
The permutation matrix on the right puts x0 and x2 (evens) ahead of x1 and x3 (odds). The matrix in
the middle performs separate half-size transforms on the even and odds. The matrix on the left combines
the two half-size outputs to get the correct full-size out X[k] = F4 x[n].
You should check the result yourself by multiplying the three matrices together to get F4 .
I512 is the identity matrix. D512 is the diagonal matrix with entries (1, w, ..., w511 ). The two copies of
F512 are what we expected, which use the 512th root of unity, which is just (w1024 )2 .
FFT Recursion
We reduced for FN to FN/2 . So lets keep going to FN/4 . The two copies of F512 lead to four copies of
F256 . This is the recursion.
I256 D256 F256 pick 0,4,8...
F512 0 I256 −D256 F256 pick 2,6,10...
=
0 F512 I256 D256 F256 pick 1,5,9...
I256 −D256 F256 pick 3,7,11...
We can count how many multiplications we have saved. When using the DFT we had N 2 = (1024)2 .
This is about a million multiplications.
The final count for N = 2L is reduced from N 2 to 21 N L. The saving is therefore large.
When N = 1024 = 210 , therefore L = 10. The original count of (1024)(1024) is reduced to (5)(1024).
The reasoning behind 21 N L. There are L levels, going from N = 2L down to N = 1. Each level has 21 N
multiplications from the diagonal D to reassemble the half-size outputs.
1 1
This yields the final count 2 N L, which is 2N log2 N .
The exact same idea gives rise to the fast inverse transform.
Decimation in Time
The radix-2 decimation in time algorithm starts by splitting x[n] into two sequences:
N
fe [n] = x[2n] (even samples) and fo [n] = x[2n + 1] (odd samples), for n = 0, . . . , −1
2
Therefore: N −1
X
kn
X[k] = x[n]wN
n=0
N/2−1 N/2−1
k(2m+1)
X X
k2m
= x[2m]wN + x[2m + 1]wN
m=0 m=0
N/2−1 N/2−1
X X
km k km 2
= fe [m]wN/2 + wN fo [m]wN/2 (remember wN = wN/2 )
m=0 m=0
k
= Fe [k] + wN Fo [k] for k = 0, 1, · · · , N − 1
where:
N/2−1 N/2−1
X X
kn kn
Fe [k] = fe [n]wN/2 and Fo [k] fo [n]wN/2
n=0 n=0
This result can now be visualised by a data flow diagram in the following way:
Fe [0]
x[0] 0
X[0]
wN
Fe [1]
x[2] 1
X[1]
N/2 = 4 wN
DFT Fe [2]
x[4] 2
X[2]
wN
Fe [3]
x[6] 3
X[3]
wN
Fo [0] 4
wN
x[1] X[4]
Fo [1] 5
wN
x[3] X[5]
N/2 = 4
DFT Fo [2] 6
wN
x[5] X[6]
Fo [3] 7
wN
x[7] X[7]
To calculate X[4], X[5]X[6], X[7] recall that F[k] repeats every N/2 samples:
k
X[k] = Fe [k mod N/2] + wN Fo [k mod N/2], k = 0, . . . , N − 1.
But why stop here... the process can now be repeated for the shorter (N/2) DFTs:
x[0] 0 0
X[0]
N/4 = 2 wN wN
DFT
x[4] 2 1
X[1]
wN wN
4
wN
x[2] 2
X[2]
N/4 = 2 wN
6
DFT wN
x[6] 3
X[3]
wN
4
wN
x[1] 0
X[4]
N/4 = 2 wN
5
DFT wN
x[5] 2
X[5]
wN
4 6
wN wN
x[3] X[6]
N/4 = 2
6 7
DFT wN wN
x[7] X[7]
Again this process can be repeated for the shorter (N/4) DFTs:
x[0] 0
X[0]
wN
0
0
wN
wN
4
wN
x[4] 2
X[1]
wN
1
wN
4
wN
x[2] X[2]
2
0
wN
wN
4 6
wN wN
x[6] X[3]
3
wN
4
wN
x[1] 0
X[4]
wN
0
wN
4 5
wN wN
x[5] 2
X[5]
wN
4 6
wN wN
x[3] X[6]
0
wN
4 6 7
wN wN wN
x[7] X[7]
r
wN
r+(N/2)
wN
r+(N/2) r N/2 r
Notice that wN = wN wN = −wN and, therefore, this ‘butterfly’ can be simplified in the following
way:
r
wN
⇒ r
r
−wN wN −1
It can be seen that this approach now saves a factor of N/2 complex multiplications at each stage. Thus
the 8-point decimation in time FFT algorithm can be visualised in the following way:
w80 −1
x[4] X[1]
w80 −1
x[2] X[2]
w80 −1 w82 −1
x[6] X[3]
w80 −1
x[1] X[4]
w80 −1 w81 −1
x[5] X[5]
w80 −1 w82 −1
x[3] X[6]
N
1. The FFT only contains 2 log2 N complex multiplications.
2. The FFT input is ordered by bit-reversed addressing (when the decimation happens in time).
3. The FFT computation can be done ‘in place’ and, therefore, requires no extra storage.
Decimation in Frequency
The radix-2 decimation in frequency algorithm splits the discrete Fourier transform into two parts:
PN −1 2kn
X[2k] = n=0 x[n]wN
PN/2−1 2kn
PN/2−1 2k(n+N/2)
= n=0 x[n]wN + n=0 x[n + N/2]wN
PN/2−1 2kn
PN/2−1 2kn
= n=0 x[n]wN + n=0 x[n + N/2]wN ×1
PN/2−1 kn
= n=0 (x[n] + x[n + N/2])wN/2
PN/2−1 kn
= n=0 g1 [n]wN/2 g1 [n] = x[n] + x[n + N/2]
PN −1 (2k+1)n
X[2k + 1] = n=0 x[n]wN
PN/2−1 N/2 (2k+1)n
= n=0 (x[n] + wN x[n + N/2])wN
PN/2−1 n kn
= n=0 ((x[n] − x[n + N/2])wN )wN/2
PN/2−1 kn n
= n=0 g2 [n]wN/2 g2 [n] = (x[n] − x[n + N/2])wN
x[0] X[0]
−1 w40
x[1] X[2]
−1 w40
x[2] X[1]
−1 w41 −1 w40
x[3] X[3]
It is interesting to compare this approach against a radix-2 decimation in time 4-point FFT algorithm:
x[0] X[0]
w40 −1
x[2] X[1]
w40 −1
x[1] X[2]
w40 −1 w41 −1
x[3] X[3]
3 Module 3 - Convolution
3.1 Types of Convolution
Definitions:
∆ P∞
• Linear Convolution: y[n] = x[n] ∗ h[n] = k=−∞ x[k]h[n − k]
∆ PN −1
• Circular Convolution: y[n] = x[n] ~N h[n] = k=0 x[k]h[(n − k)mod N ]
DTFT
• Convolution → Product
∞
X
y[n] = x[n] ∗ h[n] = x[k]h[n − k] ⇒ Y (ejω ) = X(ejω )H(ejω )
k=−∞
DFT
1. Associative: x[n] ∗ (h[n] ∗ v[n]) = (x[n] ∗ h[n]) ∗ v[n] therefore x[n] ∗ h[n] ∗ v[n] is not ambiguous
P∞ P∞ (i) P∞ P∞
Proof: k=−∞ r=−∞ x[n − k]h[k − r]v[r] = p=−∞ q=−∞ x[p]h[q − p]v[n − q]
(i) substitute p = n − k, q = n − r
P∞ (i) P∞
Proof: k=−∞ x[k]h[n − k] = p=−∞ x[n − p]h[p]
(i) substitute p = n − k
3. Distributive over addition: x[n] ∗ (αh[n] + βv[n]) = (x[n] ∗ αh[n]) + (x[n] ∗ βv[n])
P∞ P∞ P∞
Proof: k=−∞ x[n − k](αh[k] + βv[k]) = α k=−∞ x[n − k]h[k] + β k=−∞ x[n − k]v[k]
P∞ (i)
Proof: k=−∞ δ[k]x[n − k] = x[n]
(i) all terms are zero except when k = 0
−2 −1 0 1 2 k
x[−1] x[0] x[1] x[2] x[k]
h[−2] h[−1] h[0] h[1] h[k]
h[1] h[0] h[−1] h[−2] h[−k]
y[0] = x[−1]h[1]+ x[0]h[0]+ x[1]h[−1]+ x[2]h[−2]
h[1] h[0] h[−1] h[1 − k]
y[1] = x[0]h[1]+ x[1]h[0] + x[2]h[−1]
h[0] h[−1] h[−2] h[−1 − k]
y[−1] = x[−1]h[0]+ x[0]h[−1] + x[1]h[−2]
h[1] h[0] h[2 − k]
y[2] = x[1]h[1] + x[2]h[0]
h[−1] h[−2] h[−2 − k]
y[−2] = x[−1]h[−1] + x[0]h[−2]
h[1] h[3 − k]
y[3] = x[2]h[1]
h[−2] h[−3 − k]
y[−3] = x[−1]h[−2]
This is a laborious process, however, there is a very simple trick that can be used to calculate the
convolution:
−2 −1 0 1 2 k
x[−1] x[0] x[1] x[2] x[k]
h[−2] h[−1] h[0] h[1] h[k]
h[1]x[−1] h[1]x[0] h[1]x[1] h[1]x[2]
h[0]x[−1] h[0]x[0] h[0]x[1] h[0]x[2] ×
h[−1]x[−1] h[−1]x[0] h[−1]x[1] h[−1]x[2] ×
h[−2]x[−1] h[−2]x[0] h[−2]x[1] h[−2]x[2] ×
y[−3] y[−2] y[−1] y[0] y[1] y[2] y[3]
The last way to calculate the convolution is using a circulant matrix, where the circular convolution
y[n] = x[n] ~ h[n] is the equivalent to:
x[0] x[3] x[2] x[1] h[0] y[0]
x[1] x[0] x[3] x[2]
h[1] = y[1]
x[2] x[1] x[0] x[3] h[2] y[2]
x[3] x[2] x[1] x[0] h[3] y[3]
Remember you can zero pad the signals to get the linear convolution:
x[−1] 0 0 0 x[2] x[1] x[0] h[−2] y[−3]
x[0] x[−1] 0 0 0 x[2] x[1]
h[−1] y[−2]
x[1] x[0] x[−1] 0 0 0 x[2] h[0] y[−1]
x[2] x[1] x[0] x[−1] 0 0 0 h[1] = y[0]
0 x[2] x[1] x[0] x[−1] 0 0 0 y[1]
0 0 x[2] x[1] x[0] x[−1] 0 0 y[2]
0 0 0 x[2] x[1] x[0] x[−1] 0 y[3]
K
x[n]
If N is very large:
K +M −1
N
1. chop x[n] into K chunks of x[n] ∗ h[n]
length K
2. convolve each chunk with h[n]
y[n]
3. add up the results
4K + M − 1
Other advantages:
If N is very large: K +M −1
x[n]
N
1. chop x[n] into K overlapping
K +M −1
chunks of length K + M − 1
x[n] ~ h[n]
2. ~K+M −1 each chunk with h[n]
3. discard first M − 1 from each
chunk y[n]
4. concatenate to make y[n]
4K
Number of operations: slightly less than overlap-add due to the fact that no additions are needed to create
y[n]. The advantages are the same as with overlap add, however, much less popular than overlap-add
which is strange.
Difference Equations
x[n] y[n]
A difference equation is way of describing most useful LTI
H(z)
systems:
PM PN
y[n] = r=0 b[r]x[n − r] − r=1 a[r]y[n − r]
PN PM
⇔ r=0 a[r]y[n − r] = r=0 b[r]x[n − r], where a[0] = 1
⇔ a[n] ∗ y[n] = b[n] ∗ x[n]
B(z)
⇔ Y (z) = X(z)
A(z)
B(ejω )
⇔ Y (ejω ) = X(ejω )
A(ejω )
(a) Always causal
(b) Order of system is max(M, N ), the highest r with a[r] 6= 0 or b[r] 6= 0
(c) We assume that a[0] = 1; if not, divide A(z) and B(z) by a[0]
(d) Filter is BIBO stable if roots of A(z) all lie within the unit circle
Note the negative sign in the first equation. In [4] the authors reverse the sign of the a[n], however, this
is actually a bad idea.
A digital system in general is described by a difference equation. Here are two examples:
The first one is a non recursive difference equation while the second one is recursive. The important
point to notice is that both these equations implement the same system.
Proof
Note:
(a) FIR filters are normally implemented non recursively but can be implemented recursively.
(b) IIR filters can only be implemented recursively in practice becauseP
an infinite number of coefficients
∞
would be required to realise them non recursively (recall: y[n] = k=−∞ x[k]h[n − k]).
FIR Filters
A Finite Impulse Response (FIR) filter is one where A(z) = 1, and therefore, Y (z) = B(z)X(z).
The impulse response being b[n] with a length of M + 1 and the frequency response being B(ejω ) which
is just the DTFT of b[n].
Note: If M is small then the frequency response only contains low ‘quefrencies’ (‘quefrencies’ is not
jM ω
a typographical error). Also if b[n] is symmetric then H(ejω )e 2 consists of M
2 cosine waves plus a
constant.
M =4 M =16 M =32
|B|
|B|
0.5 0.5 0.5
0.0 0.0 0.0
0 1 2 3 0 1 2 3 0 1 2 3
ω ω ω
2π
Rule of thumb: The fastest possible transition is ∆ω ≤ M (the marked double arrow)
FIR Symmetries
PM
B(ejω ) is determined by the zeros of z M B(z) = r=0 b[M − r]z r
1 1 1
=(z)
=(z)
=(z)
0 0 0
−1 −1 −1
−1 0 1 −1 0 1 −1 0 1
<(z) <(z) <(z)
3
3
10
2
|H|
|H|
|H|
1 5
1
0 0 0
−2 0 2 −2 0 2 −2 0 2
ω ω ω
B(z)
An Infinite Impulse Response (IIR) filter is one where Y (z) = X(z).
A(z)
Factorise QM
jωB(z) b[0]z −M i=1 (1 − qi z −1 )
H(e ) = = QN
A(z) i=1 (1 − pi z
−1 )
The poles pi are the roots of A(z) and B(z). The zeros qi are the zeros of H(z). Note that there are
additional N − M zeros at the origin (which affects only the phase)
QM
jω |b[0]|z −M i=1 |1 − qi z −1 |
|H(e )| = for z = ejω
z −N QN |1 − pi z −1 |
i=1
Example
10.0
1 0.94 1
2.74
7.5 1.23
1.69 2.0
=(z)
=(z)
0.83
|H|
0 0
5.0
2.11
2.5 −1 −1
0.0
0 1 2 3 −1 0 1 −1 0 1
ω <(z) <(z)
Scaling z
z
Given the filter H(z) it is possible to form a new filter HS (z) = H α , which is equivalent to multiplying
a[n] and b[n] by αn .
2 + 2.5z −1
Example: H(z) =
1 − 0.9z −1 + 0.5−2
10.0
1
7.5
=(z)
|H|
0
5.0
−1 2.5
0.0
−1 0 1 0 1 2 3
<(z) ω
z 2 + 2.75z −1
Scale z: HS (z) = H =
1.1 1 − 0.99z −1 + 0.605−2
1
10
=(z)
|H|
0
5
−1
0
−1 0 1 0 1 2 3
<(z) ω
Negating z
Given the filter H(z) it is possible to form a new filter HR (z) = H(−z), which is equivalent to negating
all odd power of z, that is, negating alternate a[n] and b[n].
2 + 2.5z −1
Example: H(z) =
1 − 0.9z −1 + 0.5−2
10.0
1
7.5
=(z)
|H|
0
5.0
−1 2.5
0.0
−1 0 1 0 1 2 3
<(z) ω
2 − 2.5z −1
Negate z: HR (z) = H(−z) = Negate odd coefficients
1 + 0.9z −1 + 0.5−2
10.0
1
7.5
=(z)
|H|
0
5.0
−1 2.5
0.0
−1 0 1 0 1 2 3
<(z) ω
Pole and zero positions are negated, response is flipped and conjugated.
Cubing z
Given the filter H(z) it is possible to form a new filter HC (z) = H(z 3 ), which is equivalent to inserting
two zeros between each a[n] and b[n] term.
2 + 2.5z −1
Example: H(z) =
1 − 0.9z −1 + 0.5−2
10.0
1
7.5
=(z)
|H|
0
5.0
−1 2.5
0.0
−1 0 1 −2 0 2
<(z) ω
2 + 2.5z −3
Cube z: Hc (z) = H(z 3 ) = Insert 2 zeros between coefficients
1 − 0.9z −3 + 0.5−6
10.0
1
7.5
=(z)
|H|
0
5.0
−1 2.5
0.0
−1 0 1 −2 0 2
<(z) ω
Pole and zero positions are replicated. Magnitude response is also replicated.
Group Delay
jω
The group delay is defined τH (ejw ) = − d∠H(e
dω
)
= delay of the modulation envelope.
−d = ln H(ejω ) −1 dH(ejω ) −z dH(z)
τH = == =<
dω H(ejω ) dω H(z) dz
jω
z=e
∞
X
H(ejω ) = h[n]e−jnω = F (h[n]), where F denotes the DTFT.
n=0
∞
dH(ejω ) X
= −jnh[n]e−jnω = −jF (nh[n])
dω n=0
−1 dH(ejω )
F (nh[n]) F (nh[n])
τH = = = < = = j
H(ejω ) dω F (h[n]) F (h[n])
Example:
1 −pe−jω
H(z) = ⇒ τH = −τ[1−p] = −<
1 − pz −1 1 − pe−jω
0.0 1.5
p = 0.6
1 p = 0.6 p = 0.6
−0.2 1.0
=(z)
τH
0 0.5
6
−0.4
0.0
−1
−0.6
−1 0 1 0 1 2 3 0 1 2 3
<(z) ω ω
Minimum Phase
3
Average group delay over ω equals the (#poles - #zeros) within
the unit circle where zeros on the unit circle count for 12 2
|H|
Reflecting an interior zero to the exterior multiplies |H(ejω )| by a 1
constant and increases the average group delay by 1 sample.
0
0 1 2 3
ω
0
1
−5
=(z)
0
6
−1 −10
−1 0 1 0 1 2 3
<(z) ω
1 4
=(z)
2
τH
0
−1
−1 0 1 0 1 2 3
<(z) ω
A filter with all its zeros inside the unit circle is a minimum phase filter:
In contrast a filter with all its zeros outside the unit circle is a maximum phase filter
A filter has linear phase, if and only if, its impulse response h[n] is symmetric or antisymmetric:
Important: This is not the same symmetry that is needed to make the signal real in the frequency
domain, which is when h[n] = h[−n] where M = N − 1.
The frequency response for any BIBO stable filter can be denoted by H(ejω ). Since H(ejω ) is a periodic
function with period 2π, it can be expressed as a Fourier series:
∞
X
H(ejω ) = h[n]e−jωn
n=−∞
Where the Fourier coefficients h[n] are equal to the impulse response samples which are given by:
Z π
1
h[n] = H(ejω )ejωn dω, ∞ < n < ∞
2π −π
Thus given we know H(ejω ), we can compute h[n] using the IDTFT.
1.0 2π/ωc
2ωc
0.5
H
0.0
−2 0 2 0
ω
Note: Width in ω is 2ωc , width in n is 2π/ωc where the product is always 4π.
The problem is h[n] is infinite and non-causal which makes it unreliable To solve this problem we
multiply h[n] by a window (truncating the coefficients) and then shift this new windowed signal to the
right appropriately.
Windowing Method
hT [n] 1.0 M = 12
M = 12 M = 24
|H|
0.5
0.0
0 0 1 2 3
ω
M M
It would then be normal to delay by hT [n] by 2 to make it causal. Which multiplies H(ejω ) by ej 2 ω
.
Gibbs Phenomenon
This type of truncation is optimal in terms of mean square error. If we define the mean squared error in
the frequency domain to be:
Z π
1
E= |H(ejω ) − HT (ejω )|2 dω
2π −π
Z π
1 PM
= |H(ejω ) − −2 M hT [n]e−jωn |2 dω
2π −π 2
Pπ
In this case E is minimised when hT [n] = h[n]. Proof: E = −π |h[n] − hT [n]|2 + |n|>π |h[n]|2
P
From this result it would be easy to assume that a rectangular window is therefore the best choice,
however, this is almost never true due to the fact that no matter how large you make M , there will,
always be a 9% overshoot at any discontinuity. This behaviour is often referred to as ‘Gibbs phenomenon’.
Thus other windows are often used over the rectangular window to introduce a smooth transition in the
filter specification and thus eliminate ‘Gibbs phenomenon’.
Dirichlet Function
The reason behind Gibbs phenomenon can be explained by considering the truncation process which can
be expressed as the multiplication of h[n] by a rectangular window w[n] = δ− M ≤n≤ M .
2 2
This can be alternatively expressed as a circular convolution due to the modulation theorem.
1
HM +1 (ejω ) = H(ejω ) ~ W (ejω )
2π
where
P M2 (i) P M2 (ii) sin([M +1]ω/2)
W (ejω ) = −M
e−jωn = 1 + 2 1 cos(nω) = sin(0.5ω)
2
The proof being: (i) e−jω(−n) + e−jω(+n) = 2 cos(nω) (ii) Sum of a geometric progression
This has the effect of convolving the ideal frequency response with an aliased sinc function, which is
normally called the ‘Dirichlet function’.
−2 0 2 −2 0 2 −2 0 2
ω ω ω
These figures give an illustration of the effect of windowing in the frequency domain.
4π 2π
Provided that M +1 2ωc ⇔ M + 1 ω :
1.0
4π 2π
Passband ripple: ∆ω ≈ M +1 , stopband M +1
0.5
H
Transition peak-to-peak: ∆ω ≈ M4π
+1
Transition gradient: d|H| ≈ M2π+1 0.0
dω
ω=ωc
−2 0 2
ω
Window Relationships
Relationships when you multiply an impulse response h[n] by a window w[n] that is M + 1 long
1
HM +1 (ejω ) = H(ejω ) ~ W (ejω )
2π
1.0 24 M =24
1.0
12
W
0.5
H
0.5
0
0.0
0.0
−2 0 2 −2 0 2 −2 0 2
ω ω ω
w[0] 0.5
W (ejω )dω
R
(a) Passband gain ≈ w[n]; peak ≈ 2 + 2π mainlobe
rectangular window : passband gain = 1; peak gain = 1.09
(d) The features that are narrower than the main lobe will be broadened and attenuated
Common Windows
0.37
Rectangular: 0
-13.0 dB
w[n] = δ− M ≤n≤ M
|W | (dB)
2 2
0.79
Hanning: 0
2πn -31.5 dB
w[n] = 0.5 + 0.5 cos M
|W | (dB)
+1
0.87
Hamming: 0
2πn
w[n] = 0.54 + 0.46 cos M
|W | (dB)
+1 -40.0 dB
Main lobe width: 8π/(M + 1) −50
Relative sidelobe level: 40.0dB
Best peak sidelobe
−100
0 0 1 2 3
Hamming ω
1.19
Blackman-Harris (3-term): 0
2πn 4πn
w[n] = 0.42 + 0.5 cos M +1 + 0.08 cos M +1
|W | (dB)
H(ejω )
Several formulae estimate the required order M of a filter.
1+δ
One that is often used is the ‘Fred Harris approximation’: 1
1−δ
A
M≈ , where A = 20 log10 ()
20(ω2 − ω1 )/2π
This is, of course, of only approximate.
0
0 ω1 ω2 π
For example:
Specifications: 1.00
Ripple: δ = = 0.01
0.25
20 log10 () = −40 dB
20 log10 (1 + 0.01) = 0.09 dB 0.00
0 1 2 3
ω
Order:
A 40
M≈ = = 126
20(ω2 − ω1 )/2π 20(0.1)/2π
sin ω2 n sin ω1 n
h[n] = πn − πn
1.0 0 M = 126
M = 126
0.8 −20
0.4 −60
0.2
−80
0.0
−100
0.0 0.5 1.0 1.5 2.0 2.5 3.0 0 1 2 3
ω ω
Frequency Sampling
In the windowing method we truncate h[n] to ± M2 to make it finite, however, another approach could
be to take the IDFT of M + 1 equally spaced samples of H(ejω ).
On the surface, this appears to be a good idea due to the fact that it has the advantage of giving an
exact match at the sample points.
However, it unfortunately has one big disadvantage which is that the intermediate approximation is poor
if the spectrum varies rapidly.
This can be seen if we design the previous filter using the frequency sampling method with the same
value of M as before. It is clear from the result below, that this is not a great design and clearly worse
than the windowing method.
1.0 1.50
M + 1 = 127 M + 1 = 127
0.8 1.25
1.00
0.6
H
0.75
0.4
0.50
0.2
0.25
0.0 0.00
−3 −2 −1 0 1 2 3 0.0 0.5 1.0 1.5 2.0 2.5 3.0
ω ω
Classical continuous-time filters optimise tradeoff: passband ripple v stopband ripple v transition width.
This means there are explicit formulae for pole/zero positions.
|H|
(1) Monotonic ∀Ω 0.4
1 2N 3 4N
(2) G(Ω) = 1 − 2Ω + 8Ω + ··· 0.2
Bilinear Transform
The bilinear transform is a widely used one-to-one invertible mapping. It involves a change variable:
α+s z−1
z= ⇔s=α
α−s z+1
3.0
2 s-plane 2 z-plane
α=1 α=1
2.5
1 1
2.0
0 0 1.5
ω
−1 −1 1.0
0.5
−2 −2
0.0
−2 0 2 −2 0 2 0.0 2.5 5.0 7.5 10.0
Ω/α
Example:
1
H(s) = and α = 1
s2 + 0.2s + 4
Substitute: s = α z−1
z+1
1 (z + 1)2
H(z) = =
z−1 2 z−1 (z − 1)2 + 0.2(z − 1)(z + 1) + 4(z + 1)2
z+1 + 0.2 z+1 +4
z 2 + 2z + 1 1 + 2z −1 + z −2
= = 0.19
5.2z 2 + 6z + 4.8 1 + 1.15z −1 + 0.92z −2
Frequency response is identical in both magnitude and phase, however, the frequency axis has been
distorted.
Choosing α:
Ωc
Set α = to map Ωc → ωc
tan 12 ωc
2
Set α = 2fs = to map low frequencies to themselves.
T
Impulse Invariance
Bilinear transform works well for a low-pass filter but the non-linear compression of the frequency distorts
any other response. The impulse invariance transformation is an alternative method that obtains the
discrete-time filter by sampling the impulse response of the continuous-time filter.
L −1 sample Z
H(s) −−−→ h(t) −−−−→ h[n] = T × h(nT ) −→ H(z)
Properties:
Example:
|H|
|H|
Then direct forms use coefficients d[k] and p[k] directly. This can be implemented as a cascade of two
filter sections where:
W (z)
H1 (z) = = P (z) = p[0] + p[1]z −1 + p[2]z −2 + · · · + p[M − 1]z −(M −1) + p[M ]z −M
X(z)
and
Y (z) 1 1
H2 (z) = = =
W (z) D(z) 1 + d[1]z + d[2]z + · · · + d[N − 1]z −(N −1) + d[N ]z −N
−1 −2
Note that H1 (z) can be seen as an FIR filter and the time-domain representation of H2 (z) is given by:
y[n] = w[n] − d[1]y[n − 1] − d[2]y[n − 2] − · · · − d[N ]y[n − N ]
p[0]
x[n] w[n] w[n] y[n]
−1 −1
z z
p[1] −d[1]
x[n − 1] y[n − 1]
z −1 z −1
p[2] −d[2]
x[n − 2] y[n − 2]
p[M − 1] −d[N − 1]
x[n − M + 1] y[n − N + 1]
z −1 z −1
p[M ] −d[N ]
x[n − M ] y[n − N ]
Direct Form I
1
Direct form I can be viewed as P (z) followed by D(z) . This leads to the realisation of the original IIR
transfer function:
p[0]
x[n] y[n]
z −1 z −1
p[1] −d[1]
x[n − 1] y[n − 1]
−1 −1
z z
p[2] −d[2]
x[n − 2] y[n − 2]
p[M − 1] −d[N − 1]
x[n − M + 1] y[n − N + 1]
−1 −1
z z
p[M ] −d[N ]
x[n − M ] y[n − N ]
Direct Form II
1
Direct form II implements D(z) followed by P (z):
p[0]
x[n] y[n]
z −1 z −1
−d[1] p[1]
z −1 z −1
−d[2] p[2]
−d[N − 1] p[M − 1]
z −1 z −1
−d[N ] p[M ]
We observe that it is possible to share the delays which gives us the cononic structure below (also called
direct form II):
p[0]
x[n] y[n]
z −1
−d[1] p[1]
z −1
−d[2] p[2]
−d[N − 1] p[M − 1]
z −1
−d[N ] p[M ]
Transposed Forms
It is also possible to convert any structure into an equivalent transposed form. This is achieved in the
following way:
Check: A valid structure must never have any feedback loops that don’t go through a delay (z −1 block).
z −1 z −1
−d[2] p[2]
−d[N − 1] p[M − 1]
z −1 z −1
−d[N ] p[M ]
z −1
p[1] −d[1]
z −1
p[2] −d[2]
p[M − 1] −d[N − 1]
z −1
p[M ] −d[N ]
If all computations were exact, it would not make any difference which of the equivalent structures were
used, however, this is never the case. There are two types of precision errors which are, coefficient
precision and arithmetic precision.
• Coefficient precision:
Coefficients can only be stored to finite precision and, therefore, are not exact. This means
that the filter actually implemented is not correct. This is due to the fact that changes to the
coefficients results in movment of the poles and zeros.
The roots of high order polynomials can be very sensitive to small changes in coefficient values.
A famous example being the Wilkinson’s polynomial. In 1984, he described the personal impact
of this discovery: “Speaking for myself I regard it as the most traumatic experience in my career
as a numerical analyst”
• Arithmetic precision:
It is also not possible to implement exact arithmetic calculations. These errors become
particularly bad when calculating differences between two similar values:
x[n] y[m]
Downsampling ↓K y[m] = x[Km]
( hni
u[m] v[n] u , n|K
Upsampling ↑K v[n] = K
0, else
Example
Resampling Cascades
Proof:
h i h i
1 P
Left side: y[n] = w Qn =x Qn if Q | n else y[n] = 0
h i
P
Right side: v[n] = u[P n] = x Qn if Q | P n
lQ
lQ
z −1 ↑Q = ↑Q z −Q
H(z) ↑Q = ↑Q H(z Q )
Corrollary: H zQ =
↑Q ↓Q H(z)
Example: H(z) = h[0] + h[1]z −1 + h[2]z −2 + · · · and H(z 4 ) = h[0] + h[1]z −4 + h[2]z −8 + · · ·
Let’s assume that h[r] is of length M + 1 so that hQ [n] is of length QM + 1. Note that hQ [n] = 0 except
when Q | n and that h[r] = hQ [Qr].
PQM
w[r] = v[Qr] = s=0 hQ [s]x[Qr − s]
PM PM
= m=0 hQ [Qm]x[Qr − Qm] = m=0 h[m]x[Q(r − m)]
PM
= m=0 h[m]u[r − m] = y[r]
v[n]z −n = n −n
u[m]z −Km = U (z K )
P P P
V (z) = n n s.t. K|n u[ K ]z = m
u[m] v[n]
jω
Spectrum: V (e ) = U (e jKω
) ↑K
Example:
If K =R3 then three images R of the original spectrum are generated and the energy remains unchanged
1 1
i.e. 2π |U (ejω )|2 dω = 2π |V (ejω )|2 dω.
|U (ejω )| |V (ejω )|
1 1
−2 2 ω −2 2 ω
1
PK−1 j2πkn x[n] y[m] xK [n]
Define cK [n] = δK|n = K k=0 e K
↓K ↑K
(
x[n], K|n
Define xK [n] = = cK [n]x[n]
0, K-n
PK−1 −j2πk 1
1 PK−1 −j2πk 1 1
XK (z) = Y (z K ) ⇒ Y (z) = XK (z K ) = 1
X(e K zK) X(z) K k=0 X(e K zK)
K k=0
↓K
Spectrum:
PK−1 j(ω−2πk)
jω jω j2π jω j4π
Y (ejω ) = 1
K k=0 X(e K )= 1
K X(e K ) + X(e K − K ) + X(e K − K ) + ···
Average of K aliased versions, each expanded in ω by a factor of K. This is why downsampling is normally
preceded by a low-pass filter to prevent aliasing.
Example 1:
1 X Y
1
K=3
π
Not quite limited to ± K . The shaded
region highlights the resulting aliasing.
Energy decreases:
1 jω 2 1 1 −2 2 ω −2 2 ω
|X(ejω )|2 dω
R R
2π |Y (e )| dω ≈ K × 2π
Example 2: X Y
1 1
K=3
π π
All engergy between K ≤ |ω| < 2 K .
Therefore no aliasing.
−2 2 ω −2 2 ω
No aliasing
π π
There is no aliasing if all the energy is between r K ≤ |ω| < (r + 1) K for some integer r.
π π
The normal case being when r = 0 where all the energy is between K ≤ |ω| < K.
Effects of downsampling
1 1
1. Total energy multiplied by ≈ K (= K if no aliasing).
2. The average power (energy/sample) ≈ is unchanged.
And then if all the following sequences are upsampled and aligned by delays then, they can be added
together to give:
y[n] = x[n − 2]
x[n] u[m]
↓3 ↑3
z −1 z −1
x[n] c d e f g h i j k l m n
u[m] c f i l p[n]
v[m]
p[n] - c - - f - - i - - l ↓3 ↑3 +
v[m] b e h k
q[n] - b c - e f - h i - k l
w[m] a d g j z −1 z −1
y[n] a b c d e f g h i j k l q[n]
w[m] y[n]
↓3 ↑3 +
Therefore the output y[n] in this case is just a delayed replica of the input x[n].
If the bandpass of a filter only occupies a small fraction of [0, π], it is possible to downsample then
upsample without losing any information.
x[n] y[n]
H(z) ↓K ↑K
K
π
Centre of the transition band must be ≤ intermediate Nyquist freq, K
x[n] y[n]
H(z) ↓4 ↑4
4
ω1 ω2 3 2π/4 3 2π/7 3
2π
The images spaced at K can be removed using another low-pass filter.
x[n] y[n]
H(z) ↓7 ↑7 LPF
7
Note: the passband noise is equal to the noise floor at output of H(z) plus 10 log10 (K − 1) dB.
Polyphase Decomposition
Proof:
PM H1 (z K ) +
H(z) = m=0 h[m]z −m
PK−1 PK−1
= h[m]z −m + m=0 h[m + K]z −(m+K) + · · ·
m=0
PR−1 PK−1
= r=0 m=0 h[m + Kr]z −(m+Kr) z −1
PK−1 PR−1
= m=0 z −m r=0 hm [r]z −Kr
y[n]
where hm [r] = h[m + Kr] HK−1 (z K ) +
PK−1
= m=0 z −m Hm (z K )
Polyphase Downsampler
If H(z) is low-pass so that it is possible to downsample its output by K without the problem of aliasing.
x[n] v[i]
H(z) ↓K
By decomposing H(z) into a a polyphase representation, it is possible to take advantage of the Noble
identities. It is therefore possible to move the downsampling back through the adders and filters. Thus
Hm (z K ) turns into Hm (z) at the lower sample rate. This has the effect of massively reducing the
computation.
x[n] x[n]
H0 (z K ) ↓K H0 (z)
z −1 z −1
H1 (z K ) + ↓K H1 (z) +
z −1 z −1
v[i] v[i]
HK−1 (z K ) + ↓K ↓K HK−1 (z) +
The sample rate at v[i] is now lower, however, it is possible to restore the original sample rate by
upsampling.
Polyphase Upsampler
It is possible to use the same low-pass filter, H(z), in polyphase form. In this case the delay z −m after
the filters. By taking advantage of the Noble identities, it is possible to move the upsampling forward
through the filters. Thus Hm (z K ) turns into Hm (z) at the lower sample rate. This again has the effect
of massively reducing the computation.
v[i] y[n]
v[i] y[n] H0 (z) ↑K +
K +
↑K H0 (z )
z −1
z −1
H1 (z) ↑K +
H1 (z K ) +
z −1
z −1
HK−1 (z) ↑K
HK−1 (z K )
Complete Filter
The extra gain of K is needed to compensate for the downsampling energy loss.
5.7 Resampling
The conditions required to change the sampling rate while preserving information:
Downsample:
π
x[n] y[i]
LPF to new Nyquist bandwidth: ωc = K LPF ↓K
Upsample:
x[i] y[n]
π
LPF to old Nyquist bandwidth: ωc = K ↑K LPF
P
Rational ratio: fs × Q
x[n] y[i]
LPF to lower of old and new Nyquist ↑P LPF ↓Q
π
bandwidth: ωc = max(P,Q)
1 1
Ym (z) = Vm (z 2 ) = {Xm (z) + Xm (−z)} = {Hm (z)Xm (z) + Hm (−z)Xm (−z)}, where k = 2
2 2
F0 (z)
X̂(z) = Y0 (z) Y1 (−z)
F1 (z)
1 H0 (z) H1 (z) F0 (z)
= X(z) X(−z)
2 H0 (−z) H1 (−z) F1 (z)
T (z)
= X(z) X(−z) , where X(−z)A(z) is the ’aliased’ term.
A(z)
we want:
1
T (z) = {H0 (z)F0 (z) + H1 (z)F1 (z)} = z −d
2
1
A(z) = {H0 (−z)F0 (z) + H1 (−z)F1 (z)} = 0
2
Hence: −1 −d
F0 (z) H0 (z) H1 (z) 2z
=
F1 (z) H0 (−z) H1 (−z) 0
2z −d
H1 (−z) −H1 (z) 1
=
H0 (z)H1 (−z) − H1 (z)H0 (−z) −H0 (−z) H0 (z) 0
2z −d
H1 (−z)
=
H0 (z)H1 (−z) − H1 (z)H0 (−z) −H0 (−z)
For all filters to be FIR, we need the denominator to be
which implies:
F0 (z) 2 H1 (−z) d=k 2 H1 (−z)
= z k−d =
F1 (z) c −H0 (−z) c −H0 (−z)
1 1
Hi (z) is scaled by c 2 and Fi (z) is scaled by c− 2
QMF satisfies:
QMF is alias-free:
1
A(z) = {H0 (−z)F0 (z) + H1 (−z)F1 (z)}
2
1
= {H1 (z)H0 (z) − H0 (z)H1 (z)} = 0
2
H0 (z) = E0 (z 2 ) + z −1 E1 (z 2 )
H1 (z) = H0 (−z) = E0 (z 2 ) − z −1 E1 (z 2 )
F0 (z) = H0 (z) = E0 (z 2 ) + z −1 E1 (z 2 )
E0 (z 2 )
H0 (z) 1 1
=
H1 (z) 1 −1 z −1 E1 (z 2 )
Therefore
F0 (z)
X̂(z) = X(z) H0 (z) H1 (z)
F1 (z)
By substitution can be written in this way:
E0 (z 2 )
2 −1 2
1 1 1 1
X̂(z) = X(z) E0 (z ) z E1 (z )
1 −1 1 −1 z −1 E1 (z 2 )
x[n]
E0 (z 2 ) + ↓2 ↑2 + E1 (z 2 )
z −1 z −1
x̂[n]
E1 (z 2 ) − + ↓2 ↑2 − + E0 (z 2 ) +
This reduces the computational complexity by a factor of 2 as the processing is now performed on half
the samples.
By applying the Noble identities, it is possible to obtain the following structure in which all filtering is
carried out efficiently at the lowest possible sampling rate
x[n]
↓2 E0 (z) + + E1 (z) ↑2
z −1 z −1
x̂[n]
↓2 E1 (z) + + E0 (z) ↑2
− −
This reduces the computational complexity again by a factor of 2 and, therefore, the polyphase QMF
reduces the overall computational complexity by a factor of 4.
References
[1] Patrick A. Naylor, lecture slides. Course: ELEC96010 (EE3-07) Digital Signal Processing.
Imperial College London
[2] Mike Brookes, lecture slides. Course: ELEC97023 (EE4-12) Digital Signal Processing and Digital
Filters.
Imperial College London
[3] Roy S. C. Dutta, lecture slides Course: Digital Signal Processing.
Indian Institute of Technology
[4] John G. Proakis and Dimitris G. Manolakis, Digital Signal Processing: Principles, Algorithms, and
Applications, 1996.
Prentice-Hall, Inc