ce 40763 digital signal processing fall 1992 optimal fir filter design
DESCRIPTION
CE 40763 Digital Signal Processing Fall 1992 Optimal FIR Filter Design. Hossein Sameti Department of Computer Engineering Sharif University of Technology. Optimal FIR filter design. Definition of generalized linear-phase (GLP): Let ’ s focus on Type I FIR filter:. It can be shown that. - PowerPoint PPT PresentationTRANSCRIPT
CE 40763Digital Signal Processing
Fall 1992
Optimal FIR Filter Design
Hossein SametiDepartment of Computer Engineering
Sharif University of Technology
Definition of generalized linear-phase (GLP):
Let’s focus on Type I FIR filter:
Optimal FIR filter design
2
)()()( jm eHH
)(),1()(),(12,0 LnNhnhoddLN
)()cos()()(0
GnnaHL
nm
• It can be shown that
0)(2)()()0(
nnLhnaLha
jeGH )()(
(L+1) unknown parameters a(n)
Hossein Sameti, Dept. of Computer Eng., Sharif University of Technology
Problem statement for optimal FIR filter design
3
p s
2
11
11
• Given 21,,, ps determine coefficients of G(ω) (i.e. a(n))
such that L is minimized (minimum length of the filter).
2 0
Hossein Sameti, Dept. of Computer Eng., Sharif University of Technology
G(ω) is a continuous function of ω and is as many times differentiable as we want.
How many local extrema (min/max) does G(ω) have in the range ?
In order to answer the above question, we have to write cos(ωn) as a sum of powers of cos(ω).
Observations on G(ω)
4
1)(cos2)2cos( 2
sin)2sin(cos)2cos()2cos()3cos(
cos3cos4)3cos( 3
)cos( n : sum of powers of cos(ω)
)()cos()()(0
GnnaHL
nm
],0[
Hossein Sameti, Dept. of Computer Eng., Sharif University of Technology
5
Observations on G(ω)in
iin
0)(cos)cos(
)()cos()()(0
GnnaHL
nm
])(cos)[()(0 0
L
n
in
iinaG
nL
nnG )(cos)()(
0
Find extrema
0)(
ddG
0)(sin)(cos)( 1
0
nL
nnn
0)(cos)()(sin 1
0
nL
nnn
Hossein Sameti, Dept. of Computer Eng., Sharif University of Technology
6
Observations on G(ω)0)(cos)()(sin 1
0
nL
nnn
0)(cos)(
or00sin1
0
nL
n
nn
xcos Polynomial of degree L-1
Maximum of L-1 real zeros
Max. total number of real zeros: L+1
Conclusion: The maximum number of real zeros for(derivative of the frequency response of type I FIR filter) is L+1, where (N is the number of taps). 2
1
NL
ddG )(
Hossein Sameti, Dept. of Computer Eng., Sharif University of Technology
Problem Statement for optimal FIR filter design
7
p s
2
11
11
• Given 21,,, ps determine coefficients of G(ω) (i.e. a(n))
such that L is minimized (minimum length of the filter).
Problem A Problem B Problem C
2 0 Problem A
Hossein Sameti, Dept. of Computer Eng., Sharif University of Technology
Problem B
8
• Given
determine coefficients of G(ω) (i.e. a(n)) such that
is minimized.
21,,, KLps
2
21,,, ps
2
1
KCompute Guess L
Algorithm B
'2),(' na
2?
'2
Increase L by 1
Decrease L by 1
Yes
Stop!
2'2 2
'2
9
Problem C
21 IIF
p s
1I 2I
],0[:1 pI ],[:2 sI
Define F as a union of closed intervals in ],0[
0
Hossein Sameti, Dept. of Computer Eng., Sharif University of Technology
10
Problem C)]()()[()( DGWE
where
2
1
1
1)(
I
IKW W is a positive weighting function
L
nnnaG
0)cos()()(
2
1
01
)(II
D Desired frequency response
Find a(n) to minimizeF
EMax
)( 21 IIF
(same assumption as Problem B)
We start by showing that
Problem C= Problem B?
11
2)(
F
EMax
)]()()[()( DGWE
)]()([)()( DG
WE
)()()()(
WEDG
Hossein Sameti, Dept. of Computer Eng., Sharif University of Technology
Problem C= Problem B?
12
p s
F
EMax )(By definition:
)(E
21 IIF
1I 2I
Hossein Sameti, Dept. of Computer Eng., Sharif University of Technology
Problem C= Problem B?
13
p
s
K
By definition:
K
)()(
WE
2
1
1
1)(
I
IKW
F
EMax )(
Hossein Sameti, Dept. of Computer Eng., Sharif University of Technology
Problem C= Problem B?
14
ps
K1
)()()()(
WEDG
2
1
01
)(II
D
K1
)(G
Hossein Sameti, Dept. of Computer Eng., Sharif University of Technology
Problem C= Problem B?
15
ps
K1
K1
p
2
11
11
)(G
2
1
K
2
in Problem C
)(G in Problem B
2s
Conclusion:
Problem C= Problem B?
16
Find a(n) such that is minimized.2Problem B:
Find a(n) such that is minimized.
Problem C:
Problem B= Problem C
Problem A= Problem C We now try to solve Problem C.
Hossein Sameti, Dept. of Computer Eng., Sharif University of Technology
Assumptions: F: union of closed intervals G(x) to be a polynomial of order L:
D = Desired function that is continuous in F. W= positive function
Alternation Theorem
17
L
k
kk xaxG
0)(
)]()()[()( xGxDxWxE
Fx
xEE
)(max
2
1
01
)(II
D
2
1
1
1)(
I
IKW
The necessary and sufficient conditions for G(x) to be unique Lth order polynomial that minimizes
is that E(x) exhibits at least L+2 alternations, i.e., there are at least L+2 values of x such that
18
Alternation Theorem
E
221 ... Lxxx
)(xE
E E E
E E E
for a polynomial of degree 4
𝑬 ( 𝒙𝒊 )=−𝑬 (𝒙 𝒊+𝟏 )=+¿−‖𝑬‖
Hossein Sameti, Dept. of Computer Eng., Sharif University of Technology
Number of alternations in the optimal case
19
• Recall G(ω) can have at most L+1 local extrema.
• According to the alternation theorem, G(ω) should have at least L+2 alternations(local extrema) in F.
Contradiction!?
1I2I
21 IIF
Number of alternations in the optimal case
20
• can also be alternation frequencies, although they are not local extrema.
ps ,
• G(ω) can have at most L+3 local extrema in F. 21 IIF
Ex: Polynomial of degree 7
Hossein Sameti, Dept. of Computer Eng., Sharif University of Technology
Number of alternations in the optimal case
21
According to the alternation theorem, we have at least L+2 alternations.
According to our current argument, we have at most L+3 local extrema.
Conclusion: we have either L+2 or L+3 alternations in F for the optimal case.
Hossein Sameti, Dept. of Computer Eng., Sharif University of Technology
22
Example: polynomial of degree 7
Extra-ripple case
Hossein Sameti, Dept. of Computer Eng., Sharif University of Technology
23
Example: polynomial of degree 7
Hossein Sameti, Dept. of Computer Eng., Sharif University of Technology
For Type I low-pass filters, alternations always occur at If not, we potentially lose two alternations.
Optimal Type I Lowpass Filters
24
ps ,
Hossein Sameti, Dept. of Computer Eng., Sharif University of Technology
Optimal Type I Lowpass Filters
25
,0Equi-ripple except possibly at
Hossein Sameti, Dept. of Computer Eng., Sharif University of Technology
Summary of observations
26
For optimal type I low-pass filters, alternations always occur at
If not, two alternations are lost and the filter is no longer optimal.
ps ,
Filter will be equi-ripple except possibly at ,0
Hossein Sameti, Dept. of Computer Eng., Sharif University of Technology
Parks-McClellan Algorithm (solving Problem C)
27
• Given determine coefficients of G(ω) (i.e. a(n))
such that is minimized. 221,,, KLps
2,...,2,1 Li
)()( 1 ii EE 1,...,2,1 Li
)]()()[()( GDWE
21)1()]()()[( i
iii GDW
2,...,2,1 Li)()(
)1()( 2
1
ii
i
i DW
G
At alternation frequencies, we have:
𝑬 (𝝎𝒊 )=+¿−𝜹𝟐
Hossein Sameti, Dept. of Computer Eng., Sharif University of Technology
28
Parks-McClellan Algorithm
L
nii nnaGEq
0)cos()()()1.(
)()(
)1()()2.( 21
ii
ii D
WGEq
)()(
)1()cos()( 2
1
0i
i
iL
ni D
Wnna
2,...,2,1 Li
Equating Eq.1 and Eq.2
Hossein Sameti, Dept. of Computer Eng., Sharif University of Technology
29
Parks-McClellan Algorithm
)()(
)1()cos()( 2
1
0i
i
iL
ni D
Wnna
2,...,2,1 Li
).cos()(....)2.cos()2()1.cos()1()0.cos()0(1 1111 LLaaaai
)()(
)1(1
1
211
DW
).cos()(....)2.cos()2()1.cos()1()0.cos()0(2 2222 LLaaaai
)()(
)1(2
2
212
DW
).cos()(....)2.cos()2()1.cos()1()0.cos()0(2 2222 LLaaaaLi LLL
)()(
)1(2
22
12
L
L
LD
W
30
Parks-McClellan Algorithm
)(
)1()0(
La
aa
)()1(
)()1(
)()1(
22
12
22
121
211
L
L
W
W
W
)(
)()(
2
2
1
LD
DD
L+2 linear equations and L+2 unknowns
BXA
Hossein Sameti, Dept. of Computer Eng., Sharif University of Technology
31
Parks-McClellan Algorithm
unknownsLna 1)(
unknown12
unknownsL 2
equationsLi 2
Hossein Sameti, Dept. of Computer Eng., Sharif University of Technology
Remez Exchange Algorithm
32
2),( na i
2
1
1
2
12
)()1(
)(
L
k k
kk
L
kkk
Wb
Db
2
1 coscos1L
kii ik
kb
It can be shown that if 's are known, then can be derived using the following formulae:
i 2
Hossein Sameti, Dept. of Computer Eng., Sharif University of Technology
Remez Exchange Algorithm
33
)(G
is an Lth-order trigonometric polynomial. We can interpolate a trigonometric polynomial through L+1 of the L+2 known values of or G. Using Lagrange interpolation formulae we can find the frequency response as:
Hossein Sameti, Dept. of Computer Eng., Sharif University of Technology
34
Now is available at any desired frequency, without the need to solve the set of equations for the coefficients of .
If for all in the passband and stopband, then the optimum approximation has been found. Otherwise, we must find a new set of extremal frequencies.
Remez Exchange Algorithm
Hossein Sameti, Dept. of Computer Eng., Sharif University of Technology
Flowchart of P&M
Algorithm
35
Example of type I LP filter before the optimum is found
36
Original alternation frequency
Next alternation frequency
Hossein Sameti, Dept. of Computer Eng., Sharif University of Technology
App. estimate of L:
App. Length of Kaiser filter:
Comparison with the Kaiser window
37
324.2
13)log(102 21LM
ps
2.2
81 AN 10log20A
• Example: 6.0,4.0 sp
001.0,01.0 21
• Optimal filter: 2712 LN
• Kaiser filter: 38N
Hossein Sameti, Dept. of Computer Eng., Sharif University of Technology
Demonstration
38
6.0,4.0 sp
001.0,01.0 21
26,10 MK
Does it meet the specs?
Hossein Sameti, Dept. of Computer Eng., Sharif University of Technology
Demonstration
39
Increase the length of the filter by 1.
6.0,4.0 sp
001.0,01.0 21
27,10 MK
Does it meet the specs?
Hossein Sameti, Dept. of Computer Eng., Sharif University of Technology