Advanced Filter Design
Advanced Filter Design
Reference manual
Reference Manual
Chapter 1
Linear phase FIR filters can be designed by minimizing the weighted least squared error between a desired
amplitude function, and the actual amplitude function for the filter. The resulting filter is denoted h, with
the amplitude function A(ω). The vector Ad denotes the desired amplitude values for the frequencies
ωk ; k = 0, 1, . . . , L − 1, stacked in into a vector according to
Type 1 Type 2
1 2 cos(1/2ω)
2 cos(ω) 2 cos(3/2ω)
φ(ω) = .. φ(ω) = ..
. .
2 cos(ωM ) 2 cos(M ω)
Type 3 Type 4
2 sin(ω) 2 sin(1/2ω)
2 sin(2ω) 2 sin(3/2ω)
φ(ω) = .. φ(ω) = ..
. .
2 sin(M ω) 2 sin(M ω)
Type 1 Type 2
h(M ) h(N/2 − 1)
h(M − 1) h(N/2 − 2)
a0 = .. a0 = ..
. .
h(0) h(0)
Type 3 Type 4
h(M ) h(N/2 − 1)
h(M − 1) h(N/2 − 2)
a0 = .. a0 = ..
. .
h(0) h(0)
g= (1.3)
[0.5, 1, 0.5, 0, −1, −3.5, −8.5, −11, −12, −14, −18,
−19.5, −22, −24, −28, −29, −30] dB
for the frequencies fk = 100 · (1.2589)k+3 Hz, k = 0, . . . , 16. The desired amplitude function is calcu-
lated according to
gk
Ad (ωk ) = 10 20 (1.4)
where gk denotes the k th element in g.
In the design a uniform weighting vector is used, and the amplitude and frequency vector is interpolated
from the 17 point exponential scale given above to a linear scale with 388 points. The implementation for
the interpolation is found in file l1.m.
The desired amplitude function and the amplitude function for h is presented in figure 1.1. See file
l1a.c for implementation.
The result from the filter design is presented in figure 1.2. The figure shows that the resulting filter has
better performance in the interval where the weighting is high. See file l1b.c for implementation.
Reference Manual
1.3 Differentiator approximation 5
10
1 Ad (ωk )
A(ωk )
A(ω)
0.1
0.01 π π 3π
0 4 2 4
π
ω
Reference Manual
1.4 Hilbert filter approximation 6
10
1 Ad (ωk )
A(ωk )
A(ω)
0.1
0.01 π π 3π π
0 4 2 4
ω
0.8
0.6
A(ω)
0.4
0.2 Ad (ωk )
A(ωk )
0 π π 3π
0 4 2 4
π
ω
Reference Manual
1.4 Hilbert filter approximation 7
1.4
Ad (ωk )
1.2 A(ωk )
0.8
A(ω)
0.6
0.4
0.2
0 π π 3π
0 4 2 4
π
ω
Reference Manual
Chapter 2
Non linear FIR filters can be designed using least squared (LS) complex approximation. The resulting
filter h minimises the weighted least squares error between its frequency response and a desired frequency
response Hd according to
L−1 N −1 2
X X
v(ωk ) Hd (ωk ) − hn e −jnωk
. (2.1)
k=0 n=0
The vector v is a positive weight vector, that determines the design accuracy for each discrete frequency
point ωk in the interval [0, π], for k = 0, 1, . . . , L − 1.
The solution for the LS design problem can be formulated using vector notation as
where W is a diagonal matrix with diagonal elements [v(ω0 )2 , . . . , v(ωL−1 )2 ]. The vector Φ is a vector of
base functions defined according to
1.5
−0.5
0.00 5.00 10.00 15.00 20.00
n
The resulting impulse response is presented in figure 2.5 along with the impulse response for a filter linear
filter with N = 11 designed using linear LS design. The figure shows hat the non linear filter should have
the same delay as linear filter.
The frequency response for the two filters is presented in dB scale in figure 2.5. The figure shows that
the 21 tap filter has better performance than the 11 tap filter.
Reference Manual
2.5 Low-pass FIR filter with short group-delay 10
10
|H(ω)|
0.1 τ = 9.6
τ = 10.1
0.01 π π 3π
0 4 2 4
π
ω
The group delay presented in figure 2.5 shows that the two filter has the same group-delay in the
passband. The group delay is however varying for the non linear filter. The implementation is found in file
l2e.c.
Reference Manual
2.5 Low-pass FIR filter with short group-delay 11
30
25
20 τ = 9.6
τ = 10.1
− dΘ
dω
k
15
10
0 π π 3π π
0 4 2 4
ω
0.4
τ = 5.0
τ = 5.5
0.2
h[n] 0
−0.2
−0.4
Reference Manual
2.5 Low-pass FIR filter with short group-delay 12
0.8
0.6
|H(ω)| τ = 5.0
τ = 5.5
0.4
0.2
0 π π 3π π
0 4 2 4
ω
30
20 τ = 5.0
τ = 5.5
10
− dΘ
dω
k
0
−10
−20
−30 π π 3π
0 4 2 4
π
ω
Reference Manual
2.5 Low-pass FIR filter with short group-delay 13
0.4
Non linear
Linear
0.2
h[n] 0
−0.2
−0.4
−30
|H(ω)|
−40
−50
−60
−70 π π 3π
0 4 2 4
π
ω
Reference Manual
2.5 Low-pass FIR filter with short group-delay 14
12
10
Non linear
8 Linear
− dΘ
dω
k
6
0 π π π
3π
0 8 4 8 2
ω
Reference Manual
Chapter 3
Linear phase FIR filters can be designed using weighted minimax-design frequency-domain design. The
resulting filter h minimises the weighted maximum absolute error δ between its amplitude vector A and a
desired amplitude vector Ad . The amplitude vector is defined as A = aT Φ, where a and Φ are defined as
in chapter 1. The weights are defined in the vector v. The design problem is formulated as
The filter design can be performed using linear programming. A linear program description is given by
v0 φT (ω0 )
−1 v0 Ad (ω0 )
v1 φT (ω1 )
−1 v1 Ad (ω1 ) (3.3)
.. .. ..
. . .
vL−1 φT (ωL−1 ) −1
vL−1 Ad (ωL−1 )
B=
−v0 φT (ω0 )
b=
−1
−v0 Ad (ω0 )
−v1 φT (ω1 ) −1 −v1 Ad (ω1 )
.. .. ..
. . .
−vL−1 φT (ωL−1 ) −1 −vL−1 Ad (ωL−1 )
The design routine is for this type of filters called fd_minimax() and is implemented in firminimax.c.
The implementation of is made using the software package lp-solve. The internal function used by
lp-solve is simplex.
3.1 Low-pass filter design using linear programming 16
The implementation is found in the file l3a.c. The amplitude function for the resulting filter is presented
in figure 3.1, along with the amplitude function for a filter designed using the least squares method from
chapter 1. The figure shows that the least squares design gives higher stop-band attenuation for this specific
problem, and can therefore be regarded as somewhat better. The maximum norm for the least squares and
the minimax solutions are 0.195 and 0.088 respectively, which confirms that the least squares design is
superior.
1 Least squares
Minimax
0.1
0.01
A(ω)
0.001
0.0001
1e − 05 π π 3π
0 4 2 4
π
ω
The implementation is found in the file l3b.c. The amplitude function for the resulting filter is presented
in figure 3.2, along with the amplitude function for a filter designed using the least squares approach from
chapter 1. The figure shows that the least squares design gives higher stop-band attenuation for this specific
problem, and can therefore be regarded as somewhat better. The maximum norm for the least-squares and
the minimax solutions are 0.195 and 0.088 respectively, which confirms that the least squares design is
superior.
Reference Manual
3.3 Low-pass filter design using linear programming 17
0.01
A(ω)
0.001
0.0001
1e − 05 π π 3π
0 4 2 4
π
ω
The given specification is accomplished when the stop-band cutoff frequency is ω s = 0.67π and the
weights vector is given by
1.0 for 0 ≤ ω < 0.4π
v(ω) = . (3.6)
10000.0 for ωs ≤ ω ≤ π
The implementation is found in the file l3c.c. The amplitude function for the resulting filter is presented
in figure 3.3. The upper plot shows the amplitude function of the passband section in linear scale. The
lower plot shows the whole amplitude function plotted in log scale.
Reference Manual
3.3 Low-pass filter design using linear programming 18
1.2
1.15
1.1
1.05
A(ω) 1
0.95
0.9
0.85
0.8 π π
0 4 2
ω
0.1
0.01
A(ω) 0.001
0.0001
1e − 05
1e − 06 π π 3π
0 4 2 4
π
ω
Reference Manual
Chapter 4
Linear phase FIR filters can be designed using the Remes exchange algorithm. This chapter uses Remes
exchange algorithm to solve various filter design problems. The sections below shows the steps in the
execution of the algorithm.
2 Initial set +
First itteration ×
Second itteration 3 +
×3
×3 ×× Optimum solution
1 ×3 33 +
× 3 ×
3 + + ×
3 3
× + ++3 × + ×
3 ++ +3×
× +× + 3
E(ω) 0 3 + +
3 ×
+
×
3 + +
× + ×++
3 + 3
×
3 × ++++
3 3
+ 3
× 3 ×
× 3
-1 3 ×3×3
×3 ××
×3
+
-2 +
-1 -0.5 0 0.5 1
ω
10
A(ω) 4
2 Ad (ω)
A(ω)
-2
-1 -0.5 0 0.5 1
ω
has been designed by manually executing the the Remes exchange algorithm. A seven tap FIR filter has
the amplitude function A(ω) = a0 + a1 cos(ω) + a2 cos(2ω) + a3 cos(3ω). The filter is designed using the
initial set T = {0.1, 0.7, 1.5, 2.3, 3}. The first iteration gives T = {0.5, 1.2, 1.7, 2, 2.7} second iteration
gives the optimum solution T = {π/6, π/3, π/2, 2π/3, 5π/6}. The error curve E(ω) as a function of
ω for the three iterations is shown in figure 4.3. The resulting amplitude function along with the desired
amplitude function is shown in figure 4.3. The implementation is found in file l4c.m
Reference Manual
4.5 High-pass FIR filter design using Remes exchange algorithm 21
1
Initial set +
First itteration ×
Second itteration 3
0.5
× × ×
× +
3 + 3 +
+ × 3 3 ×
+
3 3
× + +
×
E(ω) 0 3 3 +
× × + + ×
3 3 ×
3 3
+ × + + +
× × + + ×
3 × × 3
+
3
× × 3
+ 3 3 3 3
-0.5 + +
-1 π π 3π
0 4 2 4
π
ω
The resulting amplitude function is presented in figure 4.4 along with the amplitude function obtained in
chapter 3.1. The two designs are nearly identical. The execution times on this specific implementation for
the the Remes and the simplex algorithms is 1.13ms and 18.1ms respectively. The implementation is found
in file l4d.c. The design routine is called fir_remez() and is implemented in firremez.c.
The resulting amplitude function is presented in figure 4.5 along with the amplitude function obtained in
chapter 3.2. The implementation is found in file l4e.c. The design routine is called fir_remez() and
is implemented in firremez.c.
Reference Manual
4.5 High-pass FIR filter design using Remes exchange algorithm 22
3
Ad (ω)
A(ω)
2.5
1.5
A(ω)
1
0.5
-0.5 π π 3π π
0 4 2 4
ω
0.2
Initial set +
0.15 First itteration ×
× Second itteration 3
0.1 33 × +3+3
+ ++3
3
+
3
+
3 3
0.05 + ××+
3 3
+ × + × ×
×3 3 × +
× × × 3 × ×
+3 + + 3
E(ω) 0 3 + × × ×
3 ×+
× × × +
3 +
×
+3 3 ×
× × × × ×3
+
-0.05 ×× + ×3
× +3 3
+ 3
+ +3
+
3 3 + +
333
-0.1 + 33+
+ + ×
-0.15 × +
-0.2 π π 3π
0 4 2 4
π
ω
Reference Manual
4.5 High-pass FIR filter design using Remes exchange algorithm 23
2
Ad (ω)
A(ω)
1.5
A(ω) 1
0.5
0 π π 3π π
0 4 2 4
ω
1 Remes
Minimax
0.1
0.01
A(ω)
0.001
0.0001
1e − 05 π π 3π
0 4 2 4
π
ω
Reference Manual
4.5 High-pass FIR filter design using Remes exchange algorithm 24
0.1 Remes
Minimax
0.01
A(ω)
0.001
0.0001
1e − 05 π π 3π
0 4 2 4
π
ω
Reference Manual
Chapter 5
Minimum phase optimum magnitude FIR filters can be deigned by combing Remes algorithm and polyno-
mial factorisation. The obtained filter H1 (ω) is optimum in the sense that the difference
max v(ω)|Ad (ω) − |H1 (ω)|2 |. (5.1)
ω∈F
is minimised. Here F is a set of band edges in the interval [0, π], and
1 + δ2 for ω ∈ Fp 1 for ω ∈ Fp
Ad (ω) = v(ω) = (5.2)
δ2 for ω ∈ Fs K for ω ∈ Fs
where δ2 is the stop-band deviation, K = δ1 /δ2 and Fp ∪ Fs = F. The optimum filter H1 (ω) will have
the passband deviation δ1 , and the stop-band deviation δ2 . An N long filter h1 (n) is designed using the
following three steps
1. Linear phase design Design a 2N − 1 long type 1 linear FIR filter h(n) with the specifications,
using Remes exchange algorithm.
1 for ω ∈ Fp 1 for ω ∈ Fp
A(ω) = v(ω) = (5.3)
0 for ω ∈ Fs K for ω ∈ Fs
where z1 , . . . , zN are the zeros of H 0 (z) are the zeros inside or on the unit circle. The filter H1 (z) is
formed according to
s
|h0 (0)|
−1 −1
H1 (z) = (1 − z z1 ) · · · (1 − z zN −1 ) QN −1 . (5.6)
i=1 |zi |
The obtained filter H1 (z) will have minimum phase. The filter-taps h1 (n) are formed by evaluating
the polynomial z1 , . . . , zN .
The above described design method is called fd_minphase(), and is implemented in firminphase.c.
In the design the factor δ2 is found by searching for the maximum deviation in the stop-band of the filter.
The roots are found using numerical root solving followed by sorting with regards to the magnitude of the
obtained roots.
5.1 Low-pass FIR filter design using Remes exchange algorithm 26
The zeros for the intermediate filter H 0 (z) is presented in figure 5.1. The resulting impulse response is
presented in figure 5.1 along with the impulse response for a filter with the same passband suppression
designed using the Remes algorithm. The figure shows hat the minimum-phase filter should have much
lower delay than the filter designed using the Remes algorithm.
The frequency response for the two filters is presented in dB scale in figure 5.1.The figure shows that
the passband deviation for the min-phase filter is smaller than for the Remes filter.
The group delay presented in figure 5.1 shows that the Remes algorithm results in a filter with linear
phase response while the minimum-phase filter has lower but non linear phase response.
The implementation is found in file l5a.c and l5.m.
1.5
?
?
1
? ?
? ?
?
0.5 ?? ?
?? ? ?
?
0 ?? ? ?
?
?? ? ?
-0.5 ?? ?
? ?
?
? ?
-1
?
?
-1.5
-1.5 -1 -0.5 0 0.5 1 1.5 2 2.5
The zeros for the intermediate filter H 0 (z) is presented in figure 5.2. The resulting impulse response is
presented in figure 5.2 along with the impulse response for a filter with the same passband suppression
designed using the Remes algorithm. The figure shows hat the minimum-phase filter should have much
lower delay than the filter designed using the Remes algorithm.
The frequency response for the two filters is presented in dB scale in figure 5.2.The figure shows that
the passband deviation for the min-phase filter is smaller than for the Remes filter.
Reference Manual
5.2 High-pass FIR filter design using Remes exchange algorithm 27
0.5
0.4 Min-phase
Remes
0.3
0.2
h[n]
0.1
−0.1
−0.2
0.00 5.00 10.00 15.00 20.00
n
The group delay presented in figure 5.2 shows that the Remes algorithm results in a filter with linear
phase response while the minimum-phase filter has lower but non linear phase response.
The implementation is found in file l5b.c and l5.m.
Reference Manual
5.2 High-pass FIR filter design using Remes exchange algorithm 28
−10 Min-phase
Remes
−20
|H(ω)| −30
−40
−50
−60 π π 3π π
0 4 2 4
ω
20
15
10
− dΘ
dω
k
0
−5 Min-phase
Remes
−10
−15
−20 π π π
3π
0 8 4 8 2
ω
Reference Manual
5.2 High-pass FIR filter design using Remes exchange algorithm 29
1.5
?
?
1 ? ?
? ?
?
0.5 ? ?
? ? ?
?
0 ? ? ?
?
? ? ?
-0.5 ? ?
? ?
?
-1 ? ?
?
?
-1.5
-2.5 -2 -1.5 -1 -0.5 0 0.5 1 1.5
0.6
0.5
0.4 Min-phase
Remes
0.3
0.2
h[n] 0.1
0
−0.1
−0.2
−0.3
−0.4
0.00 5.00 10.00 15.00 20.00
n
Reference Manual
5.2 High-pass FIR filter design using Remes exchange algorithm 30
−10 Min-phase
Remes
−20
|H(ω)| −30
−40
−50
−60 π π 3π π
0 4 2 4
ω
20
15
10
− dΘ
dω
k
0
−5 Min-phase
Remes
−10
−15
−20 π
5π 3π 7π
2 8 4 8
π
ω
Reference Manual
Chapter 6
Non linear FIR filters can be designed using minimax complex approximation. The resulting filter h
minimises the weighted minimax error between its frequency response and a desired frequency response
Hd according to
min max vk |H(ωk ) − Hd (ωk )|, (6.1)
h∈RN k∈[0,1,...,L−1]
where δ is the minimax error and φ(ω) = [1, ejω , . . . , ejωN −1 ]. The design method is implemented as the
function fd_firminimax() and is found in firminimax.c. The linear program is solved using the
simplex algorithm.
min δ, subject to
where σ(ω) is the stop-band limit, and Fp defines the pass-band and Fs the stop-band. This design method
is implemented as the function fd_cminimaxeq() in the file fireq.c.
−10 Minimax
Least squares
−20
−30
|H(ω)|
−40
−50
−60
−70 π π 3π
0 4 2 4
π
ω
Reference Manual
6.2 Design of FIR equaliser for elliptic filters 33
2.5 Minimax
Least squares
2
1.5
v(ω)|H(ω) − Hd (ω)|
0.5
−0.5 π π 3π
0 4 2 4
π
ω
The group-delay for the overall filter along with the group-delay for the elliptic filter is presented in
figure 6.2 for different values of σ(ω). The figure shows that the group-delay for the overall filter is 13
samples in the passband as desired in the specification.
Reference Manual
6.2 Design of FIR equaliser for elliptic filters 34
12
10
Minimax
Least squares
8
− dΘ
dω
k
6
0 π π π
3π
0 8 4 8 2
ω
10
0 |G(ω)|
|G(ω)H(ω)|
−10
−20
|F (ω)| −30
−40
−50
−60
−70 π π 3π
0 4 2 4
π
ω
Reference Manual
6.2 Design of FIR equaliser for elliptic filters 35
25
20 20 log σ = +10 dB
20 log σ = −10 dB
15
10
5
|H(ω)| 0
−5
−10
−15
−20
−25 π π 3π π
0 4 2 4
ω
20
15
− dΘ
dω
k
10
G(ω)
G(ω)H(ω), 20 log σ = +10
G(ω)H(ω), 20 log σ = −10
5
0 π π π
3π
0 8 4 8 2
ω
Reference Manual
Chapter 7
Group-delay constraints can be added to FIR filter design using minimax and least squares complex ap-
proximation by introducing a limit to the group-delay error e(ω) in the design procedure. The group-delay
error is given by
e(ω) = τ (ω) − τd (ω) ≈ ψ T (ω)h (7.1)
where τ and τd are the actual and desired group-delay, and ψ(ω) is given by
(0 − τd (ω))cos(ω(0 − τd ))
1 (1 − τd (ω))cos(ω(1 − τd ))
ψ(ω) = .. (7.2)
Ad (ω) .
(N − 1 − τd (ω))cos(ω(N − 1 − τd ))
where Ad (ω) is the desired amplitude function for the filter and N is the length of the filter. The constraint
is introduced as an additional linear constraint in minimax design and as a part of the equation system in
least squares complex approximation.
The vector v = is a positive weight vector, that determines the design accuracy for each
[v02 , v12 , . . . , vL−1
2
]
discrete frequency ωk ∈ [0, π], k = 0, 1, . . . , L − 1.
The group-delay constraint is added to the solution of the above problem as an quadratic term. The
solution is formulated using vector notation as
h = (<(ΦWΦH ) + ΨUΨT )−1 <(ΦWHd ) (7.4)
where W and U are diagonal matrices with diagonal elements v and u respectively. The vector u =
[u20 , u21 , . . . , u2L−1 ] are weights that constrain the group-delay, and Ψ = [ψ(ω0 ), ψ(ω1 ), . . . , ψ(ωL−1 )].
The vector Φ is a vector of base functions defined according to
Φ = [φ(ω1 ), φ(ω2 ), . . . , φ(ω(L−1) )], (7.5)
37
where φ(ωk ) = [1, e−j2πωk , . . . , e−j(N −1)2πωk ]T . The design method is implemented as the function
fd_clsgd() and is found in firls.c.
Using real rotation theorem the unit circle is approximated using and octagon and equation 7.6 can be
rewritten into a linear programming problem, where the group-delay constraint is added as an additional
linear constraint. The problem is defined as
min δ, subject to
v <{φ(ωk )}h − δ ≤ vk <{Hd (ωk )} k ∈ [0, 1, . . . , L − 1]
k
jπ/4 jπ/4
v k <{φ(ω k )e }h − δ ≤ v k <{H (ω
d k )e } k ∈ [0, 1, . . . , L − 1]
jπ/2 jπ/2
vk <{φ(ωk )e }h − δ ≤ vk <{Hd (ωk )e } k ∈ [0, 1, . . . , L − 1]
vk <{φ(ωk )ej3π/4 }h − δ ≤ vk <{Hd (ωk )ej3π/4 } k ∈ [0, 1, . . . , L − 1]
vk <{φ(ωk )ejπ }h − δ ≤ vk <{Hd (ωk )ejπ } k ∈ [0, 1, . . . , L − 1] (7.8)
j5π/4 j5π/4
v <{φ(ω )e }h − δ ≤ v <{H (ω )e } k ∈ [0, 1, . . . , L − 1]
k k k d k
vk <{φ(ωk )ej3π/2 }h − δ ≤ vk <{Hd (ωk )ej3π/2 } k ∈ [0, 1, . . . , L − 1]
j7π/4
vk <{φ(ωk )e }h − δ ≤ vk <{Hd (ωk )ej7π/4 } k ∈ [0, 1, . . . , L − 1]
T
ψ(ωk ) h ≤ τd (ωk ) k ∈ [0, 1, . . . , L − 1]
−ψ(ωk )T h ≤ τd (ωk ) k ∈ [0, 1, . . . , L − 1]
where δ is the minimax error and φ(ω) = [1, ejω , . . . , ejωN −1 ]. The problem is solved using linear pro-
gramming. The design method is implemented as the function fd_cminimaxgd() and is found in
firminimax.c. The linear problem is solved using the simplex algorithm.
Phase equaliser design using minimax complex approximation with group-delay constraints
The theory described above can be extended to a method for designing phase equalisers for systems with
an arbitrary frequency response G(ω). The resulting method can be formulated as the linear programming
problem
min δ, subject to
ω ∈ Fs , ϕ ∈ [0, π4 , . . . , 7π
v(ω)<{φ(ω)ejϕ }h − δ ≤ σ(ω) 4 ]
v(ω)<{G(ω)φ(ω)e }h − δ ≤ v(ω)<{Hd (ω)e } ω ∈ Fp , θ ∈ [0, π4 , . . . , 7π 4 ] , (7.9)
jθ jθ
T
q (ω)h ≤ τ (ω) ω ∈ F
d p
−qT (ω)h ≤ τd (ω) ω ∈ Fp
where σ(ω) is the stop-band limit, and Fp defines the pass-band and Fs the stop-band. The elements qn (ω)
of q(ω) are given by
Reference Manual
7.1 Low-pass least squares FIR filter with group-delay constraints 38
The frequency response for the filters is presented in figure 7.1. The figure shows that the regular least
squares filter has higher stop-band attenuation and lower passband deviation than the filter with group-
delay constraints.
The group delay presented in figure 7.1 shows that the the filter designed with group-delay constraints
has lower group-delay deviation in the passband than the filter designed using ordinary least squares com-
plex approximation.
The implementation is found in file l7a.c.
−30
|H(ω)|
−40
−50
−60
−70 π π 3π
0 4 2 4
π
ω
The frequency response for the filters is presented in figure 7.2. The figure shows that the regular mini-
max filter has higher stop-band attenuation and lower passband deviation than the filter with group-delay
constraints.
The group delay presented in figure 7.2 shows that the the filter designed with group-delay constraints
has lower group-delay deviation in the passband than the filter designed using ordinary minimax complex
approximation.
The implementation is found in file l7a.c.
Reference Manual
7.3 Design of FIR equaliser with group-delay constraint for elliptic filters 39
10
− dΘ
dω
k
7
4 π π π
3π
0 8 4 8 2
ω
Reference Manual
7.3 Design of FIR equaliser with group-delay constraint for elliptic filters 40
−30
|H(ω)|
−40
−50
−60
−70 π π 3π π
0 4 2 4
ω
10
9 Constarined minimax
Minimax
8
− dΘ
dω
k
7
4 π π π
3π
0 8 4 8 2
ω
Reference Manual
7.3 Design of FIR equaliser with group-delay constraint for elliptic filters 41
20
|G(ω)|
|G(ω)H(ω)|
0
−20
|F (ω)| −40
−60
−80
−100 π π 3π π
0 4 2 4
ω
10
−10
|H(ω)| −20
−30
−40
−50 π π 3π
0 4 2 4
π
ω
Reference Manual
7.3 Design of FIR equaliser with group-delay constraint for elliptic filters 42
20
15
− dΘ
dω
k
10
τG (ω)
τGH (ω)
0 π π π
3π
0 8 4 8 2
ω
Reference Manual
Chapter 8
Infinite impulse response (IIR) filters can be designed from analog filters using bilinear transformation.
This chapter describes design methods for five types of analog filters and how to convert them into IIR
filters using bilinear transformation. It also describes how to change the cutoff frequency for analog filters
and how to transform them into high-pass band-pass and band-stop filters. The filters described here are
all split up into first and second order sections for easy fixed precision implementation using cascaded
biquads. The filter order is denoted by N .
4. Inverse Chebyshev filters provides control of the maximum stop-band attenuation, through the pa-
rameter k1 . The frequency response is maximally flat at ω = 0. The parameter k 1 can be determined
according to
δ2 1
k1 = p =√ (8.4)
1 − δ22 10b/10 − 1
where δ2 is the desired stop-band ripple in times and b is the desired positive stop-band attenuation
in dB. The filter order can be approximated according to
cosh−1 k √G 2
1 1−G
N≥ , (8.5)
−1 1
cosh ωp
where frequency response of the filter remains between unity and G in the interval 0 < ω < ω p ,
where 0 < ωp < 1 and 0 < G < 1.
5. Elliptic Function filters are characterised by the four parameters
(a) The passband ripple δ1 .
(b) The width of the transition band (1 − ωs )
(c) The maximum stop-band ripple δ2
(d) The order of the filter N
Given three of the above parameters the fourth will be minimal. The design is specified through the
parameters ε and k1 . These parameters can be calculated according to
q
2δ1 −δ12 √
ε = 1−2δ 1 +δ1
2 = 10a/10 − 1
, (8.6)
k1 = √ 2 = √ ε
ε
1/δ2 −1 10b/10 −1
where a is the desired passband ripple in dB, and b is the desired positive stop-band attenuation in
dB. Using the above equations the transition region will be minimal for a given filter length N .
The above design methods are implemented as the functions id_bessel(), id_butterworth(),
id_shebyshev(), id_ichebyshev and id_elliptic in the file iiranalog.c. The filters re-
turned from the design functions are here referred to as prototype filters. They have a cutoff frequency of
1Hz and unity gain in the passband.
Only Bessel-Thomson and Butterworth has unity passband gain, the other three has a passband gain
that varies with the design parameters. This gain offset has to be compensated for, and is therefore returned
from the design functions. When the filter length is odd a first order link must be prepended to the array
of biquads. The parameters for this first order filter is stored in the first two positions of the numerator and
denominator vectors returned from the design functions.
Reference Manual
8.1 Fixed frequency response IIR filter design 45
s 2 + F h Fl
s→ (8.9)
s(Fh − Fl )
s(Fh − Fl )
s→ (8.10)
s 2 + F h Fl
Bilinear transformation
The bilinear transformation is used for transforming an analog filter, into a digital IIR filter with similar
properties. The transform projects the left half plane of the Laplace transform of the analog filter to the
inside the unit circle of the Z-transform of the digital filter. This transformation results in a stable IIR filter
of the same order as the analog filter. The digital IIR filter is obtained using the substitution
F z−1
s= , (8.11)
tan (πFz /Fs ) z + 1
where F ∈ [0, ∞] is the critical frequency for the analog filter, Fs ∈ [0, ∞] the sample frequency and Fz ∈
[0, Fs /2] is the critical frequency for the digital IIR filter. The transformation will project the frequency F
to Fz according to
Fz
F = 2Fs tan π (8.12)
Fs
This projection is referred to as frequency warping and must be carefully compensated for especially when
designing filters with more than one critical frequency.
The substitution can be simplified if the sample frequency and the critical frequency for the analog filter
is equal to 1. The result is
1 z−1
s= , (8.13)
tan(πfz ) z + 1
where fz ∈ [0, 0.5].
In this implementation the transformation is defined for first and second order sections. The implemen-
tation is made such that the resulting biquad sections has unity gain for z 0 . This results in a gain error
which must be compensated for in order to reach the desired passband gain for the filter. The advanced and
the simplified transformation described above are implemented as the functions it_bilinear_adv()
and it_bilinear() and are found in the file iirtrans.c. The first order section required for odd
length filters is returned in the first two positions in the weight vector for the IIR filter.
The required design parameters for the five filters is summarised in table 8.1.
Reference Manual
8.2 Fixed length IIR filter design 46
The frequency response for the filters is presented in figure 8.1. The Bessel-Thomson filter can not be
made to meet the specification. The frequency response for the passband of the filters is shown in figure
8.1. The two figures shows that all the filters except the Bessel-Thomson fulfils the frequency response
specification.
The group delay for the filters is presented in figure 8.1. The figure shows that The Chebyshev filter has
the worst group delay followed by the Butterworth and the elliptic function filter. The lowest group delay
are obtained by the inverse Chebyshev and the Bessel-Thomson filters.
The implementation is found in file l8a.c.
0
Elliptic function
−10 Inverse Chebyshev
Chebyshev
Butterworth
−20 Bessel-Thomson
20 log |H(ω)|
−30
−40
−50
−60 π π 3π π
0 4 2 4
ω
Filter type N a b wc
Elliptic function 4 -3dB -40dB 0.4π
Inverse Chebyshev 6 - -40dB 0.5π
Chebyshev 8 -3dB - 0.39π
Butterworth 14 - - 0.4π
Bessel-Thomson 14 - - 0.4π
Reference Manual
8.3 IIR filter implementation 47
6 Elliptic function
Inverse Chebyshev
Chebyshev
4 Butterworth
Bessel-Thomson
2
20 log |H(ω)|
0
−2
−4
π π 3π π
0 8 4 8 2
ω
The group delay presented in figure 8.2 shows that the the Bessel-Thomson filter has the lowest group
delay followed by the Butterworth, the inverse Chebyshev and the Chebyshev filters. The worst group
delay is obtained by the Elliptic function filter.
The implementation is found in file l8b.c.
Filter type a b wc
Elliptic function -3dB -40dB 0.40π
Inverse Chebyshev - -40dB 0.46π
Chebyshev -3dB - 0.40π
Butterworth - - 0.40π
Bessel-Thomson - - 0.60π
Reference Manual
8.4 Analog filter transformation 48
30
25 Elliptic function
Inverse Chebyshev
Chebyshev
20 Butterworth
Bessel-Thomson
− dΘ
dω 15
10
0 π π π
3π
0 8 4 8 2
ω
specifications for the transformed filters are given by The frequency response for the filters are presented
Reference Manual
8.4 Analog filter transformation 49
−40
−50
−60 π π 3π π
0 4 2 4
ω
6 Elliptic function
Inverse Chebyshev
Chebyshev
4 Butterworth
Bessel-Thomson
2
20 log |H(ω)|
0
−2
−4
π π 3π π
0 8 4 8 2
ω
Reference Manual
8.4 Analog filter transformation 50
100
80 Elliptic function
Inverse Chebyshev
Chebyshev
60 Butterworth
Bessel-Thomson
− dΘ
dω 40
20
−20 π π π
3π
0 8 4 8 2
ω
−10
−20
20 log |H(ω)|
−30
−40
−50
−60 π π 3π
0 4 2 4
π
ω
Figure 8.7: Frequency response for eight order inverse Chebyshev low-pass IIR filter.
Reference Manual
8.4 Analog filter transformation 51
1.4
1.2
1 x[n]
y[n]
0.8
0.6
a[n]
0.4
0.2
0
−0.2
−0.4
0 10 20 30 40 50 60 70 80
n
Figure 8.8: Step response for eight order inverse Chebyshev low-pass IIR filter.
Reference Manual
8.4 Analog filter transformation 52
20 log |H(F )|
0
−10 Low-pass
−20
−30
−40
−50
−60
0.1 1.0 10.0
F
20 log |H(F )|
0
−10 High-pass
−20
−30
−40
−50
−60
0.1 1.0 10.0
F
20 log |H(F )|
0
−10 Band-pass
−20
−30
−40
−50
−60
0.1 1.0 10.0
F
20 log |H(F )|
0
−10 Band-stop
−20
−30
−40
−50
−60
0.1 1.0 10.0
F
Reference Manual
Chapter 9
This chapter describes a simple half-band filter-bank, see figure 9.1. A filter-bank consists of an analysis
(filter and decimator) and a synthesis part (interpolator and filter). The filters in the upper part (H 0 (z) and
F0 (z)) are low-pass filters and the two filters in the lower part (H1 (z) and F1 (z)) are high-pass filters. The
cutoff frequency for the two filter pairs ωc = π2 .
Analysis Synthesis
X(z) Y (z)
H0 (z) 2 2 F0 (z)
H1 (z) 2 2 F1 (z)
where
c n=0
H(z) + H(−z) = 2c ⇐⇒ h(2n) = (9.4)
0 elsewhere
and where c is a constant that big enough to ensure that H(ω) ≥ 0. The design procedure for H(z) is
outlined below:
1. Linear phase design Design a N long type 2 linear FIR filter q1 (n) with the specifications seen
below, using Remes exchange algorithm.
1 for 0 ≤ ω < 2fc
Aq (ω) = (9.5)
0 for ω = π
where fc is close to π2 , also define M = N − 1.
9.1 Low-pass FIR filter design using Remes exchange algorithm 54
|g3 (M )|
H(z) = (1 − z −1 z1 )(z1∗ − z −1 ) · · · (1 − z −1 zM )(zM
∗
− z −1 ) QM (9.8)
i=1 |zi |
where z1 , . . . , zN are the zeros of H(z). The filter H0 (z) is formed according to
s
|g3 (M )|
−1 −1
H0 (z) = (1 − z z1 ) · · · (1 − z zM ) QM . (9.9)
i=1 |zi |
The obtained filter H0 (z) will have minimum phase. The filter-taps h0 (n) are formed by evaluating
the polynomial z1 , . . . , zN .
1.01
1.005
|Q1 (ω)| 1
0.995
0.99 π π 3π
0 4 2 4
π
ω
Reference Manual
9.1 Low-pass FIR filter design using Remes exchange algorithm 55
0.5
0.25
h0 [n] 0
−0.25
−0.5
0 2 4 6 8 10
n
0.5
0.25
h1 [n] 0
−0.25
−0.5
0 2 4 6 8 10
n
0.5
0.25
f0 [n] 0
−0.25
−0.5
0 2 4 6 8 10
n
0.5
0.25
f1 [n] 0
−0.25
−0.5
0 2 4 6 8 10
n
Reference Manual
9.1 Low-pass FIR filter design using Remes exchange algorithm 56
10
0
−10
−20
H0 (ω)
−30
−40
−50
−60 π π 3π
0 4 2 4
π
ω
10
0
−10
−20
H1 (ω)
−30
−40
−50
−60 π π 3π π
0 4 2 4
ω
10
0
−10
−20
F0 (ω)
−30
−40
−50
−60 π π 3π π
0 4 2 4
ω
10
0
−10
−20
F1 (ω)
−30
−40
−50
−60 π π 3π
0 4 2 4
π
ω
Reference Manual
Chapter 10
In optimum window design the the total side lobe energy is minimised subject to the constraint that H(0) =
1. The method gives an optimum compromise between least squares and minimax criterias. The method is
compared with the eigen window design and with Kaiser window design. The implementation is currently
limited to type 1 and type 2 linear low-pass FIR filters. The amplitude function is here given by A(ω) =
φT (ω)a, where φ(ω) is defined according to table 10 and a according to table 10. The optimum window
is defined as the optimisation problem
Rπ
mina∈RM +1 ωs |A(ω)|2 dw, subject to
where the integral is the stop-band energy and σ is the maximum stop-band level. The optimisation problem
can be solved using quadratic or linear programming
Type 1 Type 2
√
1
√ √2 cos(1/2ω)
2 cos(ω) 2 cos(3/2ω)
φ(ω) = .. φ(ω) = ..
.
√
√ .
2 cos(ωM ) 2 cos(M ω)
Type 1 Type 2
√
√ h(M )
√2h(N/2 − 1)
2h(M − 1) 2h(N/2 − 2)
a= .. a= ..
√ .
√ .
2h(0) 2h(0)
Reference Manual
10.4 Kaiser window design 59
10
−10
−20
A(ω) −30
−40
−50
−60
−70 π π 3π
0 4 2 4
π
ω
Reference Manual
10.4 Kaiser window design 60
10
−10
−20
A(ω) −30
−40
−50
−60
−70 π π 3π π
0 4 2 4
ω
-90
Least squares
Minimax ?
Eigen window 3
-95 ?
-100
-105
3
-110
-50 -48 -46 -44 -42 -40 -38 -36
Reference Manual
10.4 Kaiser window design 61
10
−10
−20
A(ω) −30
−40
−50
−60
−70 π π 3π π
0 4 2 4
ω
−18.8
−19
−19.2
−19.4
−19.6
−19.8
Maximum sidelobe energy [dB]
−20
−20.2
−20.4
−20.6
−20.8
−21
−6 −6 −6 −6 −6 −6 −6 −6 −6 −6
Total sidelobe energy [dB]
Reference Manual
Chapter 11
Minimum phase FIR filters with arbitrary magnitude specification can be designed by combining minimax
design of linear phase filters with spectral factorisation. A linear type 1 FIR filter R(z) with the length 2N −
1 is designed using Remes algorithm or using linear programming. The linear filter is then transformed
into a N long minimum phase filter h using spectral factorisation.
A spectral factorisation of R(z) exists iff R(z) = R(−z), R(ejω ) > 0 and the zeros of R(z) on the
unit circle are double. The first and the third criteria is automatically fulfilled by using a linear phase filter
with odd length. The second criteria R(ejω ) > 0 is however a constraint on R(z), which must be included
in the design procedure. The frequency response of R(z) is given by
N
X −1 N
X −1
R(ejω ) = r(n)e−jωn = r(0) + r(n)2 cos(ωn) = φT (ω)r, (11.1)
n=−(N −1) n=1
where Hl (ω) ≥ 0 and R(ω) relates to H(ω) as Rl (ω) = Hl2 (ω), Ru (ω) = Hu2 (ω) and R(ejω ) =
|H(ejω )|2 . The design constraints H(ejωi ) = 0 are referred to as null constraints, and can be used to move
the position of zeros in the stop-band. Below follows three methods of calculating R(z) given the above
specification of h.
Minimax criterion
Remes exchange algorithm can be used in order to obtain a filter with a regular minimax specification, i.e.
one without null constraints. The minimax optimisation problem is defined according to
1
min max R(ejω ) − Rd (ω) , (11.3)
r∈RN ω∈Ω ε(ω)
where
Ru (ω) + Rl (ω)
Rd (ω) = (11.4)
2
Ru (ω) − Rl (ω)
ε= (11.5)
2
11.1 Low-pass FIR filter design using Remes exchange algorithm 63
The design can be performed using the implementation made in chapter 5. The design function used
is fd_minphase() and is found in the file firminimac.c. Note that the raising of the amplitude
function above zero inside the design function becomes redundant, since the amplitude function R(ω) is
positive for all values of ω.
minr,δ δ subject to
v(ω)φT (ω)r − δ ≤ v(ω)Rd (ω),
ω ∈ Ω p ∪ Ωs
−v(ω)φT (ω)r − δ ≤ v(ω)Rd (ω), ω ∈ Ωp , (11.6)
T
φ (ω)r ≥ 0, ω ∈ Ω
s
T
φ (ωi )r = 0, ωi ∈ Ωs , i = 0, 1, . . . , I − 1
where
Ru (ω)+Rl (ω)
, ω ∈ Ωp
Rd (ω) = 2 (11.7)
0, ω ∈ Ωs
and
Ru (ω)−Rl (ω)
, ω ∈ Ωp
ε= 2 (11.8)
Ru (ω), ω ∈ Ωs
The first two constraints in the linear program definition 11.6 shapes the amplitude function of R(ω).
The third constraint enables for the spectral factorisation and the last constraint contains the null constraints.
This design method is implemented as the function fd_minphaseminimax() in firminphase.c.
r∈RN c r subject to
T
min
T
φ (ω)r ≤ Ru (ω), ω ∈ Ω p ∪ Ωs
T , (11.9)
−φ (ω)r ≤ R l (ω), ω ∈ Ω p ∪ Ωs
T
φ (ωi )r = 0, ωi ∈ Ωs , i = 0, 1, . . . , I − 1
where Z
c= φ(ω)dω. (11.10)
Ωs
The design minimises the energy in the stop-band while maintaining the passband within the limits
using the first two constraints. The null constraints are placed using the third constraint. This design
method is implemented as the function fd_minphasels() in firminphase.c
101/20
ω ∈ Ωp = [0, 0.4π]
Hu (ω) =
10−40/40 ω ∈ Ωs = [0.5π, π]
Reference Manual
11.2 High-pass FIR filter design using Remes exchange algorithm 64
and
10−1/20 ω ∈ Ωp = [0, 0.4π]
Hl (ω) =
0 ω ∈ Ωs = [0.5π, π]
The shortest filter that fulfills the specification is N = 28 taps long. The zeros for the intermediate filter
R(z) is presented in figure 11.1. The resulting impulse response is presented in figure 11.1 along with the
impulse response for a linear filter with the same specifications designed using the Remes algorithm. The
figure shows hat the minimum-phase filter should have much lower delay than the filter designed using
the Remes algorithm. The linear Remes filter needs N = 49 taps to reach the same specification as the
minphase filter.
The frequency response for the two filters is presented in dB scale in figure 11.1.
The group delay presented in figure 11.1 shows that the Remes algorithm results in a filter with linear
phase response while the minimum-phase filter has lower but non linear phase response.
The implementation is found in file l11a.c and l11.m.
1.5
1 ? ? ??? ?
?? ? ? ? ?
?
0.5 ? ?? ?
? ?
?? ? ?
0 ?? ?? ? ?
?? ? ?
-0.5 ? ?? ?
? ? ? ?
? ?? ? ?
-1 ? ? ??? ?
-1.5
-2
-3 -2 -1 0 1 2 3
and
10(−25+200ω/π)/20
ω ∈ [0, 0.1π]
10−5/20 ω ∈ [0.1π, 0.5π]
Hl (ω) =
10(195−400ω/π)/20
ω ∈ [0.5π, 0.6π]
0 ω ∈ [0.6π, π]
Reference Manual
11.3 High-pass FIR filter design using Remes exchange algorithm 65
0.5
0.4 Min-phase
Remes
0.3
0.2
h[n]
0.1
−0.1
−0.2
0 5 10 15 20 25 30 35 40 45 50
n
H(ej0.7π )
=0
H(ej0.8π ) =0
The shortest filter that fulfills the specification is N = 23 taps long. The zeros for the intermediate filter
R(z) is presented in figure 11.2. The resulting impulse response is presented in figure 11.2.
The frequency response for the filter is presented in dB scale in figure 11.2. The figure shows that the
filter fulfills the specification including the null constraints. The group delay is presented in figure 11.2.
The implementation is found in file l11b.c and l11.m.
Reference Manual
11.3 High-pass FIR filter design using Remes exchange algorithm 66
10
−10 Min-phase
Remes
−20 Limits
|H(ω)|
−30
−40
−50
−60 π π 3π π
0 4 2 4
ω
30
25
20
15
10
− dΘ
dω
k
5
0
−5 Min-phase
Remes
−10
−15
−20 π π π
3π
0 8 4 8 2
ω
Reference Manual
11.3 High-pass FIR filter design using Remes exchange algorithm 67
1.5
1 ? ?? ?
??
? ?
?? ??
0.5 ?
? ? ??
0 ? ? ? ? ???
??
? ? ??
-0.5 ?? ?
??
? ? ?
-1 ? ?? ??
-1.5
-2
-3 -2 -1 0 1 2 3
Min-phase
0.3
0.2
0.1
h[n] 0
−0.1
−0.2
−0.3
0 5 10 15 20 25
n
Reference Manual
11.3 High-pass FIR filter design using Remes exchange algorithm 68
10
0
−10 Min-phase
Limits
−20
−30
|H(ω)|
−40
−50
−60
−70
−80 π π
0 4 2 0.7π 0.8π π
ω
30
25
20
15
10
− dΘ
dω
k
5
0
−5 Min-phase
−10
−15
−20 π π
0 4 2 0.7π 0.8π π
ω
Reference Manual
11.3 High-pass FIR filter design using Remes exchange algorithm 69
1 ? ??
? ? ?? ? ??
? ? ?
? ??
?
?? ? ?? ?
0 ??
? ? ??
?? ? ?
? ?? ? ??
-1 ? ??
-2
-3 -2 -1 0 1 2 3 4 5
Min-phase
0.3
0.2
0.1
h[n] 0
−0.1
−0.2
−0.3
0 5 10 15 20 25
n
Reference Manual
11.3 High-pass FIR filter design using Remes exchange algorithm 70
10
0
−10 Min-phase
Limits
−20
−30
|H(ω)|
−40
−50
−60
−70
−80 π π
0 4 2 0.7π 0.8π π
ω
30
25
20
15
10
− dΘ
dω
k
5
0
−5 Min-phase
−10
−15
−20 π π
0 4 2 0.7π 0.8π π
ω
Reference Manual
Chapter 12
Long minimum phase FIR-filters are hard to design using root finding due to numerical difficulties. By
employing complex cepstrum transformation and fast Fourier transform (FFT) these numerical problems
can be circumvented. This chapter describes how to design FIR-filters with an arbitrary amplitude response
using an iterative method based on FFT and cepstrum processing.
An N long minimum phase FIR-filter h(n) with the magnitude response |H(e jω )| described by
0 ≤ Hl (ω) ≤ |H(ejω )| ≤ Hu (ω) (12.1)
can be designed using complex cepstrum technique using the following procedure
1. Initialise parameters Define the FFT size K > 10 ∗ N and the upper and lower magnitude response
limits Hu (ωk ) and Hl (ωk ), for k = 0, 1, . . . , K − 1. Set the initial desired magnitude response to
Hl (ωk ) + Hu (ωk )
|H(ejωk )| = . (12.2)
2
Define the truncation tolerance ε for the algorithm to
Hu (ωk ) − Hl (ωk )
0 < ε < max . (12.3)
∀k 2
This constant will determine the convergence speed of the algorithm.
2. Apply cepstrum transformation Form the filter ĥe (n) according to
3. Truncate filter Truncate the minimum phase filter h(n) to an FIR-filter h1 (n) of length N according
to
h(n) 0 ≤ n ≤ N − 1
h1 (n) = (12.7)
0 N ≤n≤K −1
12.1 Low-pass FIR-filter design using complex cepstrum technique 72
4. Test for convergence Calculate the frequency response of the truncated filter H 1 (ω) = FFT {h1 (n)},
and defined the new desired magnitude response
If Hl (ω) ≤ |H1 (ejω )| ≤ Hu (ω) for all ω stop else return to step 2.
The above described design method is called fd_cepminphase(), and is implemented in firminphase.c.
The truncation parameter ε will determine weather the algorithm will converge or not. A too small value
will make the algorithm very slow while a too big value will cause divergence.
10(−20+200ω/π)/20 ω
∈ [0, 0.1π]
100/20 ω ∈ [0.1π, 0.5π]
Hu (ω) = (200−400ω/π)/20
10 ω ∈ [0.5π, 0.6π]
10(−25−25ω/π)/20 ω ∈ [0.6π, π]
and
10(−25+200ω/π)/20
ω ∈ [0, 0.1π]
10−5/20 ω ∈ [0.1π, 0.5π]
Hl (ω) = ,
10(195−400ω/π)/20 ω ∈ [0.5π, 0.6π]
0 ω ∈ [0.6π, π]
has been designed with a truncation tolerance of ε = 0.5dB. The design specification is met for an N = 28
long filter. The resulting impulse response is presented in figure 12.1. The frequency response for the filter
is presented in dB scale in figure 12.1 along with the design limits. The group delay presented in figure
12.1.
The implementation is found in file l12a.c.
Reference Manual
12.1 Low-pass FIR-filter design using complex cepstrum technique 73
0.3
0.2
0.1
h[n] 0
−0.1
−0.2
−0.3
0 5 10 15 20 25
n
10
−10 |H(ω)|
Limits
−20
|H(ω)|
−30
−40
−50
−60 π π 3π
0 4 2 4
π
ω
Reference Manual
12.1 Low-pass FIR-filter design using complex cepstrum technique 74
20
15
10
− dΘ
dω
k
0
−5
−10
−15
−20 π π π
3π
0 8 4 8 2
ω
Reference Manual
Chapter 13
Some IIR filters can be realized as a sum of two allpass filters, see figure 13.1. These filters are robust to
parameter quantisation, especially in the passband. Another advantage is that they can be implemented with
a minimum of multipliers. Both these properties makes the filters suitable for implementation in hardware.
1
A1 (z) 2
X(z) Y (z)
A2 (z)
−αk
X(z) Y (z)
z −1
Reference Manual
13.1 Design example 77
−βk
X(z) Y (z)
z −1
−αk
z −1
order sections and as a sum of allpass filters using the above transformation method. The magnitude
function for the three filters is shown in figures 13.1 and 13.1. The number of bits used for each section is
summarised in table 13.1. The conclusion is that for this specific filter the best option is to implement it as
second order sections.
Reference Manual
13.1 Design example 78
−10 Ideal
Direct form
Second order sections
−20 Sum of allpass
Limits
20 log |H(ω)|
−30
−40
−50
−60 π π 3π
0 4 2 4
π
ω
Figure 13.4: Frequency response for elliptic low-pass IIR filters implemented using three different ap-
proaches.
1.5
Ideal
1 Direct form
Second order sections
Sum of allpass
0.5 Limits
20 log |H(ω)|
0
−0.5
−1 π π π
3π
0 8 4 8 2
ω
Figure 13.5: Passband frequency response for elliptic low-pass IIR filters implemented using three different
approaches.
Reference Manual
Chapter 14
This chapter describes uniform over-sampled DFT filterbanks. A DFT filterbank consists of an analysis
and a synthesis part. The analysis part consists of a tapped delay line, a decimator, a polyphase FIR filter
and an inverse discrete Fourier transform (IDFT), see figure 14.1. The synthesis part consists of a discrete
Fourier transform (DFT), a polyphase FIR filter, an interpolator and a tapped delay line, see figure 14.2.
The analysis filterbank is a single input - multiple output (SIMO) system where the sample rate of the
outputs is P times lower than the sample rate for the input. The system converts the input signal X(z)
into K signals Xk (z), where k ∈ [0, K − 1]. These signals are are referred to as subband signals and are
decimated by a factor of D, where K = D · P . The subband signals are wide-band, each representing
a unique narrow frequency band of the full-band signal, with the fullband centre frequency 2πk K and the
fullband bandwidth 2π K . The bandwidth of each subband signal is 2π
P . The oversampling is performed in
order to reduce the effect of aliasing between the subbands.
The frequency response for the polyphase FIR filter will determine the frequency response for the
subband signals, and thereby the frequency response for the over all system. The filter is designed using a
prototype filter H0 (z) with the length L = K · N , where N is an integer. The prototype filter must be a
low-pass filter in order for the subband signals to represent unique frequency bands of the fullband signal.
The stop-band attenuation of the prototype filter will determine the aliasing between the subbands. The
cutoff frequency, passband ripple and the main-lobe width will determine the overall frequency response
of the DFT filterbank. The cutoff frequency is set to fc = 2π K but can be adjusted to f c ≈ 1.1 K If the
2π
X(z)
D E0 (z) X0 (z)
z −1
D E1 (z) X1 (z)
z −1
IDFT
D E2 (z) X2 (z)
Y0 (z) F0 (z) D
z −1
Y1 (z) F1 (z) D
z −1
DFT
Y2 (z) F2 (z) D
Y (z)
YK−1 (z) FK−1 (z) D
Reference Manual
14.2 Parallel DFT filterbank implementation 81
−20
−40
H0 (ω) −60
−80
−100
−120 π π 3π π
0 4 2 4
ω
100
90
80 x(n)
y(n)
70
60
50
a[n]
40
30
20
10
0
−10
0 10 20 30 40 50 60 70 80 90 100
n
Reference Manual
14.2 Parallel DFT filterbank implementation 82
12
10 x0 (n)
y0 (n)
8 x1 (n)
y1 (n)
6
4
a[n]
2
0
−2
−4
−6
0 5 10 15 20 25 30 35 40 45 50
n
Reference Manual