Mavlas Slides
Mavlas Slides
3
Literature
Malah
Malah--Raz (Hebrew)
+ Equiripple
+ Multirate
- DFT frequency zero padding
- IIR Cheb
Cheb.,., Elliptic filters will be given in
tutorial only
B.
Porat,
Porat, A Course in Digital Signal
Processing, J. Wiley, 1997
4
Analog Signal Processing
y (ω ) 1
=
x(t) y(t) x(ω ) 1 + jωRC
5
Analog Signal Processing
6
Digital Signal Processing
Platform
General purpose computers
Dedicated Signal Processors
Dedicated hardware
Accuracy only depends on computer registers
Flexible
Repeatable
Adaptive
May be more sophisticated
7
What is DSP?
Digital Signal Processing – the
processing or manipulation of signals
using digital techniques
Digital
Input Signal Output
Signal
ADC DAC Signal
Processor
Analogue Digital to
to Digital Analogue
Converter Converter
Speech Processing
Speech coding/compression
Speech synthesis
Speech recognition
Some Properties of Speech
Vowels
•Quasi-periodic
•Relatively high signal power
Consonants
•Non-periodic (random)
•Relatively low signal power
Speech Coding
64 kbits/s
22.8 kbits/s
13 kbits/s
BTS
Speech Coding – Vocoder
Encoder
Original Speech
Analysis:
• Voiced/Unvoiced decision
• Pitch Period (voiced only)
• Signal power (Gain)
Pitch Decoder
Period Signal Power
Pulse Train V/U
G Vocal Tract
Model
Synthesized Speech
Random Noise
Digital Audio
Pseudo C code
for (n=0; n<N; n++)
{
s=0;
for (i=0; i<L; i++)
{
s += a[i] * x[n-i];
}
y[n] = s;
}
Traditional DSP Architecture
Multiply/Accumulate
Accumulator
y(n)
Sampling and quantization
Amplitude
Discrete
Continuous
50
49
48
47
46
45
T 2T Time
20
Continuous Time Fourier
Transform
Continuous time signal
CTFT
Sufficient condition
21
Inverse CTFT
Reconstruction of non
continuous point
22
Dirchlet conditions
23
Sinc in time Gate in frequency
Note:
X(t) is not
absolute
integrable
24
Gate in time Sinc in frequency
25
Order 1 Low pass filter
26
Order 1 Low pass filter
27
CTFT
28
CTFT
29
CTFT
30
Delta or Unit Impulse Function, δ(t)
δ(t)
1
0 t0 t
31
Dirac delta function
Impulse Function
For f() continuous at τ
33
Harmonic exponentials
34
COS
/SIN
35
SISO – Single Input – Single Output
Systems
A linear
Linear system has a
zero response
for zero
stimulus
Time invariant
36
Linear Time-
Time-Invariant Systems
h(t ) = T {δ (t )}
37
Unit Impulse
Any continuous
function can be
written as weighted
‘sum’ of impulses as ∞
x(t ) = ∫ x(τ )δ (t − τ )dτ
−∞
38
Response to Arbitrary Input
∞
y (t ) = T {x(t )} = T ∫ x(τ )δ (t − τ )dτ
− ∞
∞
= ∫ x(τ )T {δ (t − τ )}dτ
−∞
y (t ) = x(t ) ∗ h(t )
39
Convolution
∞
y (t ) = ∫ x(τ )h(t − τ )dτ
−∞
y (t ) = x(t ) ∗ h(t )
40
Properties of the Convolution Integral
Commutative
y (t ) = x(t ) ∗ h(t ) = h(t ) ∗ x(t )
Associative
{x(t ) ∗ h1 (t )}∗ h2 (t ) = x(t ) ∗ {h1 (t ) ∗ h2 (t )}
Distributive
x(t ) ∗ {h1 (t ) + h2 (t )} = x(t ) ∗ h1 (t ) + x(t ) ∗ h2 (t )
41
Eigenfunctions of Continuous-
Continuous-Time LTI Systems
∞
y (t ) = ∫ x(t − τ )h(τ )dτ
x(t)=est LTI System −∞
h(t)
∞ ∞
y (t ) = ∫ h(τ )e s (t −τ ) dτ = e st ∫ h(τ )e − sτ dτ
−∞ −∞
= H ( s )e = λe st
st
42
Eigenfunctions of Continuous-
Continuous-Time LTI Systems
Harmonic input Harmonic output
43
Transfer function
Define
44
LTI Real impulse response
systems
45
Periodic function
f (t) f ( t ) = f ( t + kT ) ∀t , ∀k
t
T T
f(t)⇒ a series
of frequencies
multiple of 1/T
46
Orthogonal basis
47
Single Periodic extension
f (t)
period
t
T
CTFT of the single period
The Fourier series coefficients are samples of the CTFT of the single
period function
Samples in frequency – Periodicity in time
48
Poisson Sum formula
49
f(t) F(ω)
t
ω
T
f(t) F(ω)
t
T T ω
ω0
50
Poisson Sum formula
51
Poisson Sum formula
52
Sampling “quick and dirty”
x(t) X(f)
t
BW
p(t) P(f)
f
t
T F=1/T
x(t)p(t) X(f)*P(f) f
t f
Sum of Energy of
Single period energy
Fourier coefficients
54
Symmetry for real x(t)
55
Finite Fourier series
Instead of infinite series, we approximate by using 2N-1 elements
- Gibbs
56
Periodic functions and LTI Systems
H(ω)
∞
jkω 0 +ψ ( kω 0 )
∑ k
a H (kω 0 ) ⋅ e
k = −∞
57
The Discrete time Fourier transform
X f (θ ) = X f (θ + 2π )
Inverse transform
58
Example
59
Harmonic functions
60
DTFT
61
DTFT
62
DTFT
63
Unit sample response
64
Response to harmonic signal
Eigenfunction
Frequency response
65
Discrete time periodic signals
66
Sampling
67
Sampling - Aliasing
1.2
1
__ s(t) = sin(2πf t)
0.8 0
0.6
0.4
s(t) @ fS
0.2
0
f0 = 1 Hz, fS = 3 Hz
-0.2 tt
-0.4
-0.6
-0.8
__ s (t) = sin(8πf t)
1 0
-1
-1.2
__ s (t) = sin(14πf t)
2 0
68
Sampling of continuous time x(t)
Sampling frequency
Sampling period
69
Inverse CTFT
XF(ω)
… …
ω
−3π/T -π/T π/T 3π/T
70
Compare to
71
Sampling
72
Band limited signal.
Nyquist condition is met
Nyquist
73
Band limited signal.
Nyquist condition is met
Aliasing
75
Sampling low-
low-pass signals
Continuous spectrum
(a) (a) Band-limited signal:
frequencies in [-B, B] (fMAX = B).
-B 0 B f
Discrete spectrum
(b)
No aliasing
(b) Time sampling frequency
repetition.
fS > 2 B no aliasing.
-B 0 B fS/2 f
Discrete spectrum
(c) Aliasing & corruption
(c) fS 2B aliasing !
76
Remark
The condition
May be extended to
77
Cos at fs/2
π
78
Cos at fs/2
π
79
Sinc
For
π 80
Non band limited signals
81
Antialiasing filter
(a) Signal of interest (a),(b) Out-of-band noise can aliase
Out of band
noise
Out of band into band of interest. Filter it before!
noise
-B 0 B f
(c) Antialiasing filter
(b) Passband: depends on bandwidth of
interest.
82
Under--sampling
Under
Using spectral replications to Bandpass signal
B
reduce sampling frequency fS centered on fC
requirements.
0 fC
2 ⋅ fC + B 2 ⋅ fC − B f
≤ fS ≤
m +1 m
-fS 0 fS 2fS
f fC
Example
fC = 20 MHz, B = 5MHz Advantages
Without under-sampling fS > 40 MHz. Slower ADCs / electronics
With under-sampling fS = 22.5 MHz (m=1);
needed.
83
Sampling of continuous time x(t)
Sampling frequency
Sampling period
84
Inverse CTFT
XF(ω)
… …
ω
−3π/T -π/T π/T 3π/T
85
Compare to
86
Sampling
87
Band limited signal.
Nyquist condition is met
Harry
Nyquist
1889-
1976 88
Band limited signal.
Nyquist condition is met
Aliasing
90
Remark
The condition
May be extended to
91
Cos at fs/2
π
92
Sin at fs/2
93
Sinc
For
π 94
Non band limited signals
95
Antialiasing filter
(a) Signal of interest
Out of band
Out of band
noise
noise
-B 0 B f
(b)
-B 0 B fS/2
(c) f
Antialiasing
Passband filter
frequency
-B 0 B f
96
Example Linear Technology Inc. LTC1564
LTC1564
Digitally Controlled Antialiasing Filter
97
98
99
100
Successive approximation register A/D
Acquisition Time
VS Data Output Register
½ LSB
VCSH(t)
tACQ
VSH0
t0 tACQ RSW
RS
Time -
VS S1
SAR
CSH +
N-bit DAC
Sample and Hold circuit
“Parasitic” LPF before sampling.
RC Designed to be much faster than Fs.
What happens with Band pass sampling ??
101
Sampled signal
y(t)
x(t)
∞ ∞
y (t ) = ∑ x(kT ) ⋅ δ (t − kT ) = x(t ) ⋅ ∑ δ (t − kT )
k = −∞ k = −∞
102
Impulse sampling
103
x(n) is a discrete
time series
xp(t) is a
continuous time
signal
x(n) and xp(t)
contain the same
information
104
Poisson formula
105
Compare to a pervious result
106
Time – Multiplying by an impulse train
Frequency – Convolution with an impulse train
107
Frequency relation between point and
impulse sampling
108
Shannon reconstruction
x(t) is a narrowband
signal
and sampling is performed at a frequency
higher than Nyquist condition
109
Proof
Only the main replica applies because we followed the Nyquist rule
110
using DTFT
and since
QED
111
Sinc interpolation (non casual)
112
General interpolation
Interpolation kernel
113
Condition on the interpolation kernel
Note that for Sinc interpolation kernel the
original sample values are kept after
reconstruction sum
114
Ideal reconstruction - frequency domain view
115
Other low pass filters
116
Zero--order hold
Zero
117
Zero order hold
118
ZOH – Frequency domain view
119
ZOH – Frequency domain view
120
ZOH – Frequency domain view
Ideal reconstruction filter
121
Recommended homework -
Find (time and frequency) properties of the
First--order interpolation kernel
First
Casual ???
122
Discrete Fourier
Transform
123
The DTFT
124
Sampling in
frequency
125
DFT frequency resolution
Experiment length
126
Periodic series
limited in time to
127
Properties
128
Properties
129
DFT and DTFT
The DFT samples on period of
the discrete-
discrete-time Fourier
transform (DTFT) at N evenly
spaced frequencies fftshift()
130
Matlab Example: f=0
f=0 (DC), N=32
N=32--point DFT
n=0:31;
n=0 31;
f=0
f=0.0;
x = cos(
cos(2*pi*n*f);
figure(1
figure( 1); stem(
stem(n,x
n,x);
);
figure(2
figure( 2); stem(
stem(n,abs
n,abs((fft
fft(x)));
(x))); % FFT is a fast algorithm to calculate DFT
x(n) |X(k)|
35
1
0.9
30
0.8
25
0.7
0.6
20
0.5
15
0.4
0.3
10
0.2
5
0.1
0 0
0 5 10 15 20 25 30 35 0 5 10 15 20 25 30 35
NOTE: Matlab indexes starting from 1 (i.e x(1) to x(N)) not 0 (i.e. x(0) to x(N-1))
131
Matlab Example: f=0
f=0.25,
25, N=
N=32
32--point DFT
n=0:31;
n=0 31;
f=0
f=0.25;
25;
x = cos(
cos(2*pi*n*f);
figure(1
figure( 1); stem(
stem(n,x
n,x);
);
figure(2
figure( 2); stem(
stem(n,abs
n,abs((fft
fft(x)));
(x)));
x(n) |X(k)|
1 16
0.8 14
0.6
12
0.4
10
0.2
0 8
-0.2
6
-0.4
4
-0.6
2
-0.8
-1 0
0 5 10 15 20 25 30 35 0 5 10 15 20 25 30 35
132
DFT of Cosine
133
134
DFT of cosine
Integral number of
cosine periods
135
Why we do not get “two deltas” ?
We calculate DFT on a limited time cosine
y(θ )
1
θ
-1 −θ0 θ0
0 5 10 15 20 25 30
1
0.5
0
0 5 10 15 20 25 30
*
1
-1
0 5 10 15 20 25 30
136
Why we do not get “two deltas” ?
137
Inverse DFT
138
Zero padding
139
Zero padding
Improves DFT frequency inter-sampling spacing (“resolution”).
8
1
6
0.5 4
time
0 2
0 4 8 12 16 0
-0.5
0 1 2 3 4 5 bin 6
-1
88
1
66
0.5 44
time
time
0 22
0 10
3 206 309 401250 1560 18
70 21
80 90
24 100
27 110
30120 00
-0.5
00 12
3 24
6 36
9 bin
bin 48
12
-1
140
Discrete Fourier Transform (DFT)
The Discrete Fourier Transform (DFT) of a finite length sequence
N −1 j 2πnk
−
X [k ] = DFTN {x[n ]} = ∑ x[n ]e N
for k ∈ {0,..., N − 1}
n =0
N −1 j 2πnk
1
x[n ] = IDFTN {X [k ]} = ∑ X [k ]e N
for n ∈ {0,..., N − 1}
N k =0
DFT
x[n ] ←
→ X [k ]
141
DFT Transformation Matrix
The DFT can be represented as a symmetric matrix
1 1 1 1 1 1
WN = e j 2π / N
1 W −1 W −2
W −3
... W −( N −1)
FN = N N N N
WNi , j = WN( i −1)( j −1)
: : : : : :
− ( N −1) − 2 ( N −1) −3( N −1) − ( N −1) 2
i, j : row and column indexes
1 WN WN WN ... WN
142
The DFT matrix is (almost) unitary
−1 1 T
FN = FN
N
143
DFT Example
x = [1 3 0 − 2]T , 1 1 1 1 1 2 X [0]
1 − j − 1 j 3 1 − 5 j X [1]
X = F4 x = = =
1 − 1 1 − 1 0 0 X [ 2]
X = Tx
1 j − 1 − j −
2 1 + 5 j X [3]
145
Simple script file using FFT
146
Signal plus noise
147
Simple script file using FFT pt2
pt2
148
Frequency content
149
DFT Properties
DFT DFT DFT
Let x[n ] ←→ X [k ], y[n ] ←→ Y [k ], h[n ] ←→ H [k ]
be length-
length-N sequences indexed n=0,…,N ,…,N-1.
DFT Properties:
Linearity: For constant a, b:
DFT
ax[n ] + by[n ] ←→ aX [k ] + Y [k ]
Real Sequences:
Sequences: If x[n] is real
real::
X [k ] = X [ N − k ] and ∠X [k ] = −∠X [ N − k ]
150
Cyclic time shift
151
DFT Circular Shift Property
152
Cyclic frequency shift
153
DFT Properties
Duality: DFTN {X [k ]} = Nx[ N − n ]
Parseval’s Theorem N −1 N −1
2 2
∑ X [k ]
k =0
=N 2
∑ x[n]
n =0
154
Cyclic Convolution
Signals of Length N, n=0,1,…,N-1
Periodic extension
155
Cyclic Convolution
Why is cyclic convolution
not true linear convolution?
Because a wraparound
effect occurs at the “ends”:
The procedure of each pair
are summed around the
circle.
In a while, it will be seen
that y[n ] = x[n ] * h[n ]
can be computed using
N
y[n ] = x[n ] ⊗ h[n ].
156
Circulant matrix interpretation
157
Cyclic convolution and DFT
158
Cyclic convolution and DFT
159
Cyclic Convolution Example
→ X 1[n] = WN− kn0
DFT
x1[n] = δ [n − n0 ] ←
x3[n ] = x1[n ] ⊗ x2 [n ]
N −1
= ∑ x1[k ]x2 [(( n − k )) N ]
k =0
= x2 [(( n − n0 )) N ]
160
Linear Convolution by DFT
Linear convolution is desired. The linear convolution can be
computed via DFT, with a minor modification.
Method: To compute the linear convolution
y[n ] = x[n ] * h[n ]
of a sequence x[n] of length-
length- N1 and a sequence h[n] of length-
length- N2
via the DFT, form the length N1 + N2 -1 zero-
zero-padded sequences
x[n]; 0 ≤ n ≤ N1 − 1 h[n]; 0 ≤ n ≤ N2 −1
xa [ n ] = ha [n] =
0 N1 ≤ n ≤ N1 + N 2 − 2 0 N 2 ≤ n ≤ N1 + N 2 − 2
N1 + N 2 −1
ya [n] = xa [n] ⊗ ha [n]
= x[n ] * h[n ]; 0 ≤ n ≤ N1 + N 2 − 2
161
Linear Convolution
Non zero
contributions at
162
Zero padding to length N=N1+N2-1
x[n]; 0 ≤ n ≤ N1 − 1
xa [ n ] =
0 N1 ≤ n ≤ N1 + N 2 − 2
y[n]; 0 ≤ n ≤ N2 −1
y a [ n] =
0 N 2 ≤ n ≤ N1 + N 2 − 2
163
Linear and Cyclic convolution
164
Non zero regions
− N − n ≤ −m ≤ N 2 − 1 − N − n
N + n ≥ m ≥ N − N2 +1+ n
N + n ≥ m ≥ N1 + n
165
DFT of periodic signals*
x(t) with period T0 is samples at T=T0/N
(N samples per period)
* Tip – Topic the lecturer is very fond of. Look at exams from previous semesters. 166
DFT of periodic signals
167
DFT of periodic signals (aliasing)
168
FFT
169
Top 10
Monte Carlo method or Metropolis algorithm, devised by John von Neumann,
Stanislaw Ulam,
Ulam, and Nicholas Metropolis;
simplex method of linear programming, developed by George Dantzig; Dantzig;
Krylov Subspace Iteration method, developed by Magnus Hestenes,
Hestenes, Eduard
Stiefel,, and Cornelius Lanczos;
Stiefel Lanczos;
Householder matrix decomposition, developed by Alston Householder;
Fortran compiler, developed by a team lead by John Backus;
QR algorithm for eigenvalue calculation, developed by J Francis;
Quicksort algorithm, developed by Anthony Hoare;
Fast Fourier Transform,
Transform, developed by James Cooley and John Tukey; Tukey;
Integer Relation Detection Algorithm, developed by Helaman Ferguson and
Rodney Forcade;
Forcade; (given N real values XI, is there a nontrivial set of integer
coefficients AI so that sum ( 1 <= I <= N ) AI * XI = 0?
Fast Multipole algorithm, developed by Leslie Greengard and Vladimir Rokhlin;Rokhlin; (to
calculate gravitational forces in an N-
N-body problem normally requires N^ N^2
2
calculations. The fast multipole method uses order N calculations, by
approximating the effects of groups of distant particles using multipole expansions)
170
Cooley and Tukey
171
Performance of the DFT
Algorithm
The DFT requires N2 (NxN
NxN)) complex multiplications:
Each X(k) requires N complex multiplications.
Therefore to evaluate all the values of the DFT ( X(0
X(0) to X(N
X(N--1) )
N2 multiplications are required.
The DFT also requires (N-
(N-1)*N complex additions:
Each X(k) requires N-
N-1 additions.
Therefore to evaluate all the values of the DFT (N-
(N-1)*N additions
are required.
172
DFT → FFT
N −1
X (k ) = ∑ x[n]WN− nk ; 0 ≤ k ≤ N − 1
n =0
x[n] = x[0
x[0], x[1
x[1], …, x[N-
x[N-1] we assume N even
Divide the sequence x[n] into even and odd
sequences:
x[2
x[2n] = x[
x[0
0], x[
x[2
2], …, x[N
x[N--2]
x[2
x[2n+1
n+1] = x[
x[1
1], x[
x[3
3], …, x[N
x[N--1]
173
Decimation-in-Time Factorization
N −1
− kn
X [k ] = ∑ x[n] ⋅ WN , k = 0,1,L, N − 1 and N even
n =0
N − pt . DFT
= ∑
n , even
+ ∑
n , odd
Note that : W22Nr = WNr
N / 2 −1 N / 2 −1
− 2 rk − ( 2 r +1) k
= ∑ x[2r ]W
r =0
N + ∑ x[2r + 1]W
r =0
N
N / 2 −1 N / 2 −1
− rk −k − rk
= ∑ x[2r ]WN / 2
r =0
+ WN ⋅ ∑ x[2r + 1]WN / 2
r =0
N / 2 − pt . DFT ,G ( k ) N / 2 − pt . DFT , H ( k )
174
DFT → FFT
The result is that an N-
N-point DFT can be
divided into two N/2
N/2 point DFT’s:
N −1
X (k ) = ∑ x[n ]WN− nk ; 0 ≤ k ≤ N − 1 N-point DFT
n =0
M
N N
−1 N −1 N
N 2 −n k +
−k −
N 2 −n k +
X k + = ∑ xe [n]W N
2
+ WN 2
∑ x [n]W o N
2
2 n =0 2 n =0 2
N 2π 2π N 2π
−k − −j k −j −j k
− jπ
WN 2
=e N
e N 2
=e N
e = −WN− k
N 2π 2π N 2π
− k + −j k −j −j k
W N
2
=e N 2
e N 22
=e N 2
= W N− k
2 2
176
DFT → FFT
N N
−1 −1
N 2 2
X k + = ∑ xe [n]W N− nk − WN− k ∑ xo [n]W N− nk
2 n =0 2 n =0 2
= Y (k ) − WN− k Z (k )
177
DFT → FFT
N
X (k ) = Y (k ) + W Z (k ); k = 0,K − 1
−k
N
2
N N
X k + = Y (k ) − WN− k Z (k ); k = 0,K − 1
2 2
Y(k) and WNk Z(k) only need to be calculated once and used for
both equations.
Note: the calculation is reduced from 0 to N
N--1 to 0 to (N/2
(N/2 - 1).
N=2L, Y(k) and Z(k) can also be divided into N/4
If N=2 N/4, N/
N/8
8,… point
DFTs using the same process shown above.
178
DFT → FFT
The process continues until we reach 1 point DFTs
N=1
N= 1.
0
X [k = 0] = ∑ x(n )W = x(n )
d
1
0
n =0
179
Decimation--in-
Decimation in-time Radix-
Radix-2 FFT
(N=8
(N= 8)
Decimation--in-
Decimation in-time Radix-
Radix-2 FFT
(N=8
(N= 8)
Radix--2 DIT Basic Butterfly
Radix
a (complex) A (complex)
b (complex) B (complex)
W N (complex)
FFT Implementation
To efficiently implement the FFT algorithm a
few observations are made:
Each stage has the same number of butterflies
(number of butterflies = N/2
N/2, N is number of
points).
The number of DFT groups per stage is equal to
(N/2
(N/ 2stage).
The difference between the upper and lower leg is
equal to 2stage
stage--1.
183
Twiddles
2πk 2πk
W = cos
k
N + j sin
Note that the twiddles N N
.
.
. 184
Bit reversal
During the first recursion, we split the signal to odd
and even (according to the Least Significant Bit)
For every stage the LSB becomes the Most
Significant Bit
The order of samples at input should be changed
according to the bit reverse rule (reverse the
“address bus”)
185
Bit reversal
186
Spectral analysis
187
Signal windowing
y(n) – discrete time signal
We time-
time-limit the signal by multiplying it with a time
limited “window” function – w(n), n=0
n=0,1,…,N
,…,N--1
x(n)=y(n)*w(n)
Example: Rectangle window
x(n ) = y (n )wr (n ) =
1 n = 0,1,..., N − 1
= y (n ) ⋅
0 otherwise
y (n ) n = 0,1,..., N − 1
=
0 otherwise
188
Frequency domain
x(n)=y(n).w(n)
189
Rectangular window
Dirichlet kernel
“Linear phase” – To be
revisited 190
Dirichlet kernel
191
Dirichlet kernel
Maximum at
Zeros at
Ratio
between main lobe and
highest side lobe is
192
Analysis of a pure cosine
y (θ )
θ
*
− θ0 θ0
193
Width of main lobe
Width of main lobe defines the frequency
resolution.
Wide main lobe – poor resolution
Width is proportional to 1/N
194
195
Sampled
amplitudes
do not
perfectly
reflects true
amplitudes
196
Ratio between main and side lobes
– “energy leak”
Side lobes of high amplitude signal may “mask” weaker
signal if its side lobes are higher than the weak signal
The side lobes ratio does not change with N
E.g. Rectangle window may mask signals that are 13 13dB
dB
weaker (not so good…)
197
Triangle window
Motivation – Higher ratio between main
lobe and side lobes
Method
In the frequency domain -Window with
Dirichlet2 response = 27dB
27dB main
main--side lobe
ratio
In the time domain - Rectangle Window *
Rectangle window = Triangle window
198
Triangle window – N odd
Two rectangle windows – Length (N+1)/2 each
199
Triangle window – N even
Convolution between two
rectangle windows – Length
(N+1)/2 and N/2
200
Rectangle window
8π
Width of main lobe
N 201
Raised cosine windows
Motivation - Obtain small side lobes
In the frequency domain – Linear
combination of the Dirichlet kernel and
modulated Dirichlet kernels
202
Raised cosine windows
Rectangle
window
204
Hann Window
8π
Width of main lobe
N
205
Hamming Window
206
Hamming Window
8π
Width of main lobe
N
207
Blackman Window
208
Blackman Window
12π
Width of main lobe
N
209
Kaiser window
A family of windows that depends on a
parameter α.
α continuously tradeoffs between the
width of main lobe and the main-
main-to
to--side
lobes ratio
As α increases the main-
main-to
to--side lobes
ratio gets larger but main lobe width also
increases
210
Kaiser window
211
Kaiser window
212
Kaiser window
213
Window shopping
214
DFT - Window loss remedial
Smooth data-
data-tapering windows cause information loss near edges.
Drawback: increased
DFT AVERAGING
total processing time.
215
Example 1 – Main lobe width
For most applications - X axis is plotted in Hz up to ½ sampling rate
Fs=1000;;
Fs=1000
Ts=1
Ts= 1/Fs;
t=0
t=0:Ts:1023
:Ts:1023*Ts;
*Ts;
Freqs=(
Freqs =(00:512
512)/)/512
512**500
500;;
x=cos
x= cos((2*pi*100
*pi*100*t)+
*t)+0
0.5*cos
cos((2*pi*
*pi*102
102*t)
*t) +
0.1*randn(size(t));
randn(size(t));
X=abs(fft
X=abs( fft(x));
(x));
plot(Freqs,20
plot(Freqs, 20*log
*log10
10(X(
(X(11:513
513)));
)));
xlabel('Freq
xlabel ('Freq (Hz)')
ylabel('Amplitude
ylabel ('Amplitude (dB)')
216
Example 1 – Main lobe width
60
50
40
30
Amplitude (dB)
20
10
-10
-20
0 50 100 150 200 250 300 350 400 450 500
Freq (Hz)
217
Example 1a – Main lobe width
Fs=1000;;
Fs=1000
Ts=1
Ts= 1/Fs;
t=0
t=0:Ts:
:Ts:1023
1023*Ts;
*Ts;
Freqs=(0
Freqs=( 0:512
512)/
)/512
512**500
500;;
x=cos(2
x=cos( 2*pi*
*pi*100
100*t)+
*t)+0
0.5*cos(
*cos(22*pi*
*pi*102
102*t)+
*t)+00.1*randn(size(t));
x=x.*blackman(1024
x=x.*blackman( 1024)';
)';
X=abs(fft(x));
plot(Freqs,20
plot(Freqs, 20*log
*log10
10(X(
(X(1 1:513
513)));
)));
xlabel('Freq (Hz)')
ylabel('Amplitude (dB)')
218
Example 1a – Main lobe width
50
40
30
Amplitude (dB)
20
10
-10
-20
0 50 100 150 200 250 300 350 400 450 500
Freq (Hz)
219
Example 2 – Main-
Main-to-
to-Side lobes
ratio
Fs=1000;;
Fs=1000
Ts=1
Ts= 1/Fs;
t=0
t=0:Ts:1023
:Ts:1023*Ts;
*Ts;
Freqs=(0
Freqs=( 0:512)/
512)/512
512**500
500;;
x=cos(2
x=cos( 2*pi*
*pi*100
100*t)
*t) + 0.002
002*cos(
*cos(22*pi*
*pi*150
150*t)
*t) +
0.001
001*randn(size(t));
*randn(size(t));
X=abs(fft(x));
plot(Freqs,20
plot(Freqs, 20*log
*log1010(X(
(X(11:513
513)));
)));
xlabel('Freq (Hz)')
ylabel('Amplitude (dB)')
220
Example 2 – Main-
Main-to-
to-Side lobes
ratio
60
50
40
Amplitude (dB)
30
20
10
-10
0 50 100 150 200 250 300 350 400 450 500
Freq (Hz)
221
Example 2a – Main-
Main-to-
to-Side lobes
ratio
Fs=1000;;
Fs=1000
Ts=1
Ts= 1/Fs;
t=0
t= 0:Ts:
:Ts:1023
1023*Ts;
*Ts;
Freqs=(0
Freqs=( 0:512
512)/
)/512
512**500
500;;
x=cos(2
x=cos( 2*pi*
*pi*100
100*t)
*t) + 0.002
002*cos(
*cos(2
2*pi*
*pi*150
150*t)
*t) +
0.001
001*randn(size(t));
*randn(size(t));
x=x.*blackman(1024
x=x.*blackman( 1024)';
)';
X=abs(fft(x));
plot(Freqs,20
plot(Freqs, 20*log
*log1010(X(
(X(1 1:513)));
513)));
xlabel('Freq (Hz)')
ylabel('Amplitude (dB)')
222
Example 2a – Main-
Main-to-
to-Side lobes
ratio
50
0
Amplitude (dB)
-50
-100
0 50 100 150 200 250 300 350 400 450 500
Freq (Hz)
223
Filter design
224
RCSR – Real coefficients,
Causal, Stable, Rational)
Continuous time filter
225
Region of Convergence
Re( s ) > −α
jω
complex plane
ROC
pole
x
-α σ
226
Poles and Zeros
s −1
X ( s) = Re( s ) > −1
( s + 2)( s + 1)
jω
complex plane
ROC
poles
x x o
-2 -1 1 σ
zero
227
For distinct poles
228
Discrete time
229
Example: Region of
Convergence
∞ ∞
| X ( z ) |= ∑ x (
n = −∞
n ) z −n
= ∑ | x
n = −∞
( n ) || z | −n
<∞
Im
ROC is an annual ring centered on the
origin.
r
RI <| z |< RO
Re
ROC = {z = re jθ | RI < r < RO }
Stable Systems
Re
Causal Signal
x[n] = a nu[n] ∞
X ( z ) = ∑ az( ) −1 n
=
1
z >a
x[n] 1 a a2 a3 a4 a5 … n =0 1 − az −1
z
n X ( z) = z >a unit circle
z−a
zero pole
o x
a 1
ROC
232
complex z-plane
Anti--causal Signal
Anti
x[n] = −a nu[−n − 1]
∞ −1
X ( z ) = − ∑ a u (−n − 1) zn −n
= − ∑ a n z −n
n = −∞ n = −∞
∞ ∞
( )
= −∑ a z = 1 − ∑ a −1 z
−1 n
( ) n
n =1 n =0
1
= 1− z<a
1 − a −1 z
z unit circle
X ( z) = z<a
z−a
zero pole
ROC
o x
1 a
233
complex z-plane
For distinct poles
Stable if
234
FIR and IIR systems
A discrete system is said to be an
FIR system if its impulse response has
zero--valued samples for n > M > 0
zero
Integer number M is called the
order of the impulse response
IIR system is a discrete system with an
infinite impulse response
FIR = Finite Impulse Response
IIR = Infinite Impulse Response
235
Representations of discrete time
systems
Z-domain
236
Difference equation
−1 −q
H z (z ) =
Y ( z ) =
b0 + b1 z + ... + bq z
X ( z ) 1 + a1 z −1 + ... + a p z − p
[ ] [
Y ( z ) ⋅ 1 + a1 z −1 + ... + a p z − p = X ( z ) ⋅ b0 + b1 z −1 + ... + bq z − q ]
y (n ) + a1 y (n − 1) + ... + a p y (n − p ) =
= b0 x(n ) + b1 x(n − 1) + ... + bq x(n − q )
237
Difference equation building blocks
y (n ) = − a1 y (n − 1) − ... − a p y (n − p ) +
+ b0 x(n ) + b1 x(n − 1) + ... + bq x(n − q )
Delay
Multiplier
Adder
238
FIR
239
IIR
240
Filter types
241
Specifications of LPF
Transition band
Pass
band
Stop band
242
Pass band
Nominal gain is 1
Pass band ripple
In dB
Approximation
243
Transition band
No specific requirements
Response is expected to be monotonic
Important: we shall see that the complexity
of the filter depends heavily on the width
of the transition band
244
Stop band attenuation (ripple)
245
arctan2
arctan2 – arctangent function for all
four quadrants
arctan(y/x) is limited to first two quadrants (sign ambiguity)
246
Frequency response of RCSR
systems
247
Continuity
For RCSR systems is continuous on the unit circle.
2. Zero amplitude
248
Case 1 - Function crosses the
negative real line
2π
phase
jump
249
Example – y(n)=x(n
y(n)=x(n--8)-x(n-
x(n-10)
10)
2 4
1.8
3
1.6
2
1.4
1
1.2
Amplitude
Phase
1 0
0.8
-1
0.6
-2
0.4
-3
0.2
0 -4
0 0.5 1 1.5 2 2.5 3 3.5 0 0.5 1 1.5 2 2.5 3 3.5
Freq Freq
2π jumps
250
can be zero only for a finite
number of points
251
Case 2 - Zero amplitude
Phase
undefined
at z=0
10 1.5
9 1
8
0.5
7
0
6
Amplitude
-0.5
Phase
5
-1
4
-1.5
3
-2
2
1 -2.5
0 -3
0 0.5 1 1.5 2 2.5 3 3.5 0 0.5 1 1.5 2 2.5 3 3.5
Freq Freq
Case 1 – always 2π
Case 2 - is zero if
has a zero with multiplicity m on
the unit circle at
254
Case 2 - continued
Continuous phase
Continuous near
π jump if m odd
255
Continuous phase representation
We shall allow phase to be any real number
[–π,π)
and not limited to [– π),, to overcome 2π
jumps
We shall define an Amplitude function
instead of absolute value. The new Amplitude
function will allow negative values, to
overcome π jumps
257
Example
258
Formal math.
Discontinuity points
259
260
Linear phase
2.261
Delay (number of samples - integer)
Pure delay
X(n) y(n)=x(n-L)
No distortion
Linear phase
262
Delayed sinc L=5
L=5
263
Non integer delay
X(n) ?
− jθ ( L + δ )
Y (θ ) = X (θ ) ⋅ e
Integer fraction
264
Non integer delay
1 m = n − L
for δ = 0, sinc(n − m − L ) =
0 otherwise 265
Non integer delay
Assume signal is sampled at T=1
∞
y (n ) = ∑ x(m)sinc[t − m]
m = −∞ t = n − L −δ
x(t) x(t − L − δ )
Ideal sinc Continuous Sample
x(n) y(n)
reconstruction time delay
266
Delayed sinc 4.5 samples
267
Linear phase filters
Continuous phase representation
Note: The phase properties are relevant mainly to the pass band of the
filter.
268
Generalized Linear phase
During the last section we discussed Linear Phase systems with the form
− jθτ p
H (θ ) = e
We shall now try to generalize this to systems with initial non zero phase
?
jφ 0 − jθτ g
H (θ ) = e
For RCSR systems, the phase is anti-symmetric (phase at DC is zero)
Envelope carrier
271
Modulation property
x(n ) ↔ X f (θ )
1 f
[
x(n ) ⋅ cos(θ c ⋅ n ) ↔ X (θ − θ c ) + X f (θ + θ c )
2
]
The output
1
[
Y (θ ) = H (θ ) X f (θ − θ c ) + X f (θ + θ c ) =
f
2
]
Positive frequencies negative frequencies
1 f jφ 0 − jθτ g 1 f − jφ 0 − jθτ g
= X (θ − θ c ) ⋅ e + X (θ + θ c ) ⋅ e
2 2
272
1 f jφ 0 − jθτ g 1 f − jφ 0 − jθτ g
Y (θ ) = X (θ − θ c ) ⋅ e
f
+ X (θ + θ c ) ⋅ e =
2 2
1 f jφ 0 + jθ cτ g − jθ cτ g − jθτ g
= X (θ − θ c ) ⋅ e
2
1 f − jφ 0 + jθ cτ g − jθ cτ g − jθτ g
+ X (θ + θ c ) ⋅ e =
2
1 f − j (θ −θ c )τ g jφ 0 − jθ cτ g
= X (θ − θ c ) ⋅ e ⋅e
2 Constants
1 f − j (θ +θ c )τ g − jφ 0 + jθ cτ g
+ X (θ + θ c ) ⋅ e ⋅e
2
273
Linear phase delay
x(n ) ↔ X f (θ )
of envelope
define
− jθτ g
v(n ) ↔ X (θ ) ⋅ e
f
Delayed cosine
1 jφ0 − jθ cτ g
cos[θ c ⋅ (n − τ g ) + φ0 ] ↔ e
2
[ ⋅ δ (θ − θ c ) + e
− jφ 0 + jθ cτ g
⋅ δ (θ + θ c ) ]
Convolution in frequency
v(n ) ⋅ cos(θ c ⋅ (n − τ g ) + φ0 ) ↔
1 f − j (θ −θ c )τ g jφ 0 − jθ cτ g
X (θ − θ c ) ⋅ e ⋅e +
2
1 f
Envelope is delayed by τg
− j (θ +θ c )τ g − jφ 0 + jθ cτ g
+ X (θ + θ c )e ⋅e
2
274
The constant phase affects the
carrier but not the envelope
where
275
GLP -Generalized linear phase
Group delay
276
Group delay is L or L+0
L+0.5
Is periodic
Real Real
Must be integer
277
Group delay is L/L+0
L/L+0.5
278
h(n) is
real
Real
279
Four types of GLP filters
280
The impulse response of Types I,II is symmetric
281
The impulse response of Types I,II is symmetric
Type I
Type II
Type III
Type IV
Im(z)
Re(z)
284
Same absolute value
285
Minimum--Phase System
Minimum
The new system has same absolute value, but with
mirrored zero
Theorem: The system with zero inside unit circle has
lower group delay
A system with all poles and zeros inside the unit circle is
called “minimum-
“minimum-phase”. Both the system function and
the inverse is causal and stable
A system with all poles inside the unit circle and zeros
outside is called “maximum-
“maximum-phase”. No inverse system.
Given an RCSR filter, we may build a minimum phase
RCSR filter with the same absolute value.
286
All-
All -
Using mirrored pole and zero
Pass filter
In general
287
Minimum-phase and All-
Minimum- All-pass
decomposition
Zero in unit circle MP
Zero outside
Add mirrored pole Zero and pole to AP
Add mirrored zero MP
288
Example
Consider the following system 1 + 3z −1
H1 (z ) =
1
1 + z −1
2
One pole inside the unit circle:
Make part of minimum-
minimum-phase system
One zero outside the unit circle:
Add an all-
all-pass system to reflect this zero inside the unit circle
1 −1
1− z
1 + 3z −1 1 −1 1 1 −1 1 3
H1 (z ) = =3 z + = 3 z +
1 −1 1 −1 3 1 1 −1
1 + z −1
3
1+ z 1+ z 1− z
2 2 2 3
1 −1 −1 1
1 − z z +
H1 (z ) = 3 3 3 = H (z )H (z )
min ap
1 + z −1 1 − z −1
1 1
2 3
289
Frequency-Response
Frequency-
Compensation
In some applications a signal is distorted by an LTI system
Could filter with inverse filter to recover input signal
Would work only with minimum-
minimum-phase systems
Make use of minimum-
minimum-phase all-
all-pass decomposition
Invert minimum phase part
Assume a distorting system Hd(z)
Decompose it into H z d ( ) = Hd,min (z)Hd,ap (z)
Define compensating system as 1
Hc (z ) =
Hd,min (z )
Cascade of the distorting system and compensating system
1
G(z ) = Hc (z )Hd (z ) = Hd,min (z )Hd,ap (z ) = Hd,ap (z )
Hd,min (z )
290
FIR Filters
N – filter order
Total of N+1 non-zero coefficients
291
y (n) = h0 x(n) + h1 x(n − 1) + ... + hM x(n − M )
Direct implementation
Dual implementation
292
Example 1: Average of two samples
1/2
h(0) = 12 , h(1) = 12 ; 0 1
293
Example 1: Average
h(0) = 12 , h(1) = 12 ;
Equation: y ( n) = 1
2
(x(n) + x(n − 1) )
Transfer function: H ( z ) = 12 + 12 z −1
j θ2 − j θ2 − j θ2 − i θ2
jθ 1
H (e ) = (1 + e
2
− jθ 1
) = (e + e
2 )e = cos( )e
θ
2
294
Example 2: Difference of two samples
1
295
Example 2: Differentiator
j θ2 − j θ2 − j θ2 − j θ2 + j π2
jθ
H (e ) = 1 − e − jθ
= (e − e )e = 2 sin ( )e
θ
2
296
Type I FIR Linear-
Linear-Phase System
Even order
Symmetric
Zero initial phase
297
Frequency response – type I
298
Frequency response – type I
Linear phase amplitude
299
Type I
Symmetric impulse response Amplitude symmetric with period is 2π
300
Type II FIR Linear-
Linear-Phase System
Odd order
Symmetric
Zero initial phase
301
Frequency response – type II
302
Frequency response – type II
Linear phase amplitude
Cannot be HP
303
Type II
Symmetric impulse response Amplitude symmetric with period is 4π
304
Type III FIR Linear-
Linear-Phase
System
Even order
Anti-symmetric
Initial phase
305
Frequency response – type III
Linear phase amplitude
307
Type IV FIR Linear-
Linear-Phase
System
Odd order
Anti-symmetric
Initial phase
308
Frequency response – type IV
Linear phase amplitude
310
Summary of the four types
311
Summary
313
Typical Zero Locations
314
Linear phase Low pass zeros map
2.315
Relation of FIR Linear Phase to
Minimum--Phase
Minimum
In general a linear-
linear-phase FIR system is not minimum
minimum--phase
We can always write a linear-
linear-phase FIR system as
( )
Hmax (z ) = Hmin z −1 z −Mi
316
FIR filter design
IRT - Impulse response truncation
IRT 2 –Windows
Equi
Equi--ripple filters
317
IRT
Given filter specifications, select filter type
and order (group delay is half of the order)
Specify ideal filter response (including linear
phase)
Perform inverse DTFT
Truncate response
Verify design
318
Band pass filter – Type I,II
319
Special cases
321
Example
322
Déjà vu
Both examples presented the familiar
Gibbs ripple due to limitation in time
We met that before when we discussed
spectral analysis using a rectangle
windows
Soon we shall try other windows
323
Differentiator
Continuous time
Ideal filter
We shall see that type III will not provide good results due to its zero
at π
324
Differentiator
325
Differentiator
326
Differentiator
327
Hilbert filter
Very useful with bandpass applications
Benefits:
328
Hilbert filter 1
xˆ (t ) = x(t ) ∗
Filter impulse response is 1/πt πt
x(τ )
∞
Frequency domain Hilbert transfer 1
∫−∞t − τ dτ
function: =
π
− j , when f > 0
+90
H ( f ) = − j sgn ( f ) = + j , when f < 0
0, when f = 0 f
-90
The signal and its Hilbert transform are
orthogonal ∞
Phase response
z (t ) = a (t ) cos(2π f o t + θ (t ))
where a(t ) = + x 2 (t ) + y 2 (t )
and
θ (t ) = sin −1 ( y (t ) / x(t ))
330
Analytic signal
Upper graph shows an FFT of the
original signal, x(t).
x+ (t ) = x(t ) + j xˆ (t )
2 Z ( f ), when f > 0
Z + ( f ) = Z ( f ) + j[− j sgn ( f )]Z ( f ) = Z (0 ), when f = 0
0, when f < 0
331
Pre--envelope
Pre
Baseband signal: g(t ) = m(t ) cos(2π fc t + θ )
G(f)
G+(f)
332
Complex Envelope Summary
Complex/pre envelope are related
G+(f)
− j 2πfc t
g˜ (t ) = g+ (t)e
or
Gˆ ( f )
j 2πfc t
g+ (t) = g˜ (t )e
333
Signal
334
Signal + Hilbert
335
Envelope
336
Discrete time Hilbert filter
Continuous time
(almost “All Pass”)
337
Hilbert filter impulse response
338
Hilbert filter
339
Hilbert filter
340
L2 Optimality of IRT
Desired Actual
342
Example
343
Windows
The convolution between the Dirichlet kernel
and the ideal filter response results in the Gibbs
ripple
We already know other windows with better
performance in the frequency domain
Instead of simple truncation, use Window
Window length will be filter order
All windows we know are symmetric, will keep original
symmetric / anti-
anti-symmetric properties
344
Windowing in Frequency Domain
π
1
( )
H e jθ =
2π ∫ H d ( ) (
e jλ
W e )
j (θ − λ )
dλ
−π
345
Windows
The width of window’s main lobe equals
the width of the transition band. Getting
smaller with N
Ripple is the same for pass and stop band
The ripple is a depends on the window
type and its side lobes.
Unlike DFT, relation is indirect to window’s
side lobes (there is a convolution here).
Ripple figures are different from DFT.
346
Windowed IRT
Given filter specifications,
select filter type and order
(group delay is half of the
order)
Specify ideal filter
response (including linear
phase)
Perform inverse DTFT
Truncate h(n) by a
window w(n) h(n ) = hd (n )w(n )
Verify design
347
Effect of windowing
Gibbs
348
Example:FIR Filter Design by Windowing Method
20 * log10 H ( e jω ) N=55
[dB]
Bartlett Window
Rectangular Window
Hamming Window
ω
349
Example:FIR Filter Design by Windowing Method
20 * log10 H ( e jω ) [dB] Rectangular Window
ω 350
Matlab code
close all;
clear all;
figure(1)
plot(f,20*log10(abs(g))); % plot transfer function
axis([0 2*10^4 -70 10]);
figure(2);
stem(d); % plot coefficient values
xlabel('Coefficient number');
ylabel ('Value');
title('Truncated Impulse Response');
figure(3)
freqz(d,1,512,44100); % use freqz to plot magnitude and phase response
axis([0 2*10^4 -70 10]);
351
Truncated Impulse Response
0.4
Window 0.3
Method 0.2
Value
0.1
-0.1
0 20 40 60 80 100 120 140
Coefficient number
Magnitude (dB)
-20
-40
-60
-2000
-4000
-6000
0 0.5 1 1.5 2
Frequency (Hz) 4
x 10
2.352
Windows
2.354
Example: Kaiser Window Design of a Lowpass Filter
Specifications ωp = 0.4π, ωp = 0.6π, δ1 = 0.01, δ2 = 0.001
Window design methods assume δ1 = δ2 = 0.001
Determine cut-
cut-off frequency
Due to the symmetry we can choose it to be ωc = 0.5π
Compute
∆ω = ωs − ωp = 0.2π A = −20 log10 δ = 60
And Kaiser window parameters
α = 5.653 M = 37
Then the impulse response is given as
2
n − 18 . 5
I0 5.653 1 −
h[n] = sin[0.5π(n − 18.5)]
18 . 5
0≤n≤M
π(n − 18.5) I0 (5.653)
0 else
355
Approximation Error
356
Min-Max FIR filter design
Min-
Parks--McClellan algorithm
Parks
Remez exchange
jθ
D (e ) desired frequency response
jθ
H (e ) actual frequency response
357
L2 (RMS of yellow area) vs. Minmax metrics
D(θ )
H (θ ) θp
Minmax
θ
π
θS
358
Computer--Aided Design of Digital Filters
Computer
Objective - Determine iteratively the
coefficients of H(z), minimizing the
difference between D(e jθ ) and H (e jθ )
over closed subintervals of 0 ≤ θ ≤ π
This difference usually specified as a
weighted error function
E(θ ) = W (e jθ )[ H (e jθ ) − D(e jθ )]
where W (e jθ ) is user-
user-specified weighting
function. Regions with relatively higher
weighting values will result in smaller
relative error.
359
Weighting function
The higher (relative) weighing function will result in (relative) lower ripple
360
Computer-Aided Design of
Computer-
Digital Filters
Chebyshev or minimax criterion:
Minimizes the peak absolute value of the
weighted error: ε = max E(θ )
θ ∈Θ
363
Optimization problem
364
Alternation Theorem
Sufficient and Necessary condition to optimal solution.
The function
365
Equiripple example
1 + δ1
1 − δ1 K =7
δ2 ω
−δ2 0 ωp ωs π
δ2
0 ω
−δ2
ω p ωs
B1 K+2=9
B2
extremal points
366
Alternation Theorem
K+2 alternate extreme points:
Minimum (-δ), Maximum (+δ), Minimum (-δ), Maximum (+δ), etc.
367
Iterative approximation
1. Guess initial extreme point set
3. After solving for gk and δ, sample in θ the left-hand side of the equation and
approximate the extreme point. If the extreme points are close to the optimality
condition – stop. Otherwise
4. Update
and goto 2
368
Remez Exchange Algorithm
369
Equiripple FIR Digital Filter
Design Using MATLAB
Example - Design a linear-
linear-phase FIR
bandpass filter of order 26 with a
passband from 0.3 to 0.5, and
stopbands from 0 to 0.25 and from 0.55
to 1
The pertinent input data here are
N = 26
fpts = [0
[0 0.
0.25 0.
0.3 0.
0.5 0.
0.55 1]
1]
mag = [0[0 0 1 1 0 0]0]
wt = [1
[1 1 1 1]]
370
Computed gain response shown below
where Ap = 1 dB, As = 18.7 dB
-20
-40
-60
0 0.2 0.4 0.6 0.8 1
ω /π
371
We redesign the filter with order
increased to 110
Computed gain response shown below
where Ap = 0.024 dB, As = 51.2 dB
Note: Increase in N = 110, weight ratio = 1
order improves 0
Gain, dB
expense of increased -40
computational -60
complexity -80
0 0.2 0.4 0.6 0.8 1
372
ω /π
As can be improved at the expenses of a
larger Ap by decreasing the relative passbad
weight ratio W (θ ) N = 110, weight ratio = 1/10
Gain response of 0
bandpass filter of
-20
order 110 obtained
Gain, dB
with a weight vector -40
[1 0.0.1 1]
1] -60
-0.1
-0.2
0 0.2 0.4 0.6 0.8 1
ω /π
374
Absolute error in 2nd design is Absolute error in passband of
uniform 3rd design is 10 times the
error in the stopband
2 0.005
Absolute Error
0 0
-2 -0.005
-4 -0.01
0 0.2 0.4 0.6 0.8 1 0 0.2 0.4 0.6 0.8 1
ω /π ω /π
375
Estimating filter order N
Equi-ripple filter order can be estimated by
376
IIR Filter Design
Pros
low-order filters can have sharp frequency response
low-
low computational cost
Low phase delay
Cons
Design more difficult
Stability not trivial as FIR
Phase response not easily controlled
(e.g. no casual linear-
linear-phase IIR filters)
Feedback - coefficient sensitivity, quantization noise, etc. can
be a problem
377
IIR filters
Rational transfer function :
B ( z ) b0 z N + b1 z N −1 + ... + bN b0 + b1 z − 1 + ... + bN z − N
H ( z) = = N N −1
=
A( z ) z + a1 z + ... + a N 1 + a1 z −1 + ... + a N z − N
N poles (zeros of A(z)) , N zeros (zeros of B(z))
infinitely long impulse response
stable iff poles lie inside the unit circle
corresponds to difference equation
y[ k ] + a1 . y[ k − 1] + ... + a N . y[ k − N ] = b0 .u[ k ] + b1 .u[ k − 1] + ... + bN .u[ k − N ]
y[ k ] = b0 .u[ k ] + b1.u[ k − 1] + ... + bN .u[ k − N ]− a1. y[ k − 1] − ... − a N . y[ k − N ]
144444424444443 1444442444443
`MA ' ` AR '
`ARMA’ (autoregressive-
(autoregressive-moving average)
378
IIR Filter design
We shall study IIR design by conversion of
analog filters to digital filters
Steps
Design specs in the digital domain
Convert specs to analog domain
Design analog filter
Convert analog filter to digital filter
Verify design
379
Analog filter to digital filter
conversion
Impulse invariance
Step invariance
Bilinear transform
380
Popular analog filters
Butterworth All pole
No ripples
Maximally flat
Chebyshev I All pole
Pass band ripples
Sharper than Butterworth
Chebyshev II Both poles and zeros
Stop band ripples
Sharper than Butterworth
Elliptic Both poles and zeros
Both pass and stop band ripple
Sharper than Chebyshev
Bessel All pole
No ripples
Close to linear phase
381
Analog Filter frequency response
383
Butterworth Filters
The amplitude |H(j
|H(jωω)| of an nth order Butterworth filter is
given by
Observations:
|H(j0)| is unity
The DC gain |H(j
384
Normalized Butterworth Filters
We prefer to work with a normalized filter whose cutoff
frequency is 1 rad /sec (ω
(ωc =1), i.e.
385
Normalized Butterworth Filters
386
Normalized Butterworth Filters
387
Stop band Low-
Low-Pass Butterworth
Filter Attenuation
388
Poles location
Butterworth transfer function
Define h(s)
h(s) has 2n poles, evenly spaced on the unit circle (Note: Analog filter – unit
circle has nothing to do with stability)
389
n - even
k=0,1,..,2n-1
n - odd
Pk=n=-1 for odd n
390
n=1
n=1 Butterworth Filters
A first order continuous time filter frequency response
is given by
1
H (ω ) = a>0
jω + a
jω complex plane
ROC
pole
x
-a σ
391
n=2
n=2 2± j 2
1
0.8
X
0.6
0.4
0.2
-0.2
-0.4
-0.6
X
-0.8
-1
-1 -0.8 -0.6 -0.4 -0.2 0 0.2 0.4 0.6 0.8 1
392
n=3
n=3
h(s)=
393
n=3
H(s) only uses the n poles in the left half plane for
stability.
394
Butterworth Filter
|H(s)| for n=4
n=4
396
Selection of filter order
Select ωc and n to comply with specs.
397
Pass band
Stop band
Solution
where
399
Normalized Butterworth poles
400
Chebyshev polynomials
Define Nth order Chebyshev polynomial
Continuous
function
Example
403
404
405
Chebyshev type I (Pass band ripple)
ε- parameter
Large ε results in larger
ripples and faster roll off
Pass-band properties
406
407
20N
dB/Decade
408
Poles layout (ellipse)
409
Chebyshev type II (stop band ripple)
Note:
Frequency
axis reversed
410
411
Elliptic filter (Pass and stop band ripple)
412
4th order elliptic filter
413
Bessel filters (linear phase approximation)
θ N (0 )
H N (s ) =
θ N (s ω0 )
θ N (s ) = ∑
N
(2 N − n )! s n
N −n
n =0 2 ⋅ n!⋅( N − n)!
Pole layout
414
Actual 3rd order Bessel low pass 415
Analog Filter transforms
So far we studied normalized low pass
filters with ωc=1
We shall refer to a normalized low pass
filter as the prototype filter
In order to design non-
non-normalized LPF or
other types (HPF,BPF, etc.) we use filter
transforms
416
s
s←
ω0
ω0
s←
s
s + (ω H − ω L )
s← 2
s + ωH ωL
LP LP
419
Example – Design a 5th order elliptic 1KHz
high--pass 1dB,-
high dB,-60dB
60dB filter with Matlab
>> [b,a] = ellip(5,1,60,1000,'high','s');
>> [h w]=freqs(b,a,1000);
>> semilogx(w,20*log10(abs(h))),grid,xlabel('Freq (Hz)'),ylabel('Gain (dB)')
-10
-20
-30
-40
Gain (dB)
-50
-60
-70
-80
-90
-100
2 3 4
10 10 10
Freq (Hz)
420
IIR Filter design
Analog domain Digital domain
Specifications
Specifications
Specifications
Design
Analog
Filter
Digital Filter
421
Analog filter to Digital
transforms
Given a RCSR analog filter
We would like to transform the
analog filter to a “similar” digital filter
Digital filter requirements:
Similar frequency-
frequency-gain properties
RCSR
Same order
422
Impulse invariance
Continuous time (CT) and discrete time
(DT) LTI systems are characterized by
their impulse response
Filter response is the convolution between
the impulse response and the input signal
Idea – Given a CT filter with impulse
response h(t), use a DT filter with impuse
response h(nT
h(nT))
mapping: HL(s) -> H(z)
423
Impulse invariance
The digital filter unit sample response is sampling of the
analog filter impulse response
In short
424
T is needed for similar DC gain
2.425
Example – single pole LP
426
The stable analog pole at -α
Was transformed to a stable
digital pole at
(note 2π period)
jω Im(z)
3π/Τ
aliasing
π/Τ
-α
x σ x Re(z)
−π/Τ
428
In general using fraction decomposition and the
previous example
429
ha (t ) → h(n ) = Tha (nT )
1 ∞
θ − 2πk
H a (ω ) → ⋅ T ∑ H a
T k = −∞ T
430
Impulse invariance may only be
used for narrow band LPF
H L (ω )
“Negligible”
aliasing
ωp ωs ~ 10 ⋅ ω s
431
Design example (Butterworth)
ω p = 500 Hz
ω s = 2750 Hz
Fs = 50 KHz
δ p = δ s = 0.01
θ p = 0.02π
θ s = 0.11π
δ p = δ s = 0.01
432
Design a LPF using Butterworth analog filter and impulse
invariance method
ωp
T θp
Selectivity k = = = 0.1818
ωs T θ s
Discrimination d =
(1 − δ ) p
−2
−1
=
2.03040506 ⋅10 − 2
= 1.426 ⋅10 −3
δ −2
s −1 9999
− log d 2.846
n≥ = = 3.85 → 4
− log k 0.74
1 rad
H L (ω p ) = 8
≥ 1 − δ p = 0.99 ⇒ 5113 [813Hz ]
2π 500 sec
1 +
ωc
433
1
Prototype : H(s) =
s 4 + 2.6131s 3 + 3.4142 s 2 + 2.6131s + 1
s
s←
5113
1
H(s) =
1.4632 ⋅10 −15 s 4 + 1.9549 ⋅10 −11 s 3 + 1.306 ⋅10 −7 s 2 + 5.1107 ⋅10 −4 s + 1
5000
x
4000
3000
2000
x
1000
-1000
-2000 x
-3000
-4000
-5000
x
-5000 -4000 -3000 -2000 -1000 0 1000 2000 3000 4000 5000
434
Partial fractions
4724 − 1957 j 4724 + 1957 j
H L(s) = 0.8535(1 − j ) + 0.8535(1 + j )
s − (− 4724 + 1957 j ) s − (− 4724 − 1957 j )
1957 − 4724 j 1957 + 4724 j
+ 0.3535(− 1 − j ) + 0.3535(− 1 + j )
s − (− 1957 + 4724 j ) s − (− 1957 − 4724 j )
α αT
⇒ T = 2 ⋅ 10 −5
s − (− α ) 1 − e −αT ⋅ z −1
806.4 − 334.1 j 806.4 + 334.1 j
(1 − j ) (1 + j )
H(z) = 100 + 100
− 9.448 + 3.914 j −1 − 9.448 − 3.914 j −1
1 − exp ⋅ z 1 − exp ⋅ z
100 100
(− 1 − j )138.4 − 334 j (− 1 + j )138.4 + 334 j
+ 100 + 100
− 3.914 + 9.448 j −1 − 3.914 − 9.448 j −1
1 − exp ⋅ z 1 − exp ⋅ z
100 100
435
1 − 2 + 7.657 ⋅ z −1 + 0.475 ⋅ z −2 + 3.437 ⋅ z −3
H (z ) = ⋅
1000 1 − 3.733 ⋅ z −1 + 5.234 ⋅ z − 2 − 3.2664 ⋅ z −3 + 0.7655 ⋅ z − 4
0.8
0.6
0.4
0.2
-0.2
-0.4
-0.6
-0.8
-1
-1 -0.5 0 0.5 1
436
0
-20
-40
|H| (dB)
-60
-80
-100
-120
0 0.5 1 1.5 2 2.5
f (Hz) 4
x 10
θs = π
-10
-20
|H| (dB)
-30
-40
-50
-60
2750Hz
<-40dB
θ s = 0.11π
438
0.05
-0.05
|H| (dB)
-0.1
-0.15
-0.2
0 100 200 300 400 500
f (Hz)
500Hz
>-0.09dB (δs=0.01)
θ s = 0.02π
439
Step invariance
Given an analog filter with a known step response,
build a digital filter whose step response is a sampled
version the analog filter
Analog filter
Step response
Sample of step
response 440
Step invariance
Z domain step response
δ (n ) = u (n ) − u (n − 1)
Using ( )
H (z ) = 1 − z −1 R(z )
where R( z ) is the step respose
−1 H a (s )
Z domain unit (
H (z ) = 1 − z −1
)
Z L
sample response s t = kT
441
Step invariance example
as
H (s ) = High pass
s+a
−1 H (s ) a
L =L −1
= ae u (t )
− at
s s+a
H (z ) =
aT 1 − z (−1
)
− aT −1
1− e z
Pole transform similar to impulse invariance
442
101
H (s) = 2
L
s + 2 s + 101
101
H ( z ) = (1 − z ) Z 2
−1
s ( s + 2 s + 101)
z −1 1 s +1 1
= Z − −
z s ( s + 1) 2
+ 100 ( s + 1) 2
+ 100
z −1 z z 2 − ze −T cos10T ze −T sin 10T
= − 2 −
z z − 1 z − 2 ze cos10T + e
−T − 2T
10( z 2 − 2 ze −T cos10T + e − 2T )
Continuous π
T=
5
443
Bilinear transform
444
Integral approximation
445
Trapezoidal approximation
446
Difference equation
447
Transformation formula
“continuous time” “discrete time”
integrator integrator
Bilinear transform
448
Single pole filters
449
Bilinear transform
A single analog stable pole is transformed to
a single digital stable pole
451
Mapping of s-plane into the z-
plane
452
Bilinear Transformation
Mapping of s-plane into the z-plane.
Analog stable poles are converted to digital
stable poles
453
Bilinear Transformation
454
Frequency transform (analog
imaginary line to digital unit circle)
Since
455
Frequency transform (analog
imaginary line to digital unit circle)
456
Frequency warp
457
Bilinear Transformation
Mapping is nonlinear
Complete negative imaginary axis in the
s-plane from ω = −∞ to 0 is mapped
into the lower half of the unit circle in the
z-plane from z = −1 to z = 1
Complete positive imaginary axis in the
s-plane from ω = 0 to ω = ∞ is mapped
into the upper half of the unit circle in the
z-plane from z = 1 to z = −1
458
Bilinear transform
Transformation can be used only to design
digital filters with prescribed magnitude
response with piecewise constant values
Transformation does not preserve phase
response of analog filter
2.459
Frequency warp
460
Pre warp
IIR Filter specifications are given in the digital domain.
When analog filter is transformed to digital filter using
bilinear transform frequency warping takes place
To compensate, frequencies in spec. are Pre-Warp
before translated to analog domain.
Desired cut-off
θC frequency
θC 462
Step 2: Pre
Pre--Warp Frequencies
Warp specified H(ω )
frequencies using
2 θc
ω C = tan
T 2
Warped cut-off
ωc frequency
ωc
463
Step 3: Design Analogue Filter
Design analog filter H A (ω )
Analogue filter Analogue
design produces filter response
HA(s)
ωc
464
Step 4: Apply Bilinear
Transform
Transform H(θ )
H (s ) H( z ) Digital filter
response
Means replace s by
Result
Transfer function, H(z)
for digital filter ωc
465
Example
Design a discrete filter, with specifications
Butterworth filter
-3dB cut-
cut-off at 2kHz
Attenuation of at least 10dB
10dB at 4kHz
Sampling frequency 20kHz
20kHz
466
Digital frequencies
Cut--off frequency -3dB
Cut
ωc 2πf c 2π × 2000
θc = = = = 0.2π
fs fs 20,000
Roll--off frequency -10dB
Roll 10dB
ωr 2πf r 2π × 4000
θr = = = = 0.4π
fs fs 20,000
467
Conversion to digital
Pre-warp frequencies
Pre-
Use bilinear transform
Pre
Pre--warp cut
cut--off frequency T=2
T=2
' θc 0.2π
ωc = tan = tan = 0.325
2 2
468
Pre
Pre--warp roll
roll--off frequency
' θr 0.4π
ωr = tan = tan = 0.726
2 2
1
H c ( BW ) ( s ) = 2
s + 2s + 1
470
Replace s by s
0.325
1
H c ( BW ) (s ) = prototype
s 2 + 2s + 1
1
H c (s ) =
1 s2 2
+ 0.325 s +1
0.3252
471
Actual pre-warped analogue filter is
pre-
2
0.325
H c (s) =
2 2 ×0.325 2 2
s + 0.325
s + 0.325
0.106
H c (s) = 2
s + 0.46 s + 0.106
472
Use bilinear transform z −1
s=
z +1
Filter becomes
0.106
H( z ) =
z −1 2
( ) + 0.46( zz +−11 ) + 0.106
z +1
2
0.068( z +1)
Hd ( z) = 2
z −1.142z + 0.413
473
=-3dB <-10dB
0
-10
-20
-30
|H| (dB)
-40
-50
-60
-70
-80
0 1000 2000 3000 4000 5000 6000 7000 8000 9000 10000
f (Hz)
474
Digital Filter Structures
The causal IIR digital filters are
characterized by a real rational transfer
function of z −1 or, equivalently by a
constant coefficient difference equation
From the difference equation
representation, it can be seen that the
realization of the causal IIR digital filters
requires some form of feedback
475
Direct Form IIR Digital Filter
Structures
476
Direct Form IIR
478
Canonical form
479
Canonic Form IIR
Max(p,q) delays
p+q+1 multipliers
(p+q+1)*Fs multiplication/second
480
Multi--rate Digital Signal
Multi
Processing
481
Example: TV program conversion
Europe (ex. France)
Temporal and
National Television System spatial Phase Alternating Line
Committee sampling rate 25 frames/second
30 frames/second conversion 625 lines per frame
525 lines per frame QAM Color modulated to
QAM Color modulated to 4.43MHz
3.58MHz
Color
US/Japan
information
sampling rate
conversion
Analog
Voice LPF 8Ksps
~3.5KHz 0.99 @3.5KHz A/D
bandwidth 0.01@4Khz
~ Order 45 Butterworth
Analog filter. Not
practical
0
-10
-20
Ha(w)|
-30
-40
-50
Analog 3.5KHz
Voice
LPF 800Ksps LPF
~3.5KHz
0.99 @3.5KHz A/D Linear 100
bandwidth
0.01@400Khz Phase FIR
-10
-20
Narrowband
-30
digital signal
-40
Ha(w)|
-50
-60
-70
Note:
-80
Decimation
enhances signal
-90
0 1 2 3 4 5
Hz
6 7 8 9 10
5
resolution
x 10 484
Analog Devices’
AD1870
64X Oversampling
485
Example: Reconstruction– Conventional approach
Analog
Digital voice 8Ksps LPF
~3.5KHz ZOH 0.99 @3.5KHz
bandwidth 0.01@4Khz
~ Order 45 Butterworth
Analog filter. Not
practical
486
Example: Reconstruction– Up sampling
Digital Analog
x100
voice 800Ksps LPF
~3.5KHz
Digital
ZOH 0.99 @3.5KHz
bandwidth Interpolation 0.01@400KHz
487
Time domain
1 1
0.8 0.8
0.6 0.6
0.4 0.4
0.2 0.2
0 0
0 0.5 1 1.5 2 2.5 3 3.5 4 4.5 5 0 0.5 1 1.5 2 2.5 3 3.5 4 4.5 5
488
Analog Devices’
AD1853
8X Oversampling
489
Now we know what that means…
490
Multirate Digital Signal
Processing
Basic Sampling Rate Alteration Devices
Interpolator (Up-
(Up-sampler) - Used to
increase the sampling rate by an integer
factor
Decimator (Down-
(Down-sampler) - Used to
decrease the sampling rate by an
integer factor
491
Up--sampling
Up
492
Shannon Reconstruction
mT
− nT
T ∞
xu [m] = xa m = ∑ x[n]sinc L =
L n=−∞ T
∞
m − nL
= ∑ x[n]sinc
n=−∞ L
493
Defin x[l L] l mod L = 0 l = Ln
e y[l ] =
0 otherwise
∞
m−l
xu [m] = ∑ y[l ]sinc
l =−∞ L
494
y[m]
x[n] L LPF xu[m]
Fs L Fs [-π/L , +π/L] L Fs
495
Up--Sampler
Up
Up
Up--sampling operation is implemented by
inserting L-L-1 zero
zero--valued samples
between two consecutive samples of x[n]
Linear and time dependant
x[m /L], m = 0, ± L, ± 2 L, L
x[n] L y[m] =
0, otherwise
496
Up--Sampler
Up
Interms of the z-transform, the input-
input-
output relation is then given by
∞ ∞
Y ( z) = ∑ y[m] z
m = −∞
−m
= ∑ x[m / L] z
m = −∞
−m
=
m mod L = 0
n=m L
∞
= ∑ x[n] z − nL
( )
=X z L
n = −∞
497
Up--Sampler
Up
( )
Y ( z) = X z L
Frequency domain is scaled by
ratio L
Y (e ) = X (e )
jθ jθL
L=2
( )
Xe jθ
− 2π 2π
( )
Ye jθ
− 2π −π π 2π
498
Up--Sampler
Up
499
Interpolation filter
500
Filter
A practical LPF may be either FIR or IIR
FIR Linear phase is often an advantage
Special computation savings when using
dual form FIR
501
Dual form FIR
x[n]
L
b2 b1 b0
Note: Each multiplier is periodically fed with L-1 zeros and 1 non–zero input.
L = L
502
Dual form FIR
x[n]
b2 b1 b0
L L L
503
Interpolation filter
Digital Analog
x100
voice 800Ksps LPF
~3.5KHz
Digital
ZOH 0.99 @3.5KHz
bandwidth Interpolation 0.01@4Khz
Simple 2 pole
Butterworth Analog filter
100 LPF
[-π/100,
π/100]
505
LPF 3.5 / 400 π
[-π/100,
π/100]
~
~
π/100 = π
4 / 400 π
Filter is designed
Exampleδ p = δ s = 0.01 using Remezfilter at high sampling
rate but
D∞ (δ p , δ s ) 1.9 multipliers work
N≈ = = 3040 at low sampling
∆f F 500 800,000
rate.
6 multiplications
1/ 2 ⋅ F ⋅ N = 8000⋅ 3040 = 24⋅10
second
x[n] M y[n]
x[ n ] = xa ( nT ) M y[ n ] = xa ( nMT )
508
Frequency-Domain Characterization
Frequency-
Applying the z-transform to the input
input--output
relation of a factor-
factor-of-
of-M down
down--sampler
we get
y[n] = x[Mn]
∞
−n
Y ( z) = ∑ x[ Mn ] z
n = −∞
509
Define a new sequence
xint [n] :
x[n], n = 0, ± M , ± 2 M ,K
xint [n] =
0, otherwise
M M
∞ ∞
−n −n
Y ( z) = ∑ x[ Mn ] z = ∑ int
x [ Mn ] z
n = −∞ n = −∞
∞
−k / M 1/ M
= ∑ xint [k ] z = X int ( z )
k = −∞ 510
xint [n] can be formally related to x[n]
through xint [n] = c[n] ⋅ x[n]
1, n = 0, ± M , ± 2 M ,K
where c[n] =
0, otherwise
511
Takingthe z-transform ofxint [n] = c[n] ⋅ x[n]
and making use of
1 M −1
c[n] = ∑ WMkn
M k =0
∞
−n 1 ∞ M −1
kn −n
X int ( z ) = ∑ c[n]x[n] z =
∑ ∑ WM x[n] z
n = −∞ M n = −∞ k =0
1 M −1 ∞ M −1
= ∑
∑ x
M k =0 n =−∞
[ n ]WM
kn − n
z
=
1
∑ (
X z WM)
−k
M k =0
512
For k=0 – Base spectrum
0<k<M - Aliasing
1
M −1 1
Y (z ) = X int z( ) 1M
= ∑ X WM ⋅ z M
M k =0
−k
1 M −1 −k j Mθ
Ye( )jθ
= ∑ X WM ⋅ e =
M k =0
1 (θ −2πk )
M −1
j
= ∑ X e M
M k =0
513
Example M=2
− 2π −π π 2π
K=0
− 4π − 2π 2π 4π
K=1
− 4π − 2π 2π 4π
Total
aliasin
g
− 4π − 2π 2π 4π
Decimation
The Nyquist frequency after decimation is
1/M the original Nyquist frequency
aliasing
In order to prevent aliasing signal should
be band limited to -π/M, +π
+π/M before
decimation
515
Decimation filter
516
Example - Oversampling
Analog 3.5KHz
Voice
LPF 800Ksps LPF
~3.5KHz
0.99 @3.5KHz A/D Linear 100
bandwidth
0.01@400Khz Phase FIR
LPF 100
[-π/100,
π/100]
We already
designed this one
today
517
Direct implementation
520
Filters for Fractional Sampling
Rate Alteration
L H u (z) H d (z) M
521
Filters for Fractional Sampling
Rate Alteration
Hence, the desired configuration for the
fractional sampling rate alteration is as
indicated below where the lowpass filter
H(z) has a stopband edge frequency
given by
π π
θ s = min ,
L M
L H (z) M
522
Decimation system we designed few slides ago
LPF
[-π/100, π/100]
100
3.5 / 400 π 800Ksp
s 8Ksps
~
~
4 / 400 π π
LPF 1 50 LPF 2 2
M=100=2*50=50*2=4*25=25*4=2*5*10=5*2*5*2=…..
Optimal selection of Mi may be found by trial-and-error or
by graphs found in
R. E. Crochiere & L. R. Rabiner, Multirate Digital Signal
Processing, Prentice- Hall, 1983
524
Filters in series H1(z)H2(z)
θp1
1±δp
1
δs1
θs1
1±δp θp2
2
δs2
π
θs2
Transition
Pass
band Stop band
δ s1 = δ s2 = … = δ s
526
Equi-ripple filter order can be estimated
by
527
Example M=100
M=100,K=
,K=22, δs =δp=0.01
Fp=
Fp=3.5KHz Fs=4
Fs=4KHz Second filter
16Ksps 8Ksps
3.5KHz LPF 2 2
δp=0.005
δs=0.01
Note: second
7π/16 π/2=π/Μ2 π
filter removes
4KHz 8KHz
frequencies
between 4KHz
Exampleδ p = δ s = 0.01 K = 2 and 8KHz
D∞ (δ p / 2, δ s ) 2.15
N≈ = = 69
∆f F 500 16,000
1 3 multiplications
1/ 2 ⋅ F ⋅ N = 8000⋅ 69 = 276⋅10
2 second
528
Example M=100
M=100,K=
,K=2
2, δs =δp=0.01
Fp=
Fp=3.5KHz Fs=
Fs=44KHz First filter no aliasing
800Ksps 16Ksps
δp=0.005 50
LPF 1
δs=0.01
3.5KHz
Motivation –
Wider transition Filter replica after
band – shorter 8KHz decimation
filter 4KHz
~
~
Will be removed 16KHz π
by second filter
400Ksps
Post decimation
sampling rate
θp=3.5/400π
θs=8/400π=π/50=π/Μ1
529
Example M=100
M=100,K=
,K=2
2, δs =δp=0.01
Fp=
Fp =3.5KHz Fs=
Fs=4
4KHz First filter controlled aliasing
800Ksps 16Ksps
δp=0.005 50
LPF 1
δs=0.01
3.5KHz
Motivation –
Wider transition 8KHz Filter replica after
band – shorter decimation
filter
~
~
4KHz 12KHz
Will be removed by
16KHz π
second filter 400Ksps
Post decimation
sampling rate
θp=3.5/400π
θs=12/400π
530
Exampleδ p = δ s = 0.01 K = 2
D∞ (δ p / 2, δ s ) 2.15
N≈ = = 202
∆f F (12 − 3.5) 800
1 6 multiplications
1/ 2 ⋅ F ⋅ N = 16000⋅ 202 = 1.6 ⋅10
2 second
Total of 2M Multiplications/second
Compared with original 12M !
531
Interpolation system
532
8Ksps 2 LPF 2 16Ksps
7π/16
3.5KHz
@Fs=16Ksps
Replica being
Original removed by
spectrum filter
π/2 π 2π
4KHz 8KHz 16KHz
2π
533
16KHz
16Ksps 50 LPF 1 800Ksp
s
3.5KHz
@Fs=800Ksp
Replica being s
removed by
filter
~
~
4KHz 12KHz 16π/400 π
16KHz 400Ksp
s
~
~
3.5KHz π
400Ksp
534
s
Example
Narrowband filters – Legacy approach
800Ksps LPF
800Ksps
[-π/100, π/100]
535
Narrowband filters – multi rate
800Ksps
approach
LPF 1 50 LPF 2 2
536
Multi--rate identities
Multi
X(z) L X(zL)
537
Identities
L H(zL)
x (n ) y (m)
H(z) L
x (n ) y (m)
M H(z)
x (n ) z (l )
H(zM) M
x (n ) z (l )
538
Polyphase representation of FIR filter
unit sample response
M=3
1
0.8
0.6
0.4
0.2
-0.2
-0.4
-0.6
0 2 4 6 8 10 12 14 16
539
Polyphase representation of FIR filter
unit sample response
M=3
1
-1
0 2 4 6 8 10 12 14 16 18
1
-1
0 2 4 6 8 10 12 14 16 18
1
-1
0 2 4 6 8 10 12 14 16 18
540
H (z ) = h0 + h1z −1 + h2 z −2 + ... + hN z − N =
= [h0 + hM z −M + h2M z −2M + ...]+
+ [h1z −1 + hM +1z −( M +1) + h2M +1z −(2M +1) + ...]+
..... + ...]+
+ [hM −1z −( M −1) + h2M −1z −(2M −1) + h3M −1z −(3M −1) + ...] =
( ) ( )
= H0 z M + z −1H1 z M + .. + z −( M −1) H M −1 z M ( )
541
Polyphase decimation filter
( ) ( ) ( )
H (z ) = H0 z M + z −1H1 z M + .. + z −(M −1) H M −1 z M
x(n) H0(zM)
z-1
H1(zM) + M y(m)
z-1
H2(zM)
…
z-1
HM-1(zM)
542
Using an identity
Active only for n=…-M,0,M,2M,..
z-1
M H1(z) + y(m)
z-1
M… H2(z)
z-1
M Active only for n=…-
HM-1(z) M+2,2,M+2,2M+2,..
n=…-M,0,M,2M,.. n=…-M+1,1,M+1,2M+1,..
x(n) H0(z)
H1(z) + y(m)
n=…-M+2,2,M+2,2M+2,..
n=…-1,M-1,2M-1,3M-1,.. H2(z)
…
HM-1(z)
544
Polyphase interpolation filter
( ) ( ) ( )
H (z ) = H0 z L + z −1H1 z L + .. + z −( L−1) H L−1 z L
x(n) y(m)
L H0(zL) +
z-1
H1(zL) +
z-1
H2(zL) +
…
z-1
HL-1(zL)
545
Polyphase interpolation filter
x(n) y(m)
H0(z) L +
z-1
H1(z) L + Nonzero for m mod L=1
z-1
H2(z) L + Nonzero for m mod L=2
…
z-1
HL-1(z) L Nonzero for m mod L=L-1
546
Polyphase interpolation filter
( ) ( ) ( )
H (z ) = H0 z L + z −1H1 z L + .. + z −( L−1) H L−1 z L
m mod L=0
x(n) y(m)
H0(z)
H1(z)
H2(z)
…
HM-1(z)
547
Introduction to Digital Signal
processing - conclusion
-Preliminaries
-Fourier analysis
-s and z domain analysis
-Analog filter design (wannabe)
-Signal and systems
548
Introduction to Digital Signal
processing - topics
Signaland system revisited
Poisson formulas
Sampling, Nyquist
Nyquist,, Shannon
DFT
FFT
Cyclic convolution
Spectral analysis
549
Introduction to Digital Signal
processing - topics
Filters
Continuous phase
Linear phase
Minimum phase
All pass
Implementations – direct and canonic
FIR
Types
IRT with and without windows
Equi--ripple
Equi
550
Introduction to Digital Signal
processing - topics
IIR
Analog filter:
• Butterworth
• Chebyshev
Chebyshev,, Elliptic, Bessel – Introduction only
Transformation
• Impulse and step invariance
• Bilinear
Multi--rate
Multi
Decimation
Interpolation
Rate change
Polyphase
Multistage
551
What’s next ?
Project at the SIPL – המעבדה לעיבוד אותות דיבור ותמונה
Radom signals – אותות אקראיים
Models of random signals and processes
System manipulation of random signals
Noise sources
Signal Processing – עיבוד אותות
Quantization and finite word length
Fixed point and floating point DSP
Spectrum analysis, periodograms
Filter banks, QMF filters
Short time Fourier transform
Wavelet transform
552
Image processing and analysis – ענ"ת
Human vision
2D signal processing
Image enhancement
Image coding
Digital coding – קידוד אותות
Scalar and vector quantization
Entropy coding
Waveform coding
Frequency domain coding
Linear Prediction
LPC based speech coders
553
Discrete time random signal processing – עיבוד
אותות אקראיים בזמן בדיד
Hilbert space representation of ransom signals
Parametric models
Theoretic bounds
Adaptive signal processing – עיבוד אותות מסתגל
Adaptive algorithms – LMS RLS
Adaptive filtering
Linear estimation in dynamic systems -
שיערוך לינארי במערכות דינמיות
Wiener filter
Kalman filter
Hidden Markov models 554