Mike Brookes
1: Introduction
Organization
18 lectures: feel free to ask questions
Signals
Processing Textbooks:
Syllabus
Sequences
(a) Mitra Digital Signal Processing ISBN:0071289461 41 covers
Time Scaling most of the course except for some of the multirate stuff
z-Transform
Region of (b) Harris Multirate Signal Processing ISBN:0137009054 49
Convergence
z-Transform examples covers multirate material in more detail but less rigour than
Rational z-Transforms
Rational example
Mitra
Inverse z-Transform
MATLAB routines Lecture slides available via Blackboard or on my website:
Summary
http://www.ee.ic.ac.uk/hp/staff/dmb/courses/dspdf/dspdf.htm
quite dense - ensure you understand each line
email me if you dont understand or dont agree with anything
Prerequisites: 3rd year DSP - attend lectures if dubious
Exam + Formula Sheet (past exam papers + solutions on website)
Problems: Mitra textbook contains many problems at the end of each
chapter and also MATLAB exercises
1: Introduction
Organization
A signal is a numerical quantity that is a function of one or more
Signals independent variables such as time or position.
Processing
Syllabus
Sequences
Real-world signals are analog and vary continuously and take
Time Scaling continuous values.
z-Transform
Region of
Convergence Digital signals are sampled at discrete times and are quantized to a
z-Transform examples
Rational z-Transforms
finite number of discrete values
Rational example
Inverse z-Transform We will mostly consider one-dimensionsal real-valued signals with
MATLAB routines
Summary
regular sample instants; except in a few places, we will ignore the
quantization.
Extension to multiple dimensions and complex-valued signals
is straighforward in many cases.
Examples:
1: Introduction
Organization
Aims to improve a signal in some way or extract some information
Signals from it
Processing
Syllabus Examples:
Sequences
Time Scaling
z-Transform Modulation/demodulation
Region of
Convergence Coding and decoding
z-Transform examples
Rational z-Transforms Interference rejection and noise suppression
Rational example
Inverse z-Transform Signal detection, feature extraction
MATLAB routines
Summary
We are concerned with linear, time-invariant processing
1: Introduction
Organization
Main topics:
Signals
Processing
Syllabus Introduction/Revision
Sequences
Time Scaling Transforms
z-Transform
Region of
Convergence
Discrete Time Systems
z-Transform examples
Rational z-Transforms
Filter Design
Rational example
Inverse z-Transform
MATLAB routines
FIR Filter Design
Summary
IIR Filter Design
Multirate systems
Multirate Fundamentals
Multirate Filters
Subband processing
1: Introduction
Organization
We denote the nth sample of a signal as x[n] where < n < + and
Signals the entire sequence as {x[n]} although we will often omit the braces.
Processing
Syllabus
Sequences Special sequences: (
Time Scaling
1 n0
z-Transform
Region of
Unit step: u[n] =
Convergence 0 otherwise
z-Transform examples
(
Rational z-Transforms 1 n=0
Rational example Unit impulse: [n] =
Inverse z-Transform 0 otherwise
MATLAB routines (
Summary 1 condition is true
Condition: condition [n] = (e.g. u[n] = n0 )
0 otherwise
Right-sided: x[n] = 0 for n < Nmin
Left-sided: x[n] = 0 for n > Nmax
Finite length: x[n] = 0 for n / [Nmin , Nmax ]
Causal: x[n] = 0 for n < 0, Anticausal: x[n] = 0 for n > 0
P 2
Finite Energy: n=P |x[n]| < (e.g. x[n] = n1 u[n 1])
Absolutely Summable: n= |x[n]| < Finite energy
n 1
1: Introduction
Organization
For sampled signals, the nth sample is at time t = nT = fs where fs = T
Signals
Processing
is the sample frequency.
Syllabus
Sequences Often easiest to scale time so that fs = 1 Hz. E.g. to design a 1 kHz
Time Scaling
low-pass filter for fs = 44.1 kHz we can design a 0.0227 Hz filter for
z-Transform
Region of
Convergence
fs = 1 Hz.
z-Transform examples
Rational z-Transforms To scale back to real-world values: Every quantity of dimension (Time)n is
Rational example
Inverse z-Transform
multiplied by T n (or equivalently by fsn ). Thus all times are multiplied by
MATLAB routines T and all frequencies and angular frequencies by T 1 .
Summary
1: Introduction
Organization
The z-transform converts a sequence, {x[n]}, into a function, X(z), of an
Signals arbitrary complex-valued variable z.
Processing
Syllabus
Sequences
Why do it?
Time Scaling
z-Transform Complex functions are easier to manipulate than sequences
Region of
Convergence
z-Transform examples Useful operations on sequences correspond to simple operations on
Rational z-Transforms
Rational example
the z-transform:
Inverse z-Transform
MATLAB routines addition, multiplication, scalar multiplication, time-shift,
Summary
convolution
Definition: X(z) = + n
P
n= x[n]z
1: Introduction
Organization
The set of z for which X(z) converges is its Region of Convergence (ROC).
Signals
Processing Complex analysis : the ROC of a power series (if it exists at all) is always
Syllabus
Sequences
an annular region of the form 0 Rmin < |z| < Rmax .
Time Scaling
z-Transform X(z) will always converge absolutely inside the ROC and may converge on
Region of
Convergence some, all, or none of the boundary.
P+
z-Transform examples
Rational z-Transforms
converge absolutely n= |x[n]z n | <
Rational example
Inverse z-Transform finite length Rmin = 0, Rmax =
MATLAB routines
Summary
ROC may included either, both or none of 0 and
absolutely summable X(z) converges for |z| = 1.
right-sided & |x[n]| < A B n Rmax =
+ causal X() converges
left-sided & |x[n]| < A B n Rmin = 0
+ anticausal X(0) converges
Note: Examples 4 and 5 have the same z-transform but different ROCs.
q z q r+1 z r1
Pr
Geometric Progression: n=q n z n = 1z 1
1: Introduction
Organization
Most z-transforms that we will meet are rational polynomials with real
Signals coefficients, usually one polynomial in z 1 divided by another.
Processing
QM QM
Syllabus (
m=1 1zm z
1
) (zzm )
Sequences G(z) = g QK = gz KM Qm=1
K
k=1 (1pk z
1 )
Time Scaling k1 (zpk )
z-Transform
Region of Completely defined by the poles, zeros and gain.
Convergence
z-Transform examples
Rational The absolute values of the poles define the ROCs:
z-Transforms
R + 1 different ROCs
Rational example
Inverse z-Transform where R is the number of distinct pole magnitudes.
MATLAB routines
Summary
1: Introduction 82z 1
Organization G(z) = 44z 1 3z 2
Signals
Processing 2z(z0.25))
Syllabus Poles/Zeros: G(z) = (z+0.5)(z1.5)
Sequences
Time Scaling
Poles at z = {0.5, +1.5)},
z-Transform
Region of
Zeros at z = {0, +0.25}
Convergence
z-Transform examples
Rational z-Transforms
0.75 1.25
Rational example Partial Fractions: G(z) = 1+0.5z 1 + 11.5z 1
Inverse z-Transform
MATLAB routines
0.75 1.25
Summary ROC ROC 1+0.5z 1 11.5z 1 G(z)
1
1: Introduction
G(z)z n1 dz where the integral is anti-clockwise around a
H
Organization
g[n] = 2j
Signals
Processing
circle within the ROC, z = Rej .
Syllabus
Sequences Proof: H P
Time Scaling 1 n1 1 n1
H m
z-Transform 2j G(z)z dz= 2j m= g[m]z z dz
Region of
(i) P 1
H nm1
Convergence
z-Transform examples
= m= g[m] 2j z dz
Rational z-Transforms (ii) P
Rational example = m= g[m][n m]= g[n]
Inverse
z-Transform
(i) depends on the circle with radius R lying within the ROC
MATLAB routines
Summary
1
H k1
(ii) Cauchys theorem: 2j z dz = [k] for z = Rej anti-clockwise.
dz j 1
H k1 1
R 2 k1 j(k1)
d = jRe 2j z dz = 2j =0 R e jRej d
Rk 2 jk
R
= 2 =0 e d
= Rk (k)= (k) [R0 = 1]
In practice use a combination of partial fractions and table of z-transforms.
1: Introduction
b(z 1)
Organization tf2zp,zp2tf a(z 1 ) {zm , pk , g}
Signals
b(z 1) P rk
Processing
Syllabus
residuez a(z )1 k 1pk z 1
Sequences b(z 1) Q b0,l +b1,l z1 +b2,l z2
Time Scaling tf2sos,sos2tf a(z 1 ) l 1+a1,l z 1 +a2,l z 2
z-Transform Q b0,l +b1,l z1 +b2,l z2
Region of
Convergence
zp2sos,sos2zp {zm , pk , g} l 1+a1,l z1 +a2,l z2
(
z-Transform examples
Rational z-Transforms
x = Ax + Bu
Rational example
zp2ss,ss2zp {zm , pk , g}
Inverse z-Transform
y = Cx + Du
MATLAB routines
(
Summary b(z 1) x = Ax + Bu
tf2ss,ss2tf a(z 1 )
y = Cx + Du
1: Introduction
Organization
Time scaling: assume fs = 1 Hz so <
Signals
z-transform: X(z) = + n
P
Processing n= x[n]
Syllabus
Sequences ROC: 0 Rmin < |z| < Rmax
Time Scaling
z-Transform Causal: ROC
Region of
Convergence Absolutely summable: |z| = 1 ROC
z-Transform examples
1
Inverse z-transform: g[n] = 2j G(z)z n1 dz
H
Rational z-Transforms
Rational example
Inverse z-Transform Not unique unless ROC is specified
MATLAB routines
Summary Use partial fractions and/or a table
2: Three Different
Fourier Transforms
Three different Fourier Transforms:
Fourier Transforms
Convergence of
DTFT
Continuous-Time Fourier Transform (CTFT): x(t) X(j)
DTFT Properties Discrete-Time Fourier Transform (DTFT): x[n] X(ej )
DFT Properties
Symmetries
Discrete Fourier Transform (DFT): x[n] X[k]
Parsevals Theorem
Convolution Forward Transform Inverse Transform
Sampling Process R R
1
Zero-Padding CTFT X(j) = x(t)ejt dt x(t) = 2 X(j)ejt d
Phase Unwrapping R
j 1
x[n] = 2 X(ej )ejn d
P
Summary DTFT X(e ) = x[n]ejn
MATLAB routines PN 1 PN 1
kn 1 kn
DFT X[k] = 0 x[n]ej2 N x[n] = N 0 X[k]ej2 N
We use for real and = T for normalized angular frequency.
Nyquist frequency is at Nyq = 2 f2s = T and Nyq = .
For power signals (energy time interval), CTFT & DTFT are
unbounded.
Fix this by normalizing:
1
RA
X(j) = limA 2A A x(t)ejt dt
j 1
PA
X(e ) = limA 2A A x[n]ejn
2: Three Different j
P
Fourier Transforms DTFT: X(e ) = x[n]ejn does not converge for all x[n].
Fourier Transforms j
PK
Convergence of Consider the finite sum: XK (e ) = K x[n]ejn
DTFT
DTFT Properties
DFT Properties
Strong Convergence:
j
Symmetries x[n] absolutely summable X(e ) converges uniformly
Parsevals Theorem
Convolution
P
|x[n]| < sup
X(ej ) XK (ej ) 0
K
Sampling Process
Zero-Padding
Phase Unwrapping Weaker convergence:
Summary x[n] finite energy X(ej ) converges in mean square
MATLAB routines
j 2
P 2 1
R j
|x[n]| < 2 X(e ) XK (e ) d 0
K
sin 0.5n
Example: x[n] = n
1 K=5 1 K=20 1 K=50
0.8 0.8 0.8
0.6 0.6 0.6
j
j
K
K
0.4 0.4 0.4
0.2 0.2 0.2
0 0 0
-0.2 -0.2 -0.2
0 0.1 0.2 0.3 0.4 0.5 0 0.1 0.2 0.3 0.4 0.5 0 0.1 0.2 0.3 0.4 0.5
/2 (rad/sample) /2 (rad/sample) /2 (rad/sample)
Gibbs phenomenon:
Converges at each as K but peak error does not get smaller.
DSP and Digital Filters (2015-7036) Fourier Transforms: 2 3 / 13
[DTFT Convergence Proofs]
2: Three Different j
P
Fourier Transforms DTFT: X(e ) = x[n]ejn
Fourier Transforms
Convergence of DTFT is periodic in : X(ej(+2m ) = X(ej ) for integer m.
DTFT
DTFT Properties z-Transform evaluated at the point ej :
DTFT is the P
DFT Properties
Symmetries X(z) = x[n]z n
Parsevals Theorem
Convolution
DTFT converges iff the ROC includes |z| = 1.
Sampling Process
Zero-Padding DTFT is the same as the CTFT of a signal comprising impulses at
Phase Unwrapping
Summary P (Dirac functions) of P
the sample times appropriate heights:
MATLAB routines x (t) = x[n](t nT )= x(t) (t nT )
Equivalent to multiplying a continuous x(t) by an impulse train.
j
P
Proof: X(e ) = x[n]ejn
j Tt
P R
n= x[n] (t nT )e dt
(i) R P t
= n= x[n](t nT )ej T dt
(ii) R
= x (t)ejt dt
(i) OK if
P
|x[n]| < . (ii) use = T .
2: Three Different PN 1 kn
Fourier Transforms DFT: X[k] = 0 x[n]ej2 N
Fourier Transforms
j
Convergence of
P
DTFT DTFT: X(e ) = x[n]ejn
DTFT Properties
DFT Properties
Symmetries Case 1: x[n] = 0 for n
/ [0, N 1]
Parsevals Theorem
2
Convolution
Sampling Process
DFT is the same as DTFT at k = N k.
Zero-Padding
Phase Unwrapping The {k } are uniformly spaced from = 0 to = 2 NN1 .
Summary
MATLAB routines
DFT is the z-Transform evaluated at N equally spaced points
around the unit circle beginning at z = 1.
where XK (ej ) = K
P
K x[n]e
jn
2: Three Different
Fourier Transforms If x[n] has a special property then X(ej )and X[k] will have corresponding
Fourier Transforms
Convergence of
properties as shown in the table (and vice versa):
DTFT
DTFT Properties
DFT Properties
Symmetries
One domain Other domain
Parsevals Theorem
Convolution
Discrete Periodic
Sampling Process Symmetric Symmetric
Zero-Padding
Phase Unwrapping Antisymmetric Antisymmetric
Summary
MATLAB routines
Real Conjugate Symmetric
Imaginary Conjugate Antisymmetric
Real + Symmetric Real + Symmetric
Real + Antisymmetric Imaginary + Antisymmetric
2: Three Different
Fourier Transforms
Fourier transforms preserve energy
Fourier Transforms
2
|x(t)| dt = 2 |X(j)|2 d
1
R R
Convergence of
DTFT
CTFT
j 2
DTFT Properties
P 2 1
R
DFT Properties
DTFT |x[n]| = 2 X(e ) d
Symmetries PN 1 2 1
PN 1 2
Parsevals DFT 0 |x[n]| = N 0 |X[k]|
Theorem
Convolution
Sampling Process
More generally, they actually preserve complex inner products:
Zero-Padding
Phase Unwrapping PN 1 PN 1
1
Summary 0 x[n]y [n] =
N 0 X[k]Y [k]
MATLAB routines
2: Three Different
Fourier Transforms
DTFT: Convolution Product
P
Fourier Transforms
Convergence of
x[n] = g[n] h[n]= k= g[k]h[n k]
DTFT X(ej ) = G(ej )H(ej )
DTFT Properties
DFT Properties
Symmetries DFT: Circular convolutionPProduct
Parsevals Theorem
Convolution
x[n] = g[n] N h[n]= N 1
k=0 g[k]h[(n k)modN ]
Sampling Process X[k] = G[k]H[k]
Zero-Padding
Phase Unwrapping
Summary
DTFT: Product Circular Convolution 2
MATLAB routines y[n] = g[n]h[n] R
1 1
Y (e ) = 2 G(e ) H(e ) = 2 G(ej )H(ej() )d
j j j
DTFT
Window
DFT
DFT
2: Three Different
Fourier Transforms
Zero padding means added extra zeros onto the end of x[n] before
Fourier Transforms
Convergence of
performing the DFT.
DTFT
DTFT Properties
DFT Properties Time x[n] Frequency |X[k]|
Symmetries
Parsevals Theorem
Convolution Windowed
Sampling Process
Zero-Padding Signal
Phase Unwrapping
Summary
MATLAB routines
With zero-
padding
2: Three Different
Fourier Transforms
Phase of a DTFT is only defined to within an integer multiple of 2.
Fourier Transforms
Convergence of
DTFT
DTFT Properties 6
DFT Properties
4
Symmetries
Parsevals Theorem 2
Convolution
Sampling Process 0
-2 0 2
Zero-Padding (rad/sample)
Phase Unwrapping
Summary x[n] |X[k]|
MATLAB routines
0
2
0 -20
-2
-40
-2 0 2 -2 0 2
(rad/sample) (rad/sample)
2: Three Different
Fourier Transforms
Three types: CTFT, DTFT, DFT
Fourier Transforms
Convergence of
DTFT DTFT = CTFT of continuous signal impulse train
DTFT Properties
DFT Properties
DFT = DTFT of periodic or finite support signal
Symmetries
Parsevals Theorem DFT is a scaled unitary transform
Convolution
Sampling Process
Zero-Padding DTFT: Convolution Product; Product Circular Convolution
Phase Unwrapping
Summary DFT: Product Circular Convolution
MATLAB routines
DFT: Zero Padding Denser freq sampling but same resolution
Phase is only defined to within a multiple of 2.
Whenever you integrate frequency components you get a scale factor
1
2 for CTFT and DTFT or N1 for DFT
Inverse transform, Parseval, frequency domain convolution
2: Three Different
Fourier Transforms fft, ifft DFT with optional zero-padding
Fourier Transforms
Convergence of
fftshift swap the two halves of a vector
DTFT
DTFT Properties
conv convolution or polynomial multiplication (not
DFT Properties circular)
Symmetries
Parsevals Theorem x[n]y[n] real(ifft(fft(x).*fft(y)))
Convolution
Sampling Process
unwrap remove 2 jumps from phase spectrum
Zero-Padding
Phase Unwrapping
Summary
MATLAB routines
3: Discrete Cosine
Transform For processing 1-D or 2-D signals (especially coding), a common method is
DFT Problems
to divide the signal into frames and then apply an invertible transform to
DCT
DCT of sine wave each frame that compresses the information into few coefficients.
DCT/DFT
Equivalence
DCT Properties The DFT has some problems when used for this purpose:
IDCT
N
Energy Conservation N real x[n] N complex X[k] : 2 real, 2 1 conjugate pairs
Energy Compaction
Frame-based coding
Lapped Transform
MDCT (Modified
DCT)
MDCT Basis
Elements
Summary
MATLAB routines DFT the DTFT of a periodic signal formed by replicating x[n] .
Spurious frequency components from boundary discontinuity.
N=20
f=0.08
3: Discrete Cosine
Transform To form the Discrete Cosine Transform (DCT), replicate x[0 : N 1] but in
DFT Problems
DCT
reverse order and insert a zero between each pair of samples:
DCT of sine wave y[r]
DCT/DFT
Equivalence
DCT Properties
IDCT
Energy Conservation
Energy Compaction
0 12 23
Frame-based coding
Lapped Transform Take the DFT of length 4N real, symmetric, odd-sample-only sequence.
MDCT (Modified
DCT) Result is real, symmetric and anti-periodic: only need first N values
MDCT Basis
Elements Y[k]
Summary
MATLAB routines
12
0 23
PN 1
Forward DCT: XC [k] = n=0 x[n] cos 2(2n+1)k
4N for k = 0 : N 1
PN 1
Compare DFT: XF [k] = n=0 x[n] exp j2(4n+0)k
4N
3: Discrete Cosine PN 1
Transform DCT: XC [k] = n=0 x[n] cos 2(2n+1)k
4N
DFT Problems
DCT m m
DCT of sine wave
f= N f 6= N
DCT/DFT
Equivalence
DCT Properties
IDCT x[n] N=20 N=20
Energy Conservation f=0.10 f=0.08
Energy Compaction
Frame-based coding
Lapped Transform
MDCT (Modified
DCT) |XF [k]|
MDCT Basis
Elements
Summary
MATLAB routines
|XC [k]|
DCT/DFT
Equivalence 0
r even
Define y[r] = x r1
DCT Properties
IDCT 2 r odd, 1 r 2N 1
4N 1r
Energy Conservation
Energy Compaction
x 2 r odd, 2N + 1 r 4N 1
Frame-based coding
YF [k] = 4N
P 1 kr b j 2b
Lapped Transform
r=0 y[r]W 4N where W a = e a
MDCT (Modified
DCT) (i) P2N 1 (2n+1)k
MDCT Basis = n=0 y[2n + 1]W4N
Elements
Summary (ii) PN 1 (2n+1)k
MATLAB routines = n=0 y[2n + 1]W4N
PN 1 (4N 2m1)k
+ m=0 y[4N 2m 1]W4N
(iii) PN 1 (2n+1)k PN 1 (2m+1)k
= n=0 x[n]W 4N + m=0 x[m]W 4N
PN 1
= 2 n=0 x[n] cos 2(2n+1)k 4N = 2XC [k]
(i) odd r only: r = 2n + 1, (ii) reverse order for n N : m = 2N 1 n
4N k
4N k
(iii) substitute y definition & W4N = ej2 4N 1
3: Discrete Cosine PN 1
Transform Definition: X[k] = n=0 x[n] cos 2(2n+1)k
4N
DFT Problems
DCT Linear: x[n] + y[n] X[k] + Y [k]
DCT of sine wave
DCT/DFT
DFT ConvolutionMultiplication property does not hold /
Equivalence
DCT Properties
Symmetric: X[k] = X[k] since cos k = cos +k
IDCT Anti-periodic: X[k + 2N ] = X[k] because:
Energy Conservation
Energy Compaction
cos ( + ) = cos
Frame-based coding 2(2n + 1)(k + 2N ) = 2(2n + 1)k + 8N n + 4N
Lapped Transform
MDCT (Modified X[N ] = 0 since X[N ] = X[N ] = X[N + 2N ]
DCT)
MDCT Basis Periodic: X[k + 4N ] = X[k + 2N ] = X[k]
Elements
Summary
DCT basis functions:
MATLAB routines
3:
0:
1: 4:
2: 5:
3: Discrete Cosine 1
P4N 1 rk 1
P4N 1 rk
Transform y[r] = 4N k=0 Y [k]W4N = 2N k=0 X[k]W4N
DFT Problems
1
P4N 1 (2n+1)k
DCT x[n] = y[2n + 1] = 2N k=0 X[k]W4N [Y [k] = 2X[k]]
DCT of sine wave
DCT/DFT Y[k]
Equivalence (i)1
P2N 1 (2n+1)k
DCT Properties = 2N k=0 X[k]W 4N 0
12
23
IDCT 1
P 2N 1 (2n+1)(l+2N )
Energy Conservation 2N l=0 X[l]W 4N
Energy Compaction
Frame-based coding (ii) 1 P2N 1 (2n+1)k 2b
Lapped Transform = N k=0 X[k]W4N Wab = ej a
MDCT (Modified
DCT) (iii) 1 1
PN 1 (2n+1)k (2n+1)N
MDCT Basis = N X[0] + N k=1 X[k]W4N + N1 X[N ]W4N
Elements PN 1 (2n+1)(2N r)
1
Summary + N r=1 X[2N r]W4N
MATLAB routines
(iv) 1 1
PN 1 (2n+1)k
= N X[0] + N k=1 X[k]W4N
1
PN 1 (2n+1)r+2N
+ N r=1 X[r]W4N
P 1 2(2n+1)k
x[n] = N1 X[0] + N2 N k=1 X[k] cos 4N = Inverse DCT
(i) k = l + 2N for k 2N and X[k + 2N ] = X[k]
(2n+1)(l+2N ) (2n+1)l 1 j2 (n+ 12 )
(ii) 4N = 4N + n + 2 and e = 1
(iii) k = 2N r for k > N (iv) X[N ] = 0 and X[2N r] = X[r]
Energy Compaction
Frame-based coding
PN 1 2
Lapped Transform
Energy: E = n=0 |x[n]| : E 2E 8N E 0.5N E
MDCT (Modified
|X|2 [0] + N2 n=1
PN 1
DCT)
MDCT Basis
E= 1
N |X|2 [n]
Elements
Summary
MATLAB routines Orthogonal DCT (preserves
q energy) q
Define: c[0] = N1 , c[k 6= 0] = N2
PN 1
ODCT: X[k] = c[k] n=0 x[n] cos 2(2n+1)k
4N
PN 1
IODCT: x[n] = k=0 c[k]X[k] cos 2(2n+1)k
4N
3: Discrete Cosine
Transform If consecutive x[n] are positively correlated, DCT concentrates energy in a
DFT Problems
DCT
few X[k] and decorrelates them.
DCT of sine wave p
DCT/DFT Example: Markov Process: x[n] = x[n 1] + 1 2 u[n]
Equivalence
DCT Properties where
u[n] is i.i.d. unit Gaussian.
IDCT
Energy Conservation
Then x2 [n] = 1 and hx[n]x[n 1]i = .
Covariance of vector x is Si,j = xx i,j = |ij| .
Energy
H
Compaction
Frame-based coding
Lapped Transform Suppose ODCT of x is Cx D and DFT Eis Fx.
MDCT (Modified
DCT)
MDCT Basis
Covariance of Cx is CxxH CH = CSCH (similarly FSFH )
Elements
Summary
Diagonal elements give mean coefficient energy.
MATLAB routines 100
Used in MPEG and JPEG (superseded by
DCT
Cumulative energy (%)
90
50
spectral coeficients: DCT of log spectrum
=0.9
N=32
5 10 15 20 25 30
No of coefficients
3: Discrete Cosine
Transform Divide continuous signal
x[n]
DFT Problems into frames
DCT
DCT of sine wave X[k] k=30/220
DCT/DFT Apply DCT to each frame
Equivalence
DCT Properties y[n]
IDCT
Encode DCT
y[n]-x[n]
Energy Conservation
Energy Compaction e.g. keep only 30 X[k]
Frame-based
coding Apply IDCT y[n]
Lapped Transform
MDCT (Modified
DCT)
MDCT Basis
Problem: Coding may create discontinuities at frame boundaries
Elements
Summary
e.g. JPEG, MPEG use 8 8 pixel blocks
MATLAB routines
3: Discrete Cosine
Transform Modified Discrete Cosine Transform (MDCT): overlapping frames 2N long
DFT Problems
DCT
DCT of sine wave
x[0 : 2N 1]
DCT/DFT MDCT
Equivalence X0 [0 : N 1] x[n] N 2N 3N 4N
P2N 1
MDCT: X[k] = n=0 x[n] cos 2(2n+1+N
8N
)(2k+1)
0k<N
PN 1
IMDCT: y[n] = 1
N k=0 X[k] cos 2(2n+1+N
8N
)(2k+1)
0 n < 2N
1 T 1 T
If x, X and y are column vectors, then X = Mx and y = N M X = N M Mx
where M is an N 2N matrix with mk,n = cos 2(2n+1+N
8N
)(2k+1)
.
Quasi-Orthogonality: The 2N 2N matrix, N1 MT M, is almost the identity:
1 0 0 1
1 T 1 IJ 0 .. . . .. , J = .. . ..
M M = 2 with I = . . . . . . .
N 0 I+J
0 1 1 0
When two consective y frames are overlapped by N samples, the second half of the first
frame has thus been multiplied by 12 (I + J) and the first half of the second frame by
1
2 (I J). When these y frames are added together, the corresponding x samples have
been multiplied by 21 (I + J) + 12 (I J) = I giving perfect reconstruction.
Normally the 2N -long x and y frames are windowed before the MDCT and again after the
IMDCT to avoid any discontinuities; if the window is symmetric and satisfies
w2 [i] + w2 [i + N ] = 2 the perfect reconstruction property is still true.
DSP and Digital Filters (2015-7058) Transforms: 3 12 / 15
1 T
[Deriving the value of N M M]
N 1
1 X
arn = mkr mkn
N k=0
N 1
1 X
= cos ((2r + 1 + N )(2k + 1)) cos ((2n + 1 + N )(2k + 1))
N k=0
N 1 N 1
1 X 1 X
= cos (2(r n)(2k + 1)) + cos (2(r + n + 1 + N )(2k + 1))
2N k=0 2N k=0
1 1
where, in the last line, we used the identity cos cos = 2
cos ( ) + 2
cos ( + ).
We now convert these terms to complex exponentials to sum them as geometric progressions.
2
Converting to a the real part () of geometric progression (with = 8N
):
N N
1 1
!
1 X 1 X
cos (2(r n)(2k + 1)) = exp (j2(r n)(2k + 1))
2N k=0
2N k=0
N 1
!
1 X
= exp (j2(r n)) exp (j4(r n)k)
2N k=0
1 1 exp (j4(r n)N )
= exp (j2(r n))
2N 1 exp (j4(r n))
1 1 exp (j4(r n)N )
=
2N exp (j2(r n)) exp (j2(r n))
1 1 exp (j4(r n)N )
=
2N 2j sin (2(r n))
1 sin (4(r n)N ) 1 sin ((r n))
= =
4N sin rn
4N sin (2(r n)) 2N
The numerator is sine of a multiple of and is therefore 0. Therefore the whole sum is zero unless
the denominator is zero or, equivalently, (r n) is a multiple of 2N . Since 0 r, n < 2N , this only
1 PN 1 1
happens when r = n in which case the sum becomes 2N k=0 cos 0 = 2 .
1 PN 1
2N k=0 cos (2(r + n + 1 + N )(2k + 1)) is the same as before with r n replaced by r + n + 1 + N .
We can therefore write
N 1
1 X 1 sin ((r + n + 1 + N ))
cos (2(r + n + 1 + N )(2k + 1)) =
2N k=0 4N sin r+n+1+N
2N
The numerator is again the sine of a multiple of and is therefore 0. Therefore the whole sum is zero
unless (r + n + 1 + N ) is a multiple of 2N . This only happens when r + n = N 1 or 3N 1 since
0 r, n < 2N . The constraint r + n = N 1 corresponds to the anti-diagonal of the top left quadrant
of the A matrix, while r + n = 3N 1 corresponds to the anti-diagonal of the bottom right quadrant.
1 sin(x)
Writing r + n + 1 + N = x, we can use LHpitals rule to evaluate 4N sin( x )
at x = {2N, 4N }.
2N
1 cos(x)
1 1
Differentiating numerator and denominator gives 2 cos( x )
which comes to 2 , 2 respectively at
2N
x = {2N, 4N }.
M=
0.56 0.20 0.20 0.56 0.83 0.98 0.98 0.83
0.98 0.56 0.56 0.98 0.20 0.83 0.83 0.20
0.20 0.83 0.83 0.20 0.98 0.56 0.56 0.98
0.83 0.98 0.98 0.83 0.56 0.20 0.20 0.56
The basis frequencies are {0.5, 1.5, 2.5, 3.5} times the fundamental.
3: Discrete Cosine
Transform DCT: Discrete Cosine Transform
DFT Problems
Equivalent to a DFT of time-shifted double-length x x
DCT
DCT of sine wave Often scaled to make an orthogonal transform (ODCT)
DCT/DFT
Equivalence Better than DFT for energy compaction and decorrelation ,
DCT Properties
IDCT
Energy Compaction: Most energy is in only a few coefficients
Energy Conservation Decorrelation: The coefficients are uncorrelated with each other
Energy Compaction
Frame-based coding Nice convolution property of DFT is lost /
Lapped Transform
MDCT (Modified
DCT)
MDCT: Modified Discrete Cosine Transform
MDCT Basis Lapped transform: 2N N 2N
Elements
Summary Aliasing errors cancel out when overlapping output frames are added
MATLAB routines
Similar to DCT for energy compaction and decorrelation ,
Overlapping windowed frames can avoid edge discontinuities ,
Used in audio coding: MP3, WMA, AC-3, AAC, Vorbis, ATRAC
For further details see Mitra: 5.
3: Discrete Cosine
Transform dct, idct ODCT with optional zero-padding
DFT Problems
DCT
DCT of sine wave
DCT/DFT
Equivalence
DCT Properties
IDCT
Energy Conservation
Energy Compaction
Frame-based coding
Lapped Transform
MDCT (Modified
DCT)
MDCT Basis
Elements
Summary
MATLAB routines
4: Linear Time
Invariant Systems
LTI Systems
Convolution
Properties
BIBO Stability
Frequency Response
Causality
Linear Time-invariant (LTI) systems have two properties:
Passive and Lossless
Convolution Linear: H (u[n] + v[n]) = H (u[n]) + H (v[n])
Complexity
Circular Convolution Time Invariant: y[n] = H (x[n]) y[n r] = H (x[n r]) r
Frequency-domain
convolution
Overlap Add
The behaviour of an LTI system is completely defined by its impulse
Overlap Save response: h[n] = H ([n])
Summary
MATLAB routines
Proof: P
We can always write x[n] = r= x[r][n r]
P
Hence H (x[n]) = H r= x[r][n r]
P
= r= x[r]H ([n r])
P
= r= x[r]h[n r]
= x[n] h[n]
4: Linear Time
P
Invariant Systems Convolution: x[n] v[n] = r= x[r]v[n r]
LTI Systems
Convolution
Properties Convolution obeys normal arithmetic rules for multiplication:
BIBO Stability
Frequency Response Commutative: x[n] v[n] = v[n] x[n]
Causality P (i) P
Passive and Lossless Proof: r x[r]v[n r] = p x[n p]v[p]
Convolution
Complexity (i) substitute p = n r
Circular Convolution
Frequency-domain
convolution Associative: x[n] (v[n] w[n]) = (x[n] v[n]) w[n]
Overlap Add
Overlap Save
x[n] v[n] w[n] is unambiguous
Summary
P (i) P
MATLAB routines
Proof: r,s x[n r]v[r s]w[s] = p,q x[p]v[q p]w[n q]
(i) substitute p = n r, q = n s
Distributive over +:
x[n] (v[n]P+ w[n]) = (x[n] v[n]) + (x[n] w[n])
Proof: r x[n r] (v[r]P + w[r]) = P
r x[n r]v[r] + r x[n r]w[r]
Identity: x[n] [n] = x[n]
P (i)
Proof: r [r]x[n r] = x[n] (i) all terms zero except r = 0.
4: Linear Time
Invariant Systems BIBO Stability: Bounded Input, x[n] Bounded Output, y[n]
LTI Systems
Convolution The following are equivalent:
Properties
BIBO Stability (1) An LTI system is BIBO stable P
Frequency Response
Causality
(2) h[n] is absolutely summable, i.e. n= |h[n]| <
Passive and Lossless
Convolution
(3) H(z) region of absolute convergence includes |z| = 1.
Complexity
Circular Convolution Proof (1) (2):(
Frequency-domain
convolution 1 h[n] 0
Overlap Add Define x[n] =
Overlap Save 1 h[n] < 0
Summary P P
MATLAB routines then y[0] =P x[0 n]h[n] = |h[n]|.
But |x[n]| 1n so BIBO y[0] = |h[n]| < .
Proof (2) P(1):
Suppose |h[n]| = S < and |x[n]| B is bounded.
P
Then |y[n]| =
r= x[n r]h[r]
P
r= |x[n r]| |h[r]|
P
B r= |h[r]| BS <
4: Linear Time
Invariant Systems For a BIBO stable system Y (ej ) = X(ej )H(ej )
LTI Systems
Convolution
where H(ej )is the DTFT of h[n] i.e. H(z) evaluated at z = ej .
Properties
BIBO Stability Example: h[n] = 1 1 1
Frequency
Response
H(ej ) = 1 + ej + ej2
0
Causality 3
Complexity
Circular Convolution H(ej ) = |1 + 2 cos | 1
Frequency-domain
H(ej ) = + 1sgn(1+2 cos ) 0
convolution 0 1 2 3
Overlap Add 2
10
Overlap Save
Summary Sign change in (1 + 2 cos ) at = 2.1 gives 5
MATLAB routines
(a) gradient discontinuity in |H(ej )| 0
-5
(b) an abrupt phase change of . -10
0 1 2 3
d
Group delay is d H(ej ): gives delay of the 1
is constant: in this case +1 samples. -2
0 1 2 3
Discontinuities of k do not affect group delay.
4: Linear Time
Invariant Systems Causal System: cannot see into the future
LTI Systems i.e. output at time n depends only on inputs up to time n.
Convolution
Properties
BIBO Stability Formal definition:
Frequency Response
Causality
If v[n] = x[n] for n n0 then H (v[n]) = H (x[n]) for n n0 .
Passive and Lossless
Convolution The following are equivalent:
Complexity
Circular Convolution (1) An LTI system is causal
Frequency-domain
convolution (2) h[n] is causal h[n] = 0 for n < 0
Overlap Add
Overlap Save
(3) H(z) converges for z =
Summary
MATLAB routines Any right-sided sequence can be made causal by adding a delay.
All the systems we will deal with are causal.
4: Linear Time
Invariant Systems
LTI Systems
Convolution
Properties
BIBO Stability
Frequency Response
Causality
A
Ppassive system canPnever gain energy:
2 2
Passive and
n= |y[n]| n= |x[n]| for any finite energy input x[n].
Lossless
Convolution
j
Complexity A passive LTI system must have H(e ) 1
Circular Convolution
Frequency-domain Somewhat analogous to a circuit consisting of R, L and C only.
convolution
Overlap Add
Overlap Save
A
Plossless system always preserves energy exactly:
2 P 2
Summary
n= |y[n]| = n= |x[n]| for any finite energy input x[n].
MATLAB routines
j
A lossless LTI system must have H(e ) = 1
called an allpass system.
Somewhat analogous to a circuit consisting of L and C only.
Passive and lossless building blocks can be used to design systems which
are insensitive to coefficient changes
4: Linear Time
Invariant Systems y[n] = x[n] h[n]: convolve x[0 : N 1] with h[0 : M 1]
LTI Systems
Convolution x
Properties
BIBO Stability
y[0] y[9]
Frequency Response
Causality ConvolutionP
sum:
M 1
Passive and Lossless
Convolution
y[n] = r=0 h[r]x[n r]
Complexity
Circular Convolution y[n] is only non-zero in the range
Frequency-domain
convolution 0nM +N 2
Overlap Add
Overlap Save
Thus y[n] has only
Summary M + N 1 non-zero values
MATLAB routines
Algebraically: N = 8, M = 3
M + N 1 = 10
x[n r] 6= 0 0 n r N 1
n+1N r n
Pmin(M 1,n))
Hence: y[n] = r=max(0,n+1N ) h[r]x[n r]
We must multiply each h[n] by each x[n] and add them to a total
total arithmetic complexity ( or + operations) 2M N
4: Linear Time
Invariant Systems y [n] = x[n] N h[n]: circ convolve x[0 : N 1] with h[0 : M 1]
LTI Systems
Convolution x
Properties
BIBO Stability
N y[0] y[7]
Frequency Response
Causality Convolution sum:
Passive and Lossless
Convolution PM 1
Complexity yN [n] = r=0 h[r]x[(n r)mod N ]
Circular
Convolution
Frequency-domain yN [n] has period N
convolution
Overlap Add yN [n] has N distinct values
Overlap Save
Summary
MATLAB routines N = 8, M = 3
Only the first M 1 values are affected by the circular repetition:
yN [n] = y[n] for M 1 n N 1
If we append M 1 zeros (or more) onto x[n], then the circular
repetition has no effect at all and:
yN +M 1 [n] = y[n] for 0 n N + M 2
Circular convolution is a necessary evil in exchange for using the DFT
4: Linear Time
Invariant Systems Idea: Use DFT to perform circular convolution - less computation
LTI Systems
Convolution (1) Choose L M + N 1 (normally round up to a power of 2)
Properties
BIBO Stability
Frequency Response (2) Zero pad x[n] and h[n] to give sequences of length L: x
[n] and h[n]
Causality
Passive and Lossless H[k])
(3) Use DFT: y[n] = F 1 (X[k] =x
[n] L h[n]
Convolution
Complexity
Circular Convolution (4) y[n] = y[n] for 0 n M + N 2.
Frequency-domain
convolution
Arithmetic Complexity:
Overlap Add
Overlap Save DFT or IDFT take 4L log2 L operations if L is a power of 2
Summary
MATLAB routines (or 16L log2 L if not).
Total operations: 12L log2 L 12 (M + N ) log2 (M + N )
Beneficial if both M and N are > 100 .
Example: M = 103 , N = 104 :
Direct: 2M N = 2 107
with DFT: 12 (M + N ) log2 (M + N ) = 1.8 106 ,
But: (a) DFT may be very long if N is large
(b) No output samples until all x[n] has been input.
4: Linear Time
Invariant Systems If N is very large:
N
LTI Systems (1) chop x[n] into K chunks of length K
Convolution
Properties (2) convolve each chunk with h[n]
BIBO Stability
Frequency Response (3) add up the results
Causality
Passive and Lossless
Convolution Each output chunk is of length K + M 1 and overlaps the next chunk
Complexity
N
Circular Convolution Operations: K 8 (M + K) log2 (M + K)
Frequency-domain
convolution Computational saving if 100 < M K N
Overlap Add
Overlap Save Example: M = 500, K = 104 , N = 107
Summary
MATLAB routines Direct: 2M N = 1010
single DFT: 12 (M + N ) log2 (M + N ) = 2.8 109
N
overlap-add: K 8 (M + K) log2 (M + K) = 1.1 109 ,
Other advantages:
(a) Shorter DFT
(b) Can cope with N =
(c) Can calculate y[0] as soon as x[K 1] has been read:
algorithmic delay = K 1 samples
4: Linear Time
Invariant Systems Alternative method:
N
LTI Systems (1) chop x[n] into K overlapping
Convolution
Properties chunks of length K + M 1
BIBO Stability
Frequency Response (2) K+M 1 each chunk with h[n]
Causality
Passive and Lossless
(3) discard first M 1 from each chunk
Convolution (4) concatenate to make y[n]
Complexity
Circular Convolution
Frequency-domain
convolution
The first M 1 points of each output chunk are invalid
Overlap Add
Overlap Save Operations: slightly less than overlap-add because no addition needed to
Summary
MATLAB routines
create y[n]
Advantages: same as overlap add
Strangely, rather less popular than overlap-add
4: Linear Time
Invariant Systems LTI systems: impulse response, frequency response, group delay
LTI Systems
Convolution BIBO stable, Causal, Passive, Lossless systems
Properties
BIBO Stability
Frequency Response Convolution and circular convolution properties
Causality
Passive and Lossless Efficient methods for convolution
Convolution
Complexity single DFT
Circular Convolution
Frequency-domain overlap-add and overlap-save
convolution
Overlap Add
Overlap Save
Summary For further details see Mitra: 4 & 5.
MATLAB routines
4: Linear Time
Invariant Systems fftfilt Convolution using overlap add
LTI Systems
Convolution
x[n]y[n] real(ifft(fft(x).*fft(y)))
Properties
BIBO Stability
Frequency Response
Causality
Passive and Lossless
Convolution
Complexity
Circular Convolution
Frequency-domain
convolution
Overlap Add
Overlap Save
Summary
MATLAB routines
5: Filters
Difference
Most useful LTI systems can be described by a difference equation:
Equations
y[n] = M
P PN
FIR Filters
r=0 b[r]x[n r] r=1 a[r]y[n r]
FIR Symmetries
IIR Frequency PN PM
Response r=0 a[r]y[n r] = r=0 b[r]x[n r] with a[0] = 1
Negating z
Cubing z
Scaling z
a[n] y[n] = b[n] x[n]
IIR Impulse response
B(z)
examples
IIR Impulse response
Y (z) = A(z) X(z)
Other BIBO
responses j B(ej ) j
Stability Triangle Y (e ) = A(ej ) X(e )
Low-pass filter
Allpass filters
Group Delay
(1) Always causal.
Minimum Phase (2) Order of system is max(M, N ), the highest r with a[r] 6= 0 or b[r] 6= 0.
Linear Phase Filters
Summary
(3) We assume that a[0] = 1; if not, divide A(z) and B(z) by a[0].
MATLAB routines (4) Filter is BIBO stable iff roots of A(z) all lie within the unit circle.
Note negative sign in first equation.
Authors in some SP fields reverse the sign of the a[n]: BAD IDEA.
5: Filters
Difference Equations
A(z) = 1: Finite Impulse Response (FIR) filter: Y (z) = B(z)X(z).
FIR Filters Impulse response is b[n] and is of length M + 1.
FIR Symmetries
IIR Frequency
Response Frequency response is B(ej ) and is the DTFT of b[n].
Negating z
Cubing z
Comprises M complex sinusoids + const:
Scaling z b[0] + b[1]ej + + b[M ]ejM
IIR Impulse response
examples
IIR Impulse response Small M response contains only low quefrencies
Other BIBO jM
M
responses
Stability Triangle
Symmetrical b[n]H(ej )e 2 consists of 2 cosine waves [+ const]
Low-pass filter
Allpass filters
Group Delay M=4 M=14 M=24
Minimum Phase
Linear Phase Filters
Summary
MATLAB routines
1 1 1
0 0 0
0 1 2 3 0 1 2 3 0 1 2 3
2
Rule of thumb: Fastest possible transition M (marked line)
5: Filters PM
Difference Equations
j
B(e ) is determined by the zeros of z B(z) = r=0 b[M r]z r M
FIR Filters
FIR Symmetries Real b[n] conjugate zero pairs: z z
IIR Frequency
Response Symmetric: b[n] = b[M n] reciprocal zero pairs: z z 1
Negating z
Cubing z
Real + Symmetric b[n] conjugate+reciprocal groups of four
Scaling z or else pairs on the real axis
IIR Impulse response
examples Real: Symmetric: Real + Symmetric:
IIR Impulse response
[1, 1.28, 0.64] [1, 1.64 + 0.27j, 1] [1, 3.28, 4.7625, 3.28, 1]
Other BIBO
responses
Stability Triangle 1 1 1
Low-pass filter 0.5 0.5 0.5
Allpass filters 0 0 0
Group Delay -0.5 -0.5 -0.5
Minimum Phase
-1 -1 -1
Linear Phase Filters
Summary -1 0 1 -1 0 1 -1 0 1
z z z
MATLAB routines
3
10
2
2
1 5
1
0 0 0
-2 0 2 -2 0 2 -2 0 2
(rad/sample) (rad/sample) (rad/sample)
b[r]z0r = 0
PM
In all of the proofs below, we assume that z = z0 is a root of B(z) so that B(z0 ) = r=0
and then we prove that this implies that other values of z also satisfy B(z) = 0.
B(z01 ) =
PM r
r=0 b[r]z0
PM M n
= n=0 b[M n]z0 substitute r = M n
n
z0M M take out z0M factor
P
= n=0 b[M n]z0
n
z0M M
P
= n=0 b[n]z0 since b[M n] = b[n]
= z0M 0 = 0 since B(z0 ) = 0
5: Filters
Q
b[0] Mi=1 (1qi z )
1
B(z)
Difference Equations Factorize H(z) = A(z) = QN
i=1 (1pi z )
1
FIR Filters
FIR Symmetries
IIR Frequency
Response
Roots of A(z) and B(z) are the poles {pi } and zeros {qi } of H(z)
Negating z Also an additional N M zeros at the origin (affect phase only)
Cubing z
M QM
Scaling z
H(ej ) = |b[0]|| z | i=1 |zqi | j
IIR Impulse response
|z N |
Q N
|zp |
for z = e
examples i=1 i
IIR Impulse response
Other BIBO Example:
responses
2+2.4z 1 2(1+1.2z 1 )
Stability Triangle
Low-pass filter
H(z) = 10.96z 1 +0.64z 2 = (1(0.480.64j)z 1 )(1(0.48+0.64j)z 1 )
Allpass filters
21.76
j
Group Delay At = 1.3: H(e ) = 1.620.39
= 5.6
Minimum Phase
Linear Phase Filters H(ej ) = (0.6 + 1.3) (1.7 + 2.2) = 1.97
Summary
MATLAB routines
1 0.39 1
2.2
10 0.5 0.5
1.76 1.62
0.6 1.3
0 0
5 -0.5 -0.5 1.7
-1 -1
0 -1 0 1 -1 0 1
0 1 2 3
(z) (z)
5: Filters
Difference Equations
Given a filter H(z) we can form a new one HR (z) = H(z)
FIR Filters Negate all odd powers of z, i.e. negate alternate a[n] and b[n]
FIR Symmetries
IIR Frequency 2+2.4z 1
Response Example: H(z) = 10.96z 1 +0.64z 2
Negating z
Cubing z
Scaling z 1
IIR Impulse response 0.5 10
examples
0
IIR Impulse response
5
Other BIBO -0.5
responses
-1
Stability Triangle 0
-1 0 1 0 1 2 3
Low-pass filter (z)
Allpass filters
Group Delay
22.4z 1
Minimum Phase Negate z: HR (z) = 1+0.96z 1 +0.64z 2 Negate odd coefficients
Linear Phase Filters
Summary
MATLAB routines 1
0.5 10
-0.5 5
-1
-1 0 1 0
0 1 2 3
(z)
5: Filters
Difference Equations
Given a filter H(z) we can form a new one HC (z) = H(z 3 )
FIR Filters Insert two zeros between each a[n] and b[n] term
FIR Symmetries
IIR Frequency
2+2.4z 1
Response Example: H(z) = 10.96z 1 +0.64z 2
Negating z
Cubing z
Scaling z 1
IIR Impulse response 0.5 10
examples
IIR Impulse response 0
5
Other BIBO -0.5
responses
-1
Stability Triangle 0
-1 0 1 -2 0 2
Low-pass filter
(z) (rad/sample)
Allpass filters
Group Delay
2+2.4z 3
Minimum Phase Cube z: HC (z) = 10.96z 3 +0.64z 6 Insert 2 zeros between coefs
Linear Phase Filters
Summary
1
MATLAB routines
0.5 10
C
0
5
-0.5
-1
0
-1 0 1 -2 0 2
z (rad/sample)
5: Filters
Difference Equations
Given a filter H(z) we can form a new one HS (z) = H( z )
FIR Filters Multiply a[n] and b[n] by n
FIR Symmetries
IIR Frequency 2+2.4z 1
Response Example: H(z) = 10.96z 1 +0.64z 2
Negating z
Cubing z
1
Scaling z
0.5 10
IIR Impulse response
0
examples
-0.5 5
IIR Impulse response
Other BIBO -1
0
responses -1 0 1 0 1 2 3
(z)
Stability Triangle
Low-pass filter
z 2+2.64z 1
Allpass filters Scale z: HS (z) = H( 1.1 )= 11.056z 1 +0.7744z 2
Group Delay
Minimum Phase 1
20
Linear Phase Filters
0.5
Summary 15
0
MATLAB routines 10
-0.5
5
-1
0
-1 0 1 0 1 2 3
z (rad/s)
5: Filters B(z)
Difference Equations To find the impulse response of A(z) , use partial fractions:
FIR Filters
FIR Symmetries
IIR Frequency
Example 1: M < N
Response
B(z) 13.4z 1
3 2
Negating z
Cubing z A(z) = 10.3z 1 0.4z 2 = 1+0.5z 1 + 10.8z 1
n n
Scaling z h[n] = (3 (0.5) 2 (0.8) ) u[n]
IIR Impulse
response examples
IIR Impulse response Example 2: M N
Other BIBO
responses B(z) 25.7z 1 +0.2z 2 +0.8z 3
Stability Triangle A(z) = 10.3z 1 0.4z 2
Low-pass filter 13.4z 1
1
Allpass filters = 1 2z + 10.3z1 0.4z2
Group Delay 3 2
Minimum Phase = 1 2z 1 + 1+0.5z 1 + 10.8z 1
Linear Phase Filters n n
Summary
h[n] = [n] 2[n 1] + (3 (0.5) 2 (0.8) ) u[n]
MATLAB routines
Example 3: repeated pole at z = 0.5
B(z) 1 2
5: Filters B(z)
Difference Equations H(z) = A(z) we want h[n], the inverse z-Transform of H(z).
FIR Filters
FIR Symmetries
B(z)
IIR Frequency (1) Assume M < N else, do a long division: H(z) = D(z) + A(z)
Response
Negating z
1 Ki
QNp
Cubing z
Scaling z
(2) Factorize A(z) = i=1 1 pi z (Np = # of distinct poles)
IIR Impulse response
examples
B(z) PNp PKi r
(3) Then A(z) = i=1 k=1 (1p i,k 1 )k (Ki = multiplicity of pi )
IIR Impulse iz
response kKi K
where ri,k = (pi) B(z)
k
d i 1 Ki
Other BIBO
responses (Ki k)! d(z 1 )Ki k A(z) (1 p i z )
z=pi
Stability Triangle
Low-pass filter
Allpass filters
For the common case Ki = 1 i (e.g. all poles distinct):
Group Delay
B(z) P N p ri
B(z) 1
Minimum Phase A(z) = i=1 1pi z 1 where r i = A(z) (1 p i z )
z=pi
Linear Phase Filters
Summary (4) The impulse response is given by
MATLAB routines
PNp PKi n+k1
h[n] = i=1 k=1 Ck1 ri,k pni for n 0
! n+k1
where C = is a binomial coefficient Ck1
!()! nk1
PNp
For the common case Ki = 1 i: h[n] = i=1 ri pni for n 0
dKi k
(2) DifferentiateKi k times with respect to z 1 : and evaluate at z = pi
d(z 1 )Ki k
(1) Suppose the formula is true for k and differentiate both sides with respect to z 1 :
n k P o
d 1 n+k1 n n
d(z 1 )
1 pz = n=0 Ck1 p z
This gives:
(k+1) P n+k1 n (n1) n+k1 n (n1)
pk 1 pz 1 =
P
= n=0 nCk1 p z n=1 nCk1 p z
where we have omitted the term with n = 0 because it equals zero.
Now substitute, m = n 1:
1
(k+1) P m+k m+1 m
pk 1 pz = m=0 (m + 1)Ck1 p z
(k+1) m+1 m+k m m m+k m m
=
P
1 pz 1
P
m=0 k C k1 p z = m=0 Ck p z
which proves the result for k + 1.
(2) To start the induction at k = 1:
1 P
1 pz 1 = n=0 C0n pn z n = n n
P
n=0 p z
This is true from the standard geometric progression formula. (Note that C0n = 1 n).
5: Filters
Difference Equations
All LTI systems described by difference equations have h[n] decaying
FIR Filters exponentially or exponentially times a power of n.
FIR Symmetries
IIR Frequency
Response It is perfectly possible to have BIBO stable LTI systems whose impulse
Negating z
Cubing z
responses decay more slowly than this.
Scaling z 1
IIR Impulse response Example: h[n] = 1+n2 for n 0
examples
IIR Impulse response
P
Other BIBO
BIBO stable since |h[n]| = 2.077... <
responses Hence H(ej ) exists.
Stability Triangle
Low-pass filter
Allpass filters However, no finite difference equation can have this impulse response.
Group Delay
Minimum Phase
Linear Phase Filters 2
Summary
MATLAB routines 1.5
0.5
0
0 1 2 3
5: Filters
Difference Equations
Not normally easy to tell if poles lie within
FIR Filters |z| = 1, but easy test for a 2nd order filter: K2
S
FIR Symmetries
R
IIR Frequency
Response Suppose A(z) = 1 + a[1]z 1 + a[2]z 2 0
P
Negating z Q
Cubing z a[1] a[1]2 4a[2] -K2
Scaling z
The roots are p1,2 = 2
-2K 0 2K
IIR Impulse response
examples Want the conditions that |p1,2 | < K a[1]
5: Filters
Difference Equations
1st order low pass filter: extremely common
1p
FIR Filters y[n] = (1 p)x[n] + py[n 1] H(z) = 1pz 1
FIR Symmetries
IIR Frequency
Response Impulse response:
n
Negating z
Cubing z
h[n] = (1 p)pn = (1 p)e
1
Scaling z where = ln p is the time constant in samples.
IIR Impulse response
examples
Magnitude response: H(e ) = 1p
j
IIR Impulse response
2
12p cos +p
Other BIBO
responses
Stability Triangle
Low-pass filter with DC gain of unity.
2
Low-pass filter
3 dB frequency is 3dB = cos1 1 2p (1p)
2 1p 1
Allpass filters 1+p
Group Delay 1
Minimum Phase Compare continuous time: HC (j) = 1+j
Linear Phase Filters
Summary
Indistinguishable for low but H(ej ) is periodic, HC (j) is not
MATLAB routines 0
1 p=0.80
0.5 -10 H(j)
0
-20
-0.5
HC(j)
-1 -30
-1 0 1 0.01 1/ 0.1 2
(z) (rad/sample)
5: Filters B(z)
Difference Equations If H(z) = A(z) with b[n] = a [M n] then we have an allpass filter:
FIR Filters
FIR Symmetries
PM PM js
j a [M r]ejr jM
s=0 a [s]e
IIR Frequency H(e ) = P
r=0
M =e P M [s = M r]
r=0 a[r]e r=0 a[r]e
jr jr
Response
Negating z
Cubing z The two sums
arejcomplex conjugates they have the same magnitude
Scaling z
IIR Impulse response Hence H(e ) = 1 allpass
examples
IIR Impulse response
Other BIBO
However phase is not constant: H(ej ) = M 2A(ej )
responses
p+z 1 1p1 z 1
Stability Triangle 1st order allpass: H(z) = 1pz 1 = p 1pz1
Low-pass filter
Allpass filters 1
Pole at p and zero at p : reflected in unit circle
Group Delay
e p = |p| ej 1
Minimum Phase
j
Constant distance ratio:
Linear Phase Filters p
Summary
0
MATLAB routines 1
1
0.8 -1 0.5
0.6 0
0.4 -2
-0.5
0.2
-3 -1
0
0 1 2 3 0 1 2 3 -1 0 1
(z)
In an allpass filter, the zeros are the poles reflected in the unit circle.
B(z)
An allpass filter is one in which H(z) = A(z) with b[n] = a [M n]. Of course, if the coefficients
a[n] are all real, then the conjugation has no effect and the numerator coefficients are identical to the
numerator coefficients but in reverse order.
If A(z) has order M , we can express the relation between A(z) and B(z) algebraically as
1 ) where the coefficients of A(z)
B(z) = z M A(z are the conjugates of the coefficients of A(z).
If the roots of A(z) are pi , then we can express H(z) in factorized form as
M M
Y pi + z 1 Y 1 pi z
H(z) = 1
=
i=1
1 p i z i=1
z pi
If all the |pi | < 1, then each term in the product is T1 according to whether |z| S 1.
It follows that, provided H(z) is stable, |H(z)| T 1 according to whether |z| S 1.
5: Filters
j dH(ej )
Difference Equations Group delay: H (e ) = = delay of the modulation envelope.
d
FIR Filters
FIR Symmetries
IIR Frequency
j j
Trick to get at phase: ln H(e ) = ln H(e ) + jH(ej )
Response
d((ln H(ej )))
Negating z
j
1 dH(e ) z dH
Cubing z H = d = H(ej ) d = H(z) dz
Scaling z z=ej
IIR Impulse response P
examples H(e ) = n=0 h[n]ejn = F (h[n])
j
[F = DTFT]
IIR Impulse response
dH(ej ) P
Other BIBO
d = n=0 jnh[n]ejn = jF (nh[n])
responses
Stability Triangle j
1 dH(e ) jF (nh[n]) F (nh[n])
Low-pass filter H = H(e j ) d = F (h[n]) = F (h[n])
Allpass filters
Group Delay
Minimum Phase 1 pej
Linear Phase Filters Example: H(z) = 1pz1 H = [1 p] = 1pej
Summary
0
MATLAB routines 1 p=0.80
-0.2 3 p=0.80
0.5
-0.4 2
0
-0.6 1
-0.5
H
-1 -0.8 0
-1 0 1 0 1 2 3 0 1 2 3
(z)
Average group delay (over ) = (# poles # zeros) within the unit circle
Zeros on the unit circle count
DSP and Digital Filters (2015-7228) Filters: 5 15 / 19
[Group Delay Properties]
The group delay of a filter H(z) at a frequency , measured in seconds or samples, gives the time delay
dH(ej )
of the envelope of a modulated sine wave at a frequency . It is defined as H (ej )
= d
.
For example, H(z) = z k defines a filter that delays its input by k samples and we can calculate the
group delay by evaluating
dH(ej ) d jk d
H (e j
)= = e = (k) = k
d d d
which tells us that this filter has a constant group delay of k samples that is independent of .
The average value of H equals the total change in H(ej ) as goes from to + divided by
2. If you imagine an elastic string connecting a pole or zero to the point z = ej , you can see that as
goes from to + the string will wind once around the pole or zero if it is inside the unit circle but
not if it is outside. Thus, the total change in H(ej ) is equal to 2 times the number of poles inside
the unit circle minus the number of zeros inside the unit circle. A zero that is exactly on the unit circle
counts 12 since there is a sudden discontinuity of in H(ej ) as passes through the zero position.
When you multiply or divide complex numbers, their phases add or subtract, so it follows that when
you multiply or divide transfer functions their group delays will add or subtract. Thus, for example,
B(z)
the group delay of an IIR filter, H(z) = A(z) , is given by H = B A . This means too that we
can determine the group delay of a factorized transfer function by summing the group delays of the
individual factors.
The slide shows how to determine the group delay, H , from either the impulse response, h[n], or
the transfer function, H(z). We start by using a trick that is very common: if you want to get at
the magnitude and phase of a complex number separately, you can do so by taking its natural log:
j
ln re = ln |r| + j or, in general, ln H = ln |H| + jH. By rearranging this equation, we get
H = (ln H) where ( ) denotes taking the imaginary part of a complex number. Using this, we can
write !
d ln H(ej ) d ln H(ej )
1 dH(ej )
H = = = . (1)
d d H(ej ) d
dH(ej )
By going back to the definition of the DTFT, we find that H(ej ) = F (h[n]) and d
=
jF (nh[n]) where F ( ) denotes the DTFT. Substituting these expressions into the above equation
gives us a formula for H in terms of the impulse response h[n].
F (nh[n])
H = (2)
F (h[n])
dz
In order to express H in terms of z, we first note that if z = ej then d
= jz. By substituting
z = ej into equation (1), we get
1 dH(z) 1 dH(z) dz jz dH(z) z dH(z)
H = = = = .
H(z) d H(z) dz d H(z) dz H(z) dz
z=e j
1
As an example, suppose we want to determine the group delay of : H(z) = 1pz 1
. As noted above,
B(z)
if H(z) = A(z)
,
then H = B A . In this case B = 0 so H = [1 p] .
F ([0 p])
Using equation (2) gives H = F ([1 p]) since nh[n] = [0 1] [1 p].
As demonstrated above, the average value of H is zero for this filter because there is one pole and one
zero inside the unit circle.
5: Filters
Difference Equations
Average group delay (over ) = (# poles # zeros) within the unit circle
FIR Filters
FIR Symmetries
zeros on the unit circle count 4
3
IIR Frequency
Response Reflecting an interior zero to the exterior 2
Negating z
multiplies H(ej ) by a constant but
1
Cubing z
0
Scaling z
IIR Impulse response
increases average group delay by 1 sample. 0 1
2 3
examples
0
IIR Impulse response 1
Other BIBO 0.5
responses 0 -5
Minimum Phase 30
Linear Phase Filters 1
20
Summary 0.5
MATLAB routines
H
0 10
-0.5
0
-1
-10
-1 0 1 0 1 2 3
(z)
A filter with all zeros inside the unit circle is a minimum phase filter:
Lowest possible group delay for a given magnitude response
Energy in h[n] is concentrated towards n = 0
DSP and Digital Filters (2015-7228) Filters: 5 16 / 19
Linear Phase Filters
5: Filters
Difference Equations
The phase of a linear phase filter is: H(ej ) = 0
FIR Filters
dH(ej )
FIR Symmetries
IIR Frequency
Equivalently constant group delay: H = d =
Response
Negating z A filter has linear phase iff h[n] is symmetric or antisymmetric:
Cubing z
Scaling z h[n] = h[M n] n or else h[n] = h[M n] n
IIR Impulse response
examples
IIR Impulse response
M can be even ( mid point) or odd ( mid point)
Other BIBO
responses Proof : PM PM
jn
Stability Triangle
Low-pass filter
j
2H(e ) = 0 h[n]e + 0 h[M n]ej(M n)
Allpass filters j M
PM j (n M ) j (n M
2 )
Group Delay
=e 2
0 h[n]e
2 + h[M n]e
Minimum Phase
Linear Phase
Filters
h[n] symmetric:
j j M
PM M
Summary 2H(e ) = 2e 2
0 h[n] cos n 2
MATLAB routines
h[n] anti-symmetric:
j j M
PM M
2H(e ) = 2je 2
0 h[n] sin n 2
j ( + M ) PM M
= 2e 2 2
0 h[n] sin n 2
5: Filters
Difference Equations
Useful filters have difference equations:
FIR Filters
FIR Symmetries Freq response determined by pole/zero positions
IIR Frequency
Response N M zeros at origin (or M N poles)
Negating z
Cubing z
Geometric construction of |H(ej )|
Scaling z Pole bandwidth 2 |log |p|| 2 (1 |p|)
IIR Impulse response
examples Stable if poles have |p| < 1
IIR Impulse response
Other BIBO
responses
Allpass filter: a[n] = b[M n]
Stability Triangle Reflecting a zero in unit circle leaves |H(ej )| unchanged
Low-pass filter
Allpass filters
j
dH(ej )
Group Delay Group delay: H e = d samples
Minimum Phase M
j
Linear Phase Filters Symmetrical h[n] H e = 2
Summary
MATLAB routines Average H over = (# poles # zeros) within the unit circle
Minimum phase if zeros have |q| 1
Lowest possible group delay for given |H(ej )|
Linear phase = Constant group Delay = symmetric/antisymmetric h[n]
For further details see Mitra: 6, 7.
DSP and Digital Filters (2015-7228) Filters: 5 18 / 19
MATLAB routines
5: Filters
Difference Equations
filter filter a signal
FIR Filters impz Impulse response
FIR Symmetries
IIR Frequency residuez partial fraction expansion
Response
Negating z grpdelay Group Delay
Cubing z
Scaling z
freqz Calculate filter frequency response
IIR Impulse response
examples
IIR Impulse response
Other BIBO
responses
Stability Triangle
Low-pass filter
Allpass filters
Group Delay
Minimum Phase
Linear Phase Filters
Summary
MATLAB routines
6: Window Filter
Design For any BIBO stable filter, H(ej ) is the DTFT of h[n]
Inverse DTFT
j
P jn 1
R
Rectangular window H(e ) = h[n]e h[n] = 2 H(ej )ejn d
Dirichlet Kernel
Window relationships
Common Windows If we know H(ej ) exactly, the IDTFT gives the ideal h[n]
Uncertainty principle
Order Estimation Example: Ideal Lowpass filter
Example Design
Frequency sampling
(
Summary
j 1 || 0 sin 0 n
MATLAB routines H(e ) = h[n] = n
0 || > 0
1 2/0
20
0.5
0 0
-2 0 2
6: Window Filter
Design Truncate to M
2 to make finite; h1 [n] is now of length M + 1
Inverse DTFT
Rectangular
window
MSE Optimality:
Dirichlet Kernel Define mean square error (MSE) in frequency domain
Window relationships
j 2
1
R j
Common Windows E = 2 H(e ) H1 (e ) d
Uncertainty principle 2
M
Order Estimation 1
R j
P jn
= 2 H(e ) 2
h [n]e d
Example Design M 1
2
Frequency sampling
Summary
MATLAB routines
Minimum E is when h1 [n] = (h[n])
Proof: Differentiate w.r.t. h1 [r] and set to zero
However: 9% overshoot at a discontinuity even for large n.
h1[n] 1 M=28
M=14
M=14
0.5
0 0
0 1 2 3
M M
Normal to delay by 2 to make causal. Multiplies H(ej ) by ej 2
.
6: Window Filter
Design
Truncation Multiply h[n] by a rectangular window, w[n] = M n M
2 2
Inverse DTFT j 1 j j
Rectangular window
Circular Convolution HM +1 (e ) = 2 H(e ) W (e )
Dirichlet Kernel
Window relationships P M2 (i) P0.5M (ii) sin 0.5(M +1)
Common Windows W (e ) = j
M
ejn = 1 + 2 1 cos (n) = sin 0.5
Uncertainty principle 2
j(n)
Order Estimation Proof: (i) e + ej(+n) = 2 cos (n) (ii) Sum geom. progression
Example Design
Frequency sampling
Summary
Effect: convolve ideal freq response with Dirichlet kernel (aliassed sinc)
MATLAB routines
1 1 1
0 0 0
-2 0 2 -2 0 2 -2 0 2
1
M=14
Provided that M4+1 < 2 0 M + 1 > 2
0 :
0.5
Passband ripple: M4 +1 , stopband 2
M +1
4
0
Transition pk-to-pk: M +1
d|H| +1
-2 0
2 Transition Gradient: d M2
=0
6: Window Filter
Design
When you multiply an impulse response by a window M + 1 long
1
Inverse DTFT HM +1 (ej ) = 2 H(ej ) W (ej )
Rectangular window
Dirichlet Kernel
1
Window 20 M=20
1
relationships
Common Windows 10
1
0.5 0.5
Uncertainty principle
Order Estimation
0
Example Design 0
0
Frequency sampling -2 0 2 -2 0 2 -2 0 2
Summary
MATLAB routines
w[0] 0.5
R j
(a) passband gain w[0]; peak + 2 2
mainlobe
W (e )d
rectangular window: passband gain = 1; peak gain = 1.09
(b) transition bandwidth, = width of the main lobe
transition amplitude, H = integral of main lobe2
rectangular window: = M4+1 , H 1.18
(d) features narrower than the main lobe will be broadened and
attenuated
DSP and Digital Filters (2015-6729) Windows: 6 5 / 12
Common Windows
6: Window Filter
Design
Rectangular: w[n] 1 0
6.27/(M+1) -13 dB
0 1 2 3
Blackman-Harris 3-term: 0
18.87/(M+1)
q 0
13.25/(M+1)
2n 2
I0 1( M ) = 5.3 -40 dB
Kaiser: I0 ()
-50
0 1 2 3
6: Window Filter R 2 2
12 R 2 2
21
Design t |x(t)| dt |X(j)| d 1
Inverse DTFT
CTFT uncertainty principle: R
|x(t)|2 dt
R
|X(j)|2 d
2
Rectangular window
Dirichlet Kernel
Window relationships
The first term measures the width of x(t) around t = 0.
2
Common Windows
Uncertainty
It is like if |x(t)| was a zero-mean probability distribution.
principle The second term is similarly the width of X(j) in frequency.
Order Estimation
Example Design A signal cannot be concentrated in both time and frequency.
Frequency sampling
Summary
So a short window cannot have a narrow main lobe.
MATLAB routines
Proof: R 2 R 2
Assume |x(t)| dt = 1 |X(j)| d = 2 [Parseval]
Set v(t) = dx V (j) = jX(j) [by parts]
R dxdt 2
Now tx dt dt= 2 tx t= 2 x dt = 21 [by parts]
1
R 1 2
1
R dx 2 R 2 2 R dx 2
So 4 = tx dt dt t x dt dt
dt [Schwartz]
R 2 2 R 2
R 2 2 1 R 2
= t x dt |v(t)| dt = t x dt 2 |V (j)| d
R 2 2 1 R 2 2
= t x dt 2 |X(j)| d
(1) Suppose v(t) = dx . Then integrating the CTFT definition by parts w.r.t. t gives
R dt jt h
1
i
1
R dx(t) jt 1
X(j) = x(t)e dt = j x(t)e jt + j dt e dt = 0 + j
V (j)
d 1 2 dx
(2) Since dt 2
x = x dt
, we can apply integration by parts to get
dx 1 2 1 2 1 1 1
R R dt R 2
tx dt dt = t 2 x t= dt 2 x dt = 2 x dt = 2 1 = 2
R 2 2
It follows that tx dt dt = 21 = 14 which we will use below.
dx
1
(4) From Parsevals theorem for the CTFT, v 2 (t)dt = 2 |V (j|2 d. From step (1), we can
R R
6: Window Filter
Design
Several formulae estimate the required order of a filter, M .
Inverse DTFT
Rectangular window E.g. for lowpass filter
Dirichlet Kernel
Window relationships Estimated order is
Common Windows
Uncertainty principle 5.64.3 log10 () 820 log10
Order Estimation
M 2 1 2.2
Example Design
Frequency sampling Required M increases as either the
Summary
MATLAB routines transition width, 2 1 , or the gain
tolerances and get smaller.
Only approximate.
Example:
Transition band: f1 = 1.8 kHz, f2 = 2.0 kHz, fs = 12 kHz,.
1 = 2f
fs
1
= 0.943, 2 = 2f2
fs = 1.047
6: Window Filter
Design
Specifications: 1
Inverse DTFT Bandpass: 1 = 0.5, 2 = 1
Rectangular window
Dirichlet Kernel Transition bandwidth: = 0.1 0.5
Window relationships
Common Windows
Ripple: = = 0.02
Uncertainty principle 20 log10 = 34 dB 0
Order Estimation 0 1 2 3
Example Design 20 log10 (1 + ) = 0.17 dB
Frequency sampling 1
M=92
Summary Order: = 2.5
MATLAB routines 5.64.3 log10 ()
M 2 1 = 92 0.5
0
M=92
Kaiser Window: = 2.5 = 2.5
-20
M=92
-40
0
-60
0 1 2 3
6: Window Filter
Design Take M + 1 uniform samples of H(ej ); take IDFT to obtain h[n]
Inverse DTFT
Rectangular window Advantage:
Dirichlet Kernel
Window relationships exact match at sample points
Common Windows
Uncertainty principle Disadvantage:
Order Estimation
Example Design poor intermediate approximation if spectrum is varying rapidly
Frequency
sampling
Solutions:
Summary
MATLAB routines (1) make the filter transitions smooth over width
(2) oversample and do least squares fit (cant use IDFT)
(3) use non-uniform points with more near transition (cant use IDFT)
1
M+1=93
1
M+1=93
0.5
0.5
0 0
-2 0 2 0 1 2 3
6: Window Filter
Design
Make an FIR filter by windowing the IDTFT of the ideal response
Inverse DTFT
Rectangular window
Ideal lowpass has h[n] = sinn
0 n
Dirichlet Kernel
Window relationships Add/subtract lowpass filters to make any piecewise constant
Common Windows response
Uncertainty principle
Order Estimation
Example Design Ideal filter response is with the DTFT of the window
Frequency sampling
Summary
Rectangular window (W (z) = Dirichlet kernel) has 13 dB
MATLAB routines sidelobes and is always a bad idea
Hamming, Blackman-Harris are good
Kaiser good with trading off main lobe width v. sidelobes
Uncertainty principle: cannot be concentrated in both time and
frequency
Frequency sampling: IDFT of uniform frequency samples: not so great
6: Window Filter
Design diric(x,n) Dirichlet kernel: sin 0.5nx
sin 0.5x
Inverse DTFT
Rectangular window
hanning Window functions
Dirichlet Kernel hamming (Note periodic option)
Window relationships
Common Windows kaiser
Uncertainty principle
Order Estimation
kaiserord Estimate required filter order and
Example Design
Frequency sampling
Summary
MATLAB routines
Remez Exchange 2
Algorithm 2 4 6 8
Determine Polynomial
Example Design
Proof:
FIR Pros and Cons Assume the first maximal deviation from the line is negative as shown.
Summary
MATLAB routines There must be an equally large positive deviation; or else just move the line
downwards to reduce the maximal deviation.
This must be followed by another maximal negative deviation; or else you
can rotate the line and reduce the deviations.
Alternation Theorem:
A polynomial fit of degree n to a bounded set of points is minimax if and
only if it attains its maximal error at n + 2 points with alternating signs.
There may be additional maximal error points.
Fitting to a continuous function is the same as to an infinite number of
points.
|H|
Maximal Error
Locations H() = h[0] + 2 1 h[n] cos n 0.6
0.4
Remez Exchange
Algorithm
= P (cos ) 0.2
Determine Polynomial
M
Example Design where P (x) is a polynomial of order 2 .
0
0 0.5 1 1.5
2 2.5 3
Determine
Polynomial Solve M2 + 2 equations in M
2 + 2 unknowns for h[n] + .
Example Design P M2
FIR Pros and Cons In step 3, evaluate H() = h[0] + 2 n=1 h[n] cos ni
Summary
MATLAB routines
2
Method 2: Dont calculate h[n] explicitly (Computation time M )
1
Q
Multiply equations by ci = j6=i cos i cos j and add:
P M2 +2 P M2 (1)i
PM
2 +2
i=1 c i h[0] + 2 n=1 h[n] cos n + s(i ) = i=1 ci d(i )
All terms involving h[n] sum to zero leaving
P M2 +2 (1)i ci P M2 +2
i=1 s(i ) = i=1 ci d(i )
Solve for then calculate the H(i ) then use Lagrange interpolation:
P M2 +2 Q cos cos
H() = P (cos ) = i=1 H(i ) j6=i cos i cos jj
M M
2 + 1 -polynomial going through all the H( i ) [actually order 2 ]
0.6
|H|
-15 0
0.4 -20
-0.5
0.2 -25
-1
-30
0
0 0.5 1 1.5 2 2.5 3 0 0.5 1 1.5 2 2.5 3 -1 0 1 2
8: IIR Filter
Transformations
Classical continuous-time filters optimize tradeoff: 1
N=5
Continuous Time
Filters
passband ripple v stopband ripple v transition width 0.8
0.6
|H|
Bilinear Mapping 0.4
Continuous Time
Filters 2 0.2
Spectral 1
Transformations
Constantinides Monotonic 0.8
Transformations 0.6
e
G() = 1 12 2N + 38 4N +
|H|
Impulse Invariance 0.4
Summary
MATLAB routines
Maximally flat: 2N 1 derivatives are zero 0.2
0
0.1 0.2 0.5 1 2 5 10
e2
Chebyshev: G () = 2
1
2 ()
Frequency (rad/s)
1+ TN 1
0.8
|H|
0.4
e 2 () =
Inverse Chebyshev: G 1 0
0.1 0.2 0.5 1 2
Frequency (rad/s)
5 10
1+(2 TN )
2 (1 ) 1
1
0.8
|H|
0.4
+s
8: IIR Filter
Transformations Change variable: z = s s = z1
z+1 : a one-to-one invertible mapping
Continuous Time
Filters
Bilinear Mapping
axis (s) axis (z)
Continuous Time
Filters
Mapping Poles and
axis (s) Unit circle (z)
ej 1 ej 2 ej 2
Zeros
Spectral Proof: z = e s = ej +1 = j 2 j 2 = j tan 2 = j
j
Transformations
e +e
Constantinides
Transformations Left half plane(s) inside of unit circle (z)
Impulse Invariance 2 |(+x)+jy|2
Summary Proof: s = x + jy |z| = |(x)jy|2
MATLAB routines
2 +2x+x2 +y 2 4x
= 2 2x+x2 +y 2 =1+ (x)2 +y 2
x < 0 |z| < 1
Unit circle (s) axis (z)
4 2.5 3
s-plane z-plane
=1 2 =1
3
2.5
1.5
2
1 2
1 0.5
1.5
0 0
-1 -0.5
1
-1
-2
-1.5 0.5
-3 -2
-4 -2.5 0
-4 -2 0 2 4 -2 -1 0 1 2 0 2 4 6 8 10
/
8: IIR Filter
Transformations
e
Take H(s) = 1
and choose = 1 2.5
Continuous Time
s2 +0.2s+4 2
Filters
Substitute: s = z1
1.5
[extra zeros at z = 1]
|H|
Bilinear Mapping
z+1 1
Continuous Time
Filters
1
0.5
Spectral 2.5
=1
Transformations 2
(z+1) 2
Constantinides
Transformations
= (z1) +0.2(z1)(z+1)+4(z+1)2
2 1.5
|H|
Impulse Invariance 1
2
Summary z +2z+1 1+2z +z 1 2
MATLAB routines
= 5.2z 2 +6z+4.8 = 0.19 1+1.15z 1 +0.92z 2
0.5
0
0 0.5 1 1.5 2 2.5 3
(rad/sample)
1.5
Frequency mapping: = 2 tan1
1
0.5
= 2 3 4 5
0
0 2 4
/
6 8 10
8: IIR Filter
Transformations
e
Alternative method: H(s) = 1 2.5
Continuous Time
s2 +0.2s+4 2
Filters
Find the poles and zeros: ps = 0.1 2j 1.5
|H|
Bilinear Mapping 1
Continuous Time
Filters
Map using z = 1+s
1s pz = 0.58 0.77j 0.5
Zeros
After the transformation we will always end up with
1 2 3 4
Frequency (rad/s)
5 6
Spectral 2
Transformations
Constantinides
the same number of poles as zeros: 1
0.5
e -1
At 0 = 0 s0 = 0 H(s )
0 = 0.25 -1
z
0 1
0 = 2 tan1 0 = 0 z0 = ej0 = 1
2.5
=1
2
4
|H(z0 )| = g 3.08 = 0.25 g = 0.19 1.5
|H|
1
1+2z +z1 2
H(z) = 0.19 1+1.15z 1 +0.92z 2
0.5
0
0 0.5 1 1.5 2 2.5 3
(rad/sample)
8: IIR Filter
Transformations
We can transform the z-plane to change the cutoff 2
z
Continuous Time
Filters
frequency by substituting 1
z z+
Bilinear Mapping z = 1z
z = 1+z
0
Continuous Time -1
Filters
Mapping Poles and Frequency Mapping: -2
-2 -1 0 1 2
Zeros
j 1+z 1
Spectral If z = e , then z = z 1+z has modulus 1 2
Transformations
z^
= 0.6
Constantinides since the numerator and denominator are 1
Transformations
Impulse Invariance complex conjugates. 0
Summary
MATLAB routines
Hence the unit circle is preserved. -1
ej +
ej = 1+e
-2
-2 -1 0 1 2
j
1
1+
Some algebra gives: tan 2 = 1 tan 2 0.8
0.6
|H|
0.4
|H^|
=0.6 0.4
0
0 0.5 1 1.5 2 2.5 3
^ (rad/s)
Bandpass and bandstop transformations are quadratic and so will double the order:
1 1
Lowpass Bandpass
|H^|
|H|
0.5 0.5
0 0
-3 -2 -1 0 1 2 3 -3 -2 -1 0 1 2 3
(rad/s) ^ (rad/s)
DSP and Digital Filters (2015-6707) IIR Transformations: 8 7 / 10
Impulse Invariance
8: IIR Filter
Transformations
Bilinear transform works well for a lowpass filter but the non-linear
Continuous Time
Filters
compression of the frequency distorts any other response.
Bilinear Mapping L 1 sample Z
Continuous Time
e
Alternative method: H(s) h(t) h[n] = T h(nT ) H(z)
Filters
e e PN gi
Mapping Poles and Express H(s) as a sum of partial fractions H(s) = i=1 se pi
Zeros
= u(t) P N pi t
Spectral
Transformations
Impulse response is h(t) i=1 gi e
H(z) PN
Constantinides
Transformations Digital filter T = i=1 1epgiiT z1 has identical impulse response
Impulse Invariance
1
Summary
MATLAB routines
Poles of H(z) are pi = epi T (where T = fs is sampling period)
Zeros do not map in a simple way
Properties:
, Impulse response correct. , No distortion of frequency axis.
/ Frequency response is aliased.
Example: Standard telephone filter - 300 to 3400 Hz bandpass
1 1 1
0.8
0.6
|H|
|H|
|H|
0.5 0.5
Bilinear (f s = 8 kHz) 0.4
Analog Filter Matched at 3.4 kHz Impulse Invariance (f s = 8 kHz)
0.2
0 0
0 5 10 15 20 25 0 0.5 1 1.5 2 2.5 3 0 0.5 1 1.5 2 2.5 3
Frequency (krad/s) (rad/sample) (rad/sample)
8: IIR Filter
Transformations
Classical filters have optimal tradeoffs in continuous time domain
Continuous Time
Filters
Order transition width pass ripple stop ripple
Bilinear Mapping Monotonic passband and/or stopband
Continuous Time
Filters
Mapping Poles and Bilinear mapping
Zeros
Spectral Exact preservation of frequency response (mag + phase)
Transformations
Constantinides non-linear frequency axis distortion
Transformations
Impulse Invariance can choose to map 0 0 for one specific frequency
Summary
MATLAB routines Spectral transformations
lowpass lowpass, highpass, bandpass or bandstop
bandpass and bandstop double the filter order
Impulse Invariance
Aliassing distortion of frequency response
preserves frequency axis and impulse response
For further details see Mitra: 9.
8: IIR Filter
Transformations bilinear Bilinear mapping
Continuous Time
Filters impinvar Impulse invariance
Bilinear Mapping
Continuous Time
butter Analog or digital
Filters
Mapping Poles and
butterord Butterworth filter
Zeros
Spectral
cheby1 Analog or digital
Transformations
Constantinides
cheby1ord Chebyshev filter
Transformations cheby2 Analog or digital
Impulse Invariance
Summary cheby2ord Inverse Chebyshev filter
MATLAB routines
ellip Analog or digital
ellipord Elliptic filter
9: Optimal IIR
j B(ej )
Design We want to find a filter H(e ) = that approximates a target
A(ej )
Error choices
Linear Least Squares response D(). Assume A is order N and B is order M .
Frequency Sampling
Iterative Solution
Newton-Raphson
Two possible error measures:
Magnitude-only
B(ej )
Specification
Hilbert Relations
Solution Error: ES () = WS () A(ej ) D()
Magnitude Phase
Relation j j
Summary Equation Error: EE () = WE () B(e ) D()A(e )
MATLAB routines
We may know D() completely or else only |D()|
R
We minimize |E ()|p d
where p = 2 (least squares) or (minimax).
Weight functions W () are chosen to control relative errors at different
frequencies. WS () = |D()|1 gives constant dB error.
We actually want to minimize ES but EE is easier because it gives
rise to linear equations.
WS ()
However if WE () = |A(ej )| , then |EE ()| = |ES ()|
9: Optimal IIR
Design
Overdetermined set of equations Ax = b (#equations > #unknowns)
Error choices
Linear Least
Squares
We want to minimize ||e||2 where e = Ax b
Frequency Sampling
2 T T T T
Iterative Solution ||e|| = e e = x A b (Ax b)
Newton-Raphson
Magnitude-only
Specification
Differentiate with respect to x:
T T T T T T
Hilbert Relations d e e = dx A (Ax b) + x A b Adx
Magnitude Phase
Relation [since d (uv) = du v + u dv]
Summary
MATLAB routines = 2dxT AT (Ax b) [since uT v = vT u]
= 2dxT AT Ax AT b
This is zero for any dx iff AT Ax = AT b
2 T
1 T
Thus ||e|| is minimized if x = A A A b
These are the Normal Equations (Normal because AT e = 0)
The pseudoinverse x = A+ b works even if AT A is singular and finds the x
with minimum ||x||2 that minimizes ||e||2 .
This is a very widely used technique.
9: Optimal IIR j j
Design For every we want:
0 = W () B(e ) D()A(e )
Error choices PM jm
D() 1 + N jn
P
Linear Least Squares = W () m=0 b[m]e n=1 a[n]e
Frequency
Sampling
a
u()T v()T
Iterative Solution = W ()D()
Newton-Raphson b
Magnitude-only T j j2 jN
Specification where u() = W ()D() e e e
Hilbert Relations T j j2 jM
Magnitude Phase v() = W () 1 e e e
Relation
Summary
[with K M +N +1
MATLAB routines
Choose K valuesof , 1 K 2 ]
T T
a
U V =d [K equations, M + N + 1 unkowns]
b
where U = u(1 ) u(K ) ,
V = v(1 ) v(K ) ,
T
d = W (1 )D(1 ) W (K )D(K )
We want to force a and b to be real; find least squares solution to
T T
U V a (d)
=
UT VT b (d)
9: Optimal IIR
Design
Least squares solution minimizes the EE rather than ES .
Error choices
WS ()
Linear Least Squares However EE = ES if WE () = |A(ej )| .
Frequency Sampling
Iterative Solution
Newton-Raphson We can use an iterative solution technique:
Magnitude-only
Specification
Hilbert Relations
1 Select K frequencies {k } (e.g. uniformly spaced)
Magnitude Phase
Relation 2 Initialize WE (k ) = WS (k )
Summary
MATLAB routines
3 Find least squares solution to
jk jk
WE (k ) B(e ) D(k )A(e ) = 0k
4 Force A(z) to be stable
Replace pole pi by (pi )1 whenever |pi | 1
WS (k )
5 Update weights: WE (k ) =
|A(ejk )|
6 Return to step 3 until convergence
9: Optimal IIR
Design
Newton: To solve f (x) = 0 given an initial guess x0 , we write
Error choices
Linear Least Squares
f (x) f (x0 ) + (x x0 )f (x0 ) x = x0 ff(x0)
(x0 )
Frequency Sampling Converges very rapidly once x0 is close to the solution
Iterative Solution
Newton-Raphson j
Magnitude-only So for each k ,we can write
(omitting the and e arguments)
Specification
Hilbert Relations E S WS B 0
A0 D + WS
A0 (B B 0 ) WS B0
A20
(A A0 )
Magnitude Phase
Relation
Summary =WA0
S
B 0 A 0 D + B B 0 B0
A0 (A 1) B0
A0 + B0
MATLAB routines
9: Optimal IIR
Design
If the filter specification only dictates the target magnitude: |D()|, we
Error choices need to select the target phase.
Linear Least Squares
Frequency Sampling
Iterative Solution Solution:
Newton-Raphson
Magnitude-only
Make an initial guess of the phase and then at each iteration
j
Specification update D() = B(e )
Hilbert Relations A(e ) .
j
Magnitude Phase
Relation
Summary
Initial Guess:
MATLAB routines If H(ej ) is causal and minimum phase then the magnitude and
phase are not independent:
j
j
H(e ) = ln H(e ) cot 2
ln H(e ) = ln |H()| + H(ej ) cot 2
j
9: Optimal IIR
Design
We define t[n] = u[n 1] u[1 n] t[n]
Frequency Sampling j 1+ej ej 2 +ej 2
Iterative Solution T (e ) = 1ej = j 2 j 2
Newton-Raphson
e e h[n]
2 cos
Magnitude-only
Specification
= 2j sin 2 = j cot 2
2
Hilbert Relations 0
Magnitude Phase
Relation
h[n]even/odd parts: he [n] = 21 (h[n] + h[n]) h[-n]
1
Summary h o [n] = 2 (h[n] h[n])
MATLAB routines
so H(ej ) = He (ej )
0
ho[n]
9: Optimal IIR
Q
Q
(1qm z1 ) 1
Design
Error choices
Given H(z) = g (1pn z1 ) 0.5
Magnitude
Phase Relation
Taylor Series: 0.3
a2 2 a3 3
ln|H|
1 1
Summary ln 1 az = az 2 z 3 z . . . 0.2
cot( )
0
-3 -2 -1 0 1 2 3
(rad/s)
j
j
H(e ) = ln H(e ) cot 2
ln H(e ) = ln |g| + H(e ) cot 2
j
j 1
0.5
H (rad)
0
1
107z -0.5
-3 -2 -1 0 1 2 3
(rad/s)
9: Optimal IIR
Design
Want to minimize solution
j error, ES , but
EE gives linear equations:
)
Error choices
Linear Least Squares
ES () = WS () B(eA(e ) D()
j
Frequency Sampling
j j
Iterative Solution EE () = WE () B(e ) D()A(e )
Newton-Raphson
Magnitude-only
Specification
use W () to weight errors at different .
Hilbert Relations
Magnitude Phase Linear least squares: solution to overdetermined Ax = b
Relation
T
1 T
Summary Least squares error: x = A A A b
MATLAB routines
Closed form solution: least squares EE at {k }
WS ()
use WE () = |A(e j )| to approximate ES
9: Optimal IIR
Design invfreqz IIR design for complex response
Error choices
Linear Least Squares
Frequency Sampling
Iterative Solution
Newton-Raphson
Magnitude-only
Specification
Hilbert Relations
Magnitude Phase
Relation
Summary
MATLAB routines
We start by proving a useful formula which shows how the determinant of a matrix, A, changes when
you add a rank-1 matrix, qrT , onto it. The formula is known as the Matrix Determinant Lemma. For
any matrix A and column vectors q and r, we can write
T T 1 T T T
1 r 1+r A q 0 1 0 1 r
1 = .
0 A A q I q I 0 A + qrT
It is easy to verify this by multiplying out the matrices. We now take the determinant of both sides
making use of the result than a block triangular matrix is the product of the blocks along the diagonal
(assuming they are all square). This gives the result we want:
det (A) 1 + rT A1 q = det A + qrT
The upper equation gives (zI P) V = qX from which V = (zI P)1 qX and by substituting this
Y T 1 det(zIP+qrT )
in the lower equation, we get X = r (zI P) q + s = det(zIP)
+ s 1.
0 5 10 15 20 25 0 5 10 15 20 25
Moral: Avoid using direct form for filters orders over about 10.
Direct Form II
Transposed
Gain (dB)
0 0
-20 -20
-40 -40
0 0.5 1 1.5 2 2.5 3 0 0.5 1 1.5 2 2.5 3
M = 6:
M +1
For M odd (no central coefficient), we need 2 multiplies.
We make use of a property of allpass filters (proved in a note in lecture 5) that if G(z) is a stable allpass
filter, then |G(z)| T 1 according to whether |z| S 1.
Vm (z) z m Am (z 1 )
Label outputs um [n] and vm [n] and define Hm (z) = Um (z) = Am (z)
m (z)
The numerator of VX(z) is of order m so you can create any numerator of order M by
summing appropriate multiples of Vm (z):
PM m
PM m=0 cm z Am (z 1 )
w[n] = m=0 cm vm [n] W (z) = A(z)
PM
Form a new output signal as w[n] = m=0 cm vm [n]
PM B(z)
W (z) = m=0 cm Vm (z) = 1+0.2z1 0.23z 2 +0.2z 3 X(z)
Corrollary
0.5 0.5
0 0
-2 0 2 -2 0 2
Downsampled
Spectrum Shaded region shows aliasing 0
-2 0
2
0
-2 0
2
Power Spectral
1 j 2 1 1 X(ej )2 d
Density
R R
Perfect
Energy decreases: 2 Y (e ) d
K 2
Reconstruction
Commutators Example 2:
Summary
1 1
MATLAB routines K=3
Energy all in K || < 2 K 0.5 0.5
No aliasing: , 0
-2 0
2
0
-2 0
2
No aliasing: If all energy is in r K || < (r + 1) K for some integer r
Normal case (r = 0): If all energy in 0 || K
1 1
Downsampling: Total energy multiplied by K (= K if no aliasing)
Average power unchanged (= energy/sample)
DSP and Digital Filters (2015-6738) Multirate: 11 9 / 14
Power Spectral Density
Spectrum
Power Spectral
Density Upsampling:
Perfect upsample 2 upsample 3
0 0
-3 -2 -1 0 1 2 3 -3 -2 -1 0 1 2 3
Frequency (rad/samp) Frequency (rad/samp)
Downsampling:
downsample 2 downsample 3
0.6 0.6
0 0
the 3 case. -3 -2 -1 0 1
Frequency (rad/samp)
2 3 -3 -2 -1 0 1
Frequency (rad/samp)
2 3
Downsampling by K deletes samples but leaves the average power of the remaining ones unchanged.
Thus the total power of the downsampled spectra remains at 0.6. The downsampled PSD is the average
of K shifted versions of the original PSD that have been expanded horizontally by a factor of K. The
white noise component is the average of K identical expanded but attenuated versions of itself and so
its PSD amplitude remains at 0.1. The power of a tonal components is unchanged and so its amplitude
is also unchanged.
When downsampling by a factor of K = 3, the original width of the trapezoidal component expands
from 0.4 to 1.2 which exceeds the range of the graph. Thus, as approaches , the PSD
of the signal component is decreasing with but has not reached 0 at = . This portion of the
trapezium wraps around to = and gives rise to the little triangle of additional noise in the range
< < 0.8 where it adds onto the white noise component. In a similar way, the portion of the
trapezium that overflows the left edge of the graph gives rise to additional noise at the right of the
graph in the range 0.8 < < .
-60 -60
-80 -80
0 1 2 3 0 0.05 0.1
(rad/s) (rad/s)
Decimation
Frequency
without losing information. -40
-60
Polyphase 0 1 2 1 2 3
decomposition
Downsampled
= 2 /4 K=4
Polyphase Filter Downsample: aliased components at offsets of 0
Polyphase Upsampler
2
K are almost zero because of H(z)
-20
Complete Filter
-20
2 2
K 2 1 K 1 +2 -40
-60
0 1 2 3
Centre of transition band must be intermediate Nyquist freq, K
-40
Summary Spectral components > K will be aliased 1 /50 2
-60
down in frequency in V (ej ). -80
We now need 7 delays, 7 adders and 8 gains for the entire filter.
DSP and Digital Filters (2015-6729) Polyphase Filters: 12 8 / 10
Downsampler Implementation
13: Resampling
Filters
Suppose we want to change the sample rate while preserving information:
Resampling e.g. Audio 44.1 kHz48 kHz96 kHz
Halfband Filters
Dyadic 1:8 Upsampler
Rational Resampling
Downsample:
Arbitrary Resampling LPF to new Nyquist bandwidth: 0 = K
Polynomial
Approximation
Farrow Filter
Upsample:
Summary LPF to old Nyquist bandwidth: 0 = K
MATLAB routines
P
Rational ratio: fs Q
LPF to lower of old and new Nyquist
bandwidths: 0 = max(P,Q)
13: Resampling
Filters
If K = 2 then the new Nyquist frequency is 1
Resampling 0 = 2 .
Halfband Filters 0.5
Half-band upsampler:
We interchange the filters with the 1:2 block
and use the commutator notation.
H1 (z) is symmetrical with M 2 coefficients
so we need M 4 multipliers in total (input gain
of 0.5 can usually be absorbed elsewhere).
M
Computation: 4 multiplies per input sample
13: Resampling
Filters
Resampling
Halfband Filters 1 0.8
Dyadic 1:8
Upsampler
0.5
Rational Resampling
Arbitrary Resampling
Suppose X(z): BW = 0.8 = 0.2 0
0 1
2 3
0
Upsample 1:2 V (z): = 0.6 Q = 12 0 1
2 3
1 0.1 0.9
1 + P4 fx + Q
M=110
R
0.5
13: Resampling P
Filters x[n] To resample by Q do 1:P
Resampling
Halfband Filters v[r] then LPF, then Q:1.
Dyadic 1:8 Upsampler
Rational
y[i]
Resampling
Arbitrary Resampling
Polynomial P
Approximation
Resample by Q 0 = max(P, Q)
Farrow Filter 2
Summary , 20 = max(P, Q)
MATLAB routines
Polyphase: H(z) = P Hp (z P )
P 1 p
p=0 z
Commutate coefficients:
P samples of v[s] for each x[n]
Keep only every Qth output:
y[i] uses Hp (z) with p = Qi mod P
Multiplication Count:
[dB]
H(z): M + 1 60 3.5 =
2.7 max(P, Q)
M +1 2.7 Q
Hp (z): R + 1 = P = max 1, P M + 1 coeficients in all
Q
Multiplication rate: 2.7
max 1, P fy = 2.7
max (fy , fx )
DSP and Digital Filters (2015-6707) Resampling: 13 5 / 10
Arbitrary Resampling
13: Resampling
Filters
Sometimes need very large P and Q:
kHz
Resampling e.g. 44.1
48 kHz = 147
160
Halfband Filters
2.7 max(fy , fx )
Dyadic 1:8 Upsampler Multiplication rate OK:
Rational Resampling
Arbitrary
Resampling However # coefficients: 2.7 max(P,
Q)
Polynomial
Approximation Alternatively, use a conveniently large P
Farrow Filter
Summary
and round down to the nearest sample:
MATLAB routines E.g. for y[i] at time i Q
P use hp [r]
where p = (iQ)mod P
Equivalent to converting to analog with
P
zero-order hold and resampling at fy = Q .
1
Zero-order hold convolves with rectangular P -wide window multiplies
sin
periodic spectrum by
2P
. Resampling aliases to mod 2P .
2P Q
Ignoring the polyphase implementation, the low pass filter operates at a sample rate of P and therefore
has a periodic spectrum that repeats at intervals of 2P . Therefore, considering positive frequencies
only, a signal component in the passband at 1 will have images at = 2nP 1 for all positive
integers n.
These components are multiplied by the sin0.5P
0.5P 1
1 function and therefore have amplitudes of
sin 0.5P 1 (2nP 1 ) sin(n0.5P 1 1 ) sin(1n 0.5P 1 1 )
= = .
0.5P 1 (2nP 1 ) (n0.5P 1 1 ) (n0.5P 1 1 )
P
When we do the downsampling to an output sample rate of Q , these images will be aliased to frequencies
mod 2P . In general, these alias frequencies will be scattered throughout the range (0, ) and will
Q
result in broadband noise.
We need to sum the squared amplitudes of all these components:
P sin2 (1n 0.5P 1 1 ) 2 1
P 1
n=1 (n0.5P 1 )2 = sin 0.5P 1 n=1 (n0.5P 1 )2
1 1
1 1 1
If we assume that n 0.5P 1 and also that sin 0.5P 1 0.5P 1 , then we can approx-
imate this sum as
2 P 2 2 2 P
0.5P 1 1 n=1 (n) 2 = 4P
1
2 2 n=1 n
2
2
The summation is a standard result and equals 6
.
2
So the total power of the aliased components is 12P1 2 .
13: Resampling
Filters
Suppose P = 50 and H(z) has order M = 249
Resampling H(z) is lowpass filter with 0 50
Halfband Filters
Dyadic 1:8 Upsampler Split into 50 filters of length R + 1 = MP+1 = 5:
Rational Resampling
Arbitrary Resampling hp [0] is the first P samples of h[m]
Polynomial
Approximation hp [1] is the next P samples, etc. 0
-20
Farrow Filter hp [r] = h[p + rP ] -40
Summary -60
MATLAB routines -80
Use a polynomial of order L to 0 1 2 3
approximate each segment:
error
0
-1
Instead of M + 1 = 250 0 50 100 150 200
0
coefficients we only need -20 0
Farrow with L=4
(R + 1)(L + 1) = 25 -40
-60
where -80
2.7 Q 0 1 2 3
R + 1 = max 1, P
13: Resampling Q M +1
Filter coefficients depend on fractional part of R+1= =5
Filters i P: P
Resampling
j k
Halfband Filters [i] = i QP n where n = i Q
P
Dyadic 1:8 Upsampler
Rational Resampling PR
Arbitrary Resampling y[i] = r=0 fr ([i])x[n r]
Polynomial PL
Approximation where fr () = l=0 bl [r]l
Farrow Filter
Summary PR PL
MATLAB routines y[i] = r=0 l=0 bl [r][i]l x[n r]
PL l
PR
= l=0 [i] r=0 bl [r]x[n r]
PL
= l=0 [i]l vl [n]
where vl [n] = bk [n] x[n]
[like a Taylor series expansion]
Horners Rule:
y[i] = v0 [n] + (v1 [n] + (v2 [n] + ( )))
Multiplication Rate: Q
2.7
Each Bk (z) needs R + 1 per input sample R + 1 max 1, P
Horner needs L per output sample
2.7(L+1) fx
Total: (L + 1) (R + 1) fx + Lfy = max 1, fy fx + Lfy
DSP and Digital Filters (2015-6707) Resampling: 13 8 / 10
Summary
13: Resampling
Filters
Transition band centre at 0
Resampling 0 = the lower of the old and new Nyquist frequencies
Halfband Filters
Dyadic 1:8 Upsampler Transition width = = 20 , typically 0.1
Rational Resampling
Arbitrary Resampling Factorizing resampling ratio can reduce computation
Polynomial
Approximation halfband filters very efficient (half the coefficients are zero)
Farrow Filter P
Summary Rational resampling Q
MATLAB routines
# multiplies per second: 2.7 max (fy , fx )
# coefficients: 2.7
max (P, Q)
Farrow Filter
approximate filter impulse response with polynomial segments
arbitrary, time-varying, resampling ratios
# multiplies per second: 2.7(L+1)
max (fy , fx ) fx
fy + Lfy
(L + 1) ffxy times rational resampling case
# coefficients: 2.7
max (P, Q) P
L+1
13: Resampling
Filters gcd(p,q) Find p + q = 1 for coprime p, q
Resampling
Halfband Filters
polyfit Fit a polynomial to data
Dyadic 1:8 Upsampler polyval Evaluate a polynomial
Rational Resampling
Arbitrary Resampling upfirdn Perform polyphase filtering
Polynomial
Approximation resample Perform polyphase resampling
Farrow Filter
Summary
MATLAB routines
14: FM Radio
Receiver
FM spectrum: 87.5 to 108 MHz
FM Radio Block
Diagram
Each channel: 100 kHz
Aliased ADC
Channel Selection Baseband signal:
Channel Selection (1)
Channel Selection (2)
Mono (L + R): 15 kHz
Channel Selection (3) Pilot tone: 19 kHz
FM Demodulator
Differentiation Filter Stereo (L R): 38 15 kHz
Pilot tone extraction
Polyphase Pilot tone
RDS: 57 2 kHz
Summary
FM Modulation:
Freq deviation: 75 kHz
14: FM Radio
Receiver
FM band: 87.5 to 108 MHz
FM Radio Block
Diagram
Normally sample at fs > 2f
Aliased ADC
Channel Selection However:
Channel Selection (1)
Channel Selection (2)
fs = 80 creates aliased
Channel Selection (3) images at intervals of fs
FM Demodulator
Differentiation Filter
Pilot tone extraction ve frequencies also
Polyphase Pilot tone generate images
Summary
14: FM Radio
Receiver
FM band shifted to 7.5 to 28 MHz (from 87.5 to 108 MHz)
FM Radio Block
Diagram
Aliased ADC
We need to select a single channel 200 kHz wide
Channel Selection
Channel Selection (1) We shift selected channel to DC and then downsample to fs = 400 kHz.
Channel Selection (2)
Channel Selection (3)
Assume channel centre frequency is fc = c 100 kHz
FM Demodulator
Differentiation Filter We must apply a filter before downsampling to remove unwanted images
Pilot tone extraction
Polyphase Pilot tone
Summary
The downsampled signal is complex since positive and negative frequencies
contain different information.
Three methods:
1 Freq shift, then polyphase lowpass filter
2 Polyphase bandpass complex filter
3 Polyphase bandpass real filter
14: FM Radio fc
Receiver Multiply by ej2r 80 MHz to shift
FM Radio Block
Diagram channel at fc to DC.
Aliased ADC
Channel Selection
fc = c 100 k 80fcM = 800 c
Channel Selection
(1) Result of multiplication is complex
Channel Selection (2)
Channel Selection (3) (thick lines on diagram)
FM Demodulator
Differentiation Filter
Pilot tone extraction
Next, lowpass filter to 100 kHz
k
Polyphase Pilot tone = 2 200
80 M = 0.157
Summary
60 dB
M = 3.5 = 1091
Finally, downsample 200 : 1
Polyphase:
1092
Hp (z) has 200 = 6 taps
Complex data Real Coefficients (needs 2 multiplies per tap)
Multiplication Load:
2 80 MHz (freq shift) + 12 80 MHz (Hp (z)) = 14 80 MHz
14: FM Radio
Receiver
Channel centre frequency fc = c 100 kHz where c is an integer.
FM Radio Block Write c = 4k + l
Diagram
Aliased ADC where k = 4c and l = cmod 4
Channel Selection
Channel Selection (1)
Channel Selection
(2)
Channel Selection (3)
FM Demodulator
Differentiation Filter
c
Pilot tone extraction
Polyphase Pilot tone
We multiply u[r] by ej2r 800 then convolve with h[m]:
Summary PM c
v[n] = m=0 h[m]u[200n m]ej2(200nm) 800 [r = 200n]
PM mc 4k+l
= m=0 h[m]ej2 800 u[200n m]ej2200n 800 [c = 4k + 1]
PM j2 ln mc
j2 800
= m=0 g[c] [m]u[200n m]e 4 [g[c] [m] = h[m]e ]
= (j)ln M j2 ln
P
g
m=0 [c] [m]u[200n m] [e 4 indep of m]
14: FM Radio
Receiver
Channel frequency fc = c 100 kHz where c = 4k + l is an integer
FM Radio Block
Diagram
Aliased ADC
Channel Selection
Channel Selection (1)
Channel Selection (2)
Channel Selection
(3)
FM Demodulator
Differentiation Filter
Pilot tone extraction
Polyphase Pilot tone
cm
Summary
g[c] [m] = h[m]ej2 800
j2 c(200s+p)
g[c],p [s] = gc [200s + p]= h[200s + p]e 800 [polyphase]
cs cp cs
= h[200s + p]ej2 4 ej2 800 , h[200s + p]ej2 4 p
j2 (4k+l)s
Define f[c],p [s] = h[200s + p]e 4= j ls h[200s + p]
Although f[c],p [s] is complex it requires only one multiplication per
tap because each tap is either purely real or purely imaginary.
Multiplication Load:
cp
j2 800
6 80 MHz (Fp (z)) + 4 80 MHz (e ) = 10 80 MHz
14: FM Radio
Receiver
FM Radio Block
Diagram
Aliased ADC
Channel Selection
Channel Selection (1)
Channel Selection (2)
Channel Selection (3)
FM Demodulator
Complex FM signal centred at DC: v(t) = |v(t)|ej(t)
Differentiation Filter We know that log v = log |v| + j
Pilot tone extraction
Polyphase Pilot tone d
Summary
The instantaneous frequency of v(t) is dt .
d d(log v) 1 dv 1
v dv
We need to calculate dt = dt = v dt = |v|2 dt
We need:
(1) Differentiation filter, D(z)
(2) Complex multiply, w[n] v [n] (only need part)
(3) Real Divide by |v|2
14: FM Radio
Receiver
Window design method:
FM Radio Block
Diagram
(1) calculate d[n] for the ideal filter
Aliased ADC (2) multiply by a window to give finite support
Channel Selection
Channel Selection (1)
(
Channel Selection (2) d jt jt j j || 0
Channel Selection (3) Differentiation: dt e = je D(e ) =
FM Demodulator 0 || > 0
Differentiation
Filter
h jn jn 0
i
1 j
jejn d = 2 ejn ej 2 n2
R 0
Pilot tone extraction
Polyphase Pilot tone
Hence d[n] = 2 0
[IDTFT]
0
Summary n0 cos n0 sin n0
= n2
1.5 0 0
-40
0.5 -60 0
-80
0
0 0.5 1 1.5 2 2.5 3 0 0.5 1 1.5 2 2.5 3
(rad/sample) (rad/sample)
2140 kHz
Using M = 18, Kaiser window, = 7 and 0 = 2.2 = 400 kHz :
Near perfect differentiation for 1.6 ( 100 kHz for fs = 400 kHz)
Broad transition region allows shorter filter
DSP and Digital Filters (2015-6738) FM Radio: 14 9 / 12
Pilot tone extraction
14: FM Radio
Receiver
FM Radio Block
Diagram
Aliased ADC
Channel Selection
Channel Selection (1)
Channel Selection (2)
Channel Selection (3)
Aim: extract 19 kHz pilot tone, double freq real 38 kHz tone.
FM Demodulator 20 kHz
Differentiation Filter (1) shift spectrum down by 20 kHz: multiply by ej2n 400 kHz
Pilot tone
extraction (2) low pass filter to 1 kHz to extract complex pilot at 1 kHz: H(z)
Polyphase Pilot tone jt 2
= ej2t ]
Summary
(3) square to double frequency to 2 kHz [ e
40 kHz
(4) shift spectrum up by 40 kHz: multiply by e+j2n 400 kHz
(5) take real part
More efficient to do low pass filtering at a low sample rate:
Transition bands:
F (z): 1 19 kHz, H(z): 1 3 kHz, G(z): 2 18 kHz
= 0.28 M = 60, = 0.63 27, = 0.25 68
14: FM Radio
Receiver
FM Radio Block
Diagram
Aliased ADC
Channel Selection Anti-alias filter: F (z)
Channel Selection (1) n
th j2 20
Channel Selection (2)
Each branch, Fp (z), gets every 20 sample and an identical e
p
j2 20
Channel Selection (3) So Fp (z) can filter a real signal and then multiply by fixed e
FM Demodulator
Differentiation Filter
Pilot tone extraction Anti-image filter: G(z)
n
Polyphase Pilot
tone
Each branch, Gp (z), multiplied by identical ej2 10
Summary So Gp (z) can filter a real signal
Multiplies:
F and G each: (3 + 2) 400 kHz, H + x2 : (2 30 + 4) 20 kHz
Total: 13.2 400 kHz [Full-rate H(z) needs 273 400 kHz]
14: FM Radio
Receiver
Aliased ADC allows sampling below the Nyquist frequency
FM Radio Block
Diagram
Only works because the wanted signal fits entirely within a
Aliased ADC Nyquist band image
Channel Selection
Channel Selection (1)
Channel Selection (2)
Polyphase filter can be combined with complex multiplications to
Channel Selection (3) select the desired image
FM Demodulator
Differentiation Filter subsequent multiplication by j ln shifts by the desired multiple
Pilot tone extraction
Polyphase Pilot tone
of 41 sample rate
Summary No actual multiplications required
d
FM demodulation uses a differentiation filter to calculate dt
15: Subband
Processing
Subband
processing
2-band Filterbank
Perfect
Reconstruction
Quadrature Mirror
Filterbank (QMF)
Polyphase QMF
QMF Options The Hm (z) are bandpass analysis filters and divide x[n] into
Linear Phase QMF
IIR Allpass QMF
frequency bands
Tree-structured Subband processing often processes frequency bands independently
filterbanks
Summary The Gm (z) are synthesis filters and together reconstruct the output
Merry Xmas
The Hm (z) outputs are bandlimited and so can be subsampled
without loss of information P 1
Sample rate multiplied overall by Pi
P 1
= 1 critically sampled : good for coding
P P1i
Pi > 1 oversampled : more flexible
Goals:
(a) good frequency selectivity in Hm (z)
(b) perfect reconstruction: y[n] = x[n d] if no processing
Benefits: Lower computation, faster convergence if adaptive
15: Subband
Processing
Subband processing
2-band Filterbank
Perfect
Reconstruction
Quadrature Mirror
Filterbank (QMF)
Polyphase QMF
Vm (z) = Hm (z)X(z) n 1 1 o
1
PK1 j2k 1 1
QMF Options
Linear Phase QMF
Um (z) = K k=0 Vm (e K z )=
K
2 Vm z
2 + Vm z 2
IIR Allpass QMF
Tree-structured
Wm (z) = Um (z 2 ) = 12 {Vm (z) + Vm (z)} [K = 2]
filterbanks
Summary
= 21 {Hm (z)X(z) + Hm (z)X(z)}
Merry Xmas
G0 (z)
Y (z) = W0 (z) W1 (z)
G1 (z)
H0 (z) H1 (z) G0 (z)
= 21 X(z) X(z)
H0 (z) H1 (z) G1 (z)
T (z)
= X(z) X(z) [X(z)A(z) is aliased term]
A(z)
We want (a) T (z) = 12 {H0 (z)G0 (z) + H1 (z)G1 (z)} = z d
and (b) A(z) = 12 {H0 (z)G0 (z) + H1 (z)G1 (z)} = 0
15: Subband
Processing
For perfect reconstruction without aliasing, we require
Subband processing d
2-band Filterbank 1 H0 (z) H1 (z) G0 (z) z
Perfect
2 =
Reconstruction H0 (z) H1 (z) G1 (z) 0
Quadrature Mirror
Filterbank (QMF) 1
Polyphase QMF G0 (z) H0 (z) H1 (z) 2z d
QMF Options Hence: =
Linear Phase QMF G1 (z) H0 (z) H1 (z) 0
IIR Allpass QMF
Tree-structured
2z d H1 (z) H1 (z) 1
filterbanks = H0 (z)H1 (z)H 0 (z)H1 (z)
Summary H0 (z) H0 (z) 0
Merry Xmas
2z d H1 (z)
= H0 (z)H1 (z)H 0 (z)H1 (z) H0 (z)
For all filters to be FIR, we need the denominator to be
H0 (z)H1 (z) H0 (z)H1 (z) = cz k , which implies
G0 (z) H1 (z) d=k 2 H1 (z)
= 2c z kd = c
G1 (z) H0 (z) H0 (z)
1 1
Note: c just scales Hi (z) by c 2 and Gi (z) by c 2 .
15: Subband
Processing
Subband processing
2-band Filterbank
Perfect
Reconstruction
Quadrature Mirror
Filterbank (QMF)
QMF satisfies:
Polyphase QMF
QMF Options (a) H0 (z) is causal and real
Linear Phase QMF
j
IIR Allpass QMF
(b) H1 (z) = H0 (z): i.e. H0 (e ) is reflected around =
2
Tree-structured
filterbanks
(c) G0 (z) = 2H1 (z) = 2H0 (z)
Summary (d) G1 (z) = 2H0 (z) = 2H1 (z)
Merry Xmas
QMF is alias-free:
A(z) = 12 {H0 (z)G0 (z) + H1 (z)G1 (z)}
1
= 2 {2H1 (z)H0 (z) 2H0 (z)H1 (z)} = 0
QMF Transfer Function:
T (z) = 12 {H0 (z)G0 (z) + H1 (z)G1 (z)}
= H02 (z) H12 (z) = H02 (z) H02 (z)
15: Subband
Processing
Subband processing
2-band Filterbank
Perfect
Reconstruction
Quadrature Mirror
Filterbank (QMF)
Polyphase QMF Polyphase decomposition:
QMF Options
Linear Phase QMF
H0 (z) = P0 (z 2 ) + z 1 P1 (z 2 )
IIR Allpass QMF H1 (z) = H0 (z) = P0 (z 2 ) z 1 P1 (z 2 )
Tree-structured
filterbanks G0 (z) = 2H0 (z) = 2P0 (z 2 ) + 2z 1 P1 (z 2 )
Summary
Merry Xmas
G1 (z) = 2H0 (z) = 2P0 (z 2 ) + 2z 1 P1 (z 2 )
Transfer Function:
T (z) = H02 (z) H12 (z) = 4z 1 P0 (z 2 )P1 (z 2 )
we want T (z) = z d P0 (z) = a0 z k , P1 (z) = a1 z k+1d
H0 (z) has only two non-zero taps poor freq selectivity
Perfect reconstruction QMF filterbanks cannot have good freq selectivity
15: Subband
Processing
Subband processing
2-band Filterbank
Perfect
Reconstruction
Quadrature Mirror
Filterbank (QMF) Polyphase decomposition:
Polyphase QMF
QMF Options
Linear Phase QMF
IIR Allpass QMF
Tree-structured
filterbanks
Summary
Merry Xmas A(z) = 0 no alias term
T (z) = H02 (z) H12 (z) = H02 (z) H02 (z) = 4z 1 P0 (z 2 )P1 (z 2 )
Options:
(A) Perfect Reconstruction: T (z) = z d H0 (z) is a bad filter.
(B) T (z) is Linear
Phase FIR:
Tradeoff: T (ej ) 1 versus H0 (z) stopband attenuation
(C) T (z) is Allpass IIR: H0 (z) can be Butterworth or Elliptic filter
Tradeoff: T (ej ) versus H0 (z) stopband attenuation
15: Subband
Processing
Subband processing
2-band Filterbank
Perfect
Reconstruction
T (z) 1
Quadrature Mirror M
Filterbank (QMF) H0 (z) order M , linear phase H0 (ej ) = ej 2 H0 (ej )
Polyphase QMF
QMF Options
Linear Phase QMF T (ej ) = H02 (ej ) H12 (ej ) = H02 (ej ) H02 (ej )
IIR Allpass QMF j 2 j() 2
Tree-structured =e jM
H 0 (e ) e
j()M
H0 (e )
filterbanks
j 2 M j() 2
Summary =e jM
H0 (e ) (1) H0 (e )
Merry Xmas
M even T (e j
2 ) = 0 / so choose M odd (1)M = +1
Select h0 [n] by numerical iteration to minimize
j 2
R R
j
2
+ H0 (e ) d + (1 ) 0 T (e ) 1 d
2
balance between H0 (z) being lowpass and T (ej ) 1
0 0.04
Johnston filter h0[n] M=11 H0 H1
0.02
-20
(M = 11): -40
0
-0.02
-60 -0.04
0 1 2 3 0 1 2 3
15: Subband
Processing
Subband processing
2-band Filterbank
Perfect |T (z)| = 1
Reconstruction
Quadrature Mirror
Filterbank (QMF) Choose P0 (z) and P1 (z) to be allpass IIR filters:
H0,1 (z) = 12 P0 (z 2 ) z 1 P1 (z 2 ) ,
Polyphase QMF
QMF Options
G0,1 (z) = 2H0,1 (z)
Linear Phase QMF
IIR Allpass QMF A(z) = 0 No aliasing
Tree-structured
filterbanks T (z) = H02 H12 = . . . = z 1 P0 (z 2 )P1 (z 2 ) is an allpass filter.
Summary
Merry Xmas H0 (z) and H1 (z) are power complementary :
H0 (ej )2 + H1 (ej )2 = H0 (ej )H0 (ej ) + H1 (ej )H1 (ej )
1 j 2 1 j 2
= . . . = P0 (e ) + P1 (e ) = 1 2 2
-40
-1 z-1P1(z2) 5
T(z)
-8 A1=1+0.715z
-60
0 1 2 3 0 1 2 3 0 1 2 3
(rad/sample)
A half-band filterbank divides the full band into two equal halves. 1
X=Y
0.5
You can repeat the process on either or both of the signals u1 [p]
and v1 [p]. 0
0 1 2 3
1
Dividing the lower band in half repeatedly results in an octave band 0.5
U1 V1
U2 V2 V1
The properties perfect reconstruction and allpass are preserved 0.5
by the iteration. 0
0 1 2 3
1
U3 V3 V2 V1
0.5
0
0 1 2 3
15: Subband
Processing
Half-band filterbank:
Subband processing Reconstructed output is T (z)X(z) + A(z)X(z)
2-band Filterbank
Perfect Unwanted alias term is A(z)X(z)
Reconstruction
Quadrature Mirror
Filterbank (QMF) Perfect reconstruction: imposes strong constraints on analysis
Polyphase QMF
QMF Options
filters Hi (z) and synthesis filters Gi (z).
Linear Phase QMF
IIR Allpass QMF Quadrature Mirror Filterbank (QMF) adds an additional symmetry
Tree-structured
filterbanks constraint H1 (z) = H0 (z).
Summary
Perfect reconstruction now impossible except for trivial case.
Merry Xmas
Neat polyphase implementation with A(z) = 0
Johnston filters: Linear phase with T (z) 1
Allpass filters: Elliptic or Butterworth with |T (z)| = 1
Can iterate to form a tree structure with equal or unequal
bandwidths.
See Mitra chapter 14 (which also includes some perfect reconstruction
designs).
Notation
All signals and filter coefficients are real-valued unless explicitly noted otherwise.
Unless otherwise specified, upper and lower case letters are used for sequences and their z-transforms
respectively. The signal at a block diagram node V is v[n] and its z-transform is V (z).
x[n] = [a, b, c, d, e, f ] means that x[0] = a, . . . x[5] = f and that x[n] = 0 outside this range.
(z), (z), z , |z| and z denote respectively the real part, imaginary part, complex conjugate,
magnitude and argument of a complex number z.
Where necessary, the sample rate of a signal in a block diagram is indicated in the form @ f .
Abbreviations
Standard Sequences
Geometric Progression
1 r+1 zr1
rn=0 n zn = 1z1
provided that z1 6= 1.
n n = 1
provided that z1 < 1.
n=0 z 1z1
jn 1
DTFT: X(e j ) =
x[n]e x[n] = 2 X(e
j )e jn d
kn kn
DFT: X[k] = N1
0 x[n]e j2 N x[n] = 1
N 0N1 X[k]e j2 N
2(2n+1)k
DCT: X[k] = N1
n=0 x[n] cos 4N x[n] = X[0]
N
N1
+ N2 n=1 X[k] cos 2(2n+1)k
4N
2(2n+1+N)(2k+1) 2(2n+1+N)(2k+1)
MDCT: X[k] = 2N1
n=0 x[n] cos 8N y[n] = 1
N N1
0 X[k] cos 8N
Convolution
V e j = X e j Y e j
DTFT: v[n] = x[n] y[n] ,
r= x[r]y[n r]
1 1
j Y e j( ) d
V e j =
e j ~Y e j =
v[n] = x[n]y[n] 2 X 2 X e
N1
v[n] = x[n]y[n] V [k] = N1 X[k] ~N Y [k] , 1
N r=0 X[r]Y [(k r) mod N ]
Group Delay
F (nh[n])
j )
The group delay of a filter, H(z), is H (e j ) = dH(e = z dH(z)
= where
d H(z) dz
z=e j F (h[n])
F ( ) denotes the DTFT.
Three increasingly sophisticated formulae for estimating the minimum order of an FIR filter with unity
gain passbands:
a
1. M 3.5
a8
2. M 2.2
a1.220 log10 b
3. M 4.6
where a =stop band attenuation in dB, b = peak-to-peak passband ripple in dB and = width of
smallest transition band in radians per sample.
z-plane Transformations
A lowpass filter, H(z), with cutoff frequency 0 may be transformed into the filter H(z) as follows:
Noble Identities
Multirate Spectra
( h i
v Qr if Q | r
Upsample: x[r] = X(z) = V (zQ )
0 if Q - r
j2k 1
1 Q1
Downsample: y[m] = v[Qm] Y (z) = Q k=0 V e Q z Q
Multirate Commutators