Lecture07_FIR.pptx

advertisement
Hossein Sameti
Department of Computer Engineering
Sharif University of Technology
LTI Systems
h(n)
FIR
Determine
coefficients of
h(n) [or P(z)
and Q(z)]
IIR
With rational transfer
function
P( z )
H ( z) 
Q( z )
No rational transfer
function
H ( z) 
P( z )
Q( z )
Hossein Sameti, Dept. of Computer Eng.,
Sharif University of Technology
2
Design Stages

1.
2.
3.
4.
Specifications  Application dependent
Design h(n)  Determine coefficients of h(n)
Realization  Direct form I,II, cascade and parallel
Implementation  Programming in Matlab/C, DSP,
ASIC,…
Design of FIR filters

◦
Windowing
Hossein Sameti, Dept. of Computer Eng.,
Sharif University of Technology
3

IDTFT of ideal low-pass filter:

  c
1
X ( )  

0 c    

c
x(n)  1  X ( )e jn d  1  e jn d
2
2

c
1
e jc n  e jc n
jn c
x ( n) 
[e ]c 
j 2n
j 2n
x ( n) 
sin c n
n
Hossein Sameti, Dept. of Computer Eng.,
Sharif University of Technology
4
Multiply by a
rectangular window
• It can be shown that if we have a linear-phase ideal filter and we
multiply it by a symmetric window function, we end up with a linearphase FIR filter.
Hossein Sameti, Dept. of Computer Eng.,
Sharif University of Technology
5


Windows are designed with linear phase in mind
◦ Symmetric around M/2
w M  n 0  n  M
 



0
So their Fourier transform are of the form
 
W e j  We e j e  j M / 2


w  n  

else
 
where We e j is a real and even
Will keep symmetry properties of the desired impulse
response
Assume symmetric desired response
With symmetric window
 
 
H d e j  H e e j e  j M / 2
 
Ae e j 
1

2

  

j   
j
H
e
W
e
d
e
e


◦ Periodic convolution of real functions
Hossein Sameti, Dept. of Computer Eng.,
Sharif University of Technology
6

The steps in the design of FIR filters using windows are
as follows:
1.
2.
3.
4.
Start with the desired frequency response  results in the
H d ( )
sinc function in time domain
Compute IDTFT {H d ( )}  hd (n)
Determine the appropriate window function w(n)
Calculate h(n)  hd (n) w(n)
A finite-length window
function
Hossein Sameti, Dept. of Computer Eng.,
Sharif University of Technology
7
Two properties should be considered:
 1) The amplitude is unity in the pass band and
it is zero in the stop band: H m ( )
 2) The phase is linear: H ( )    

j
(



)
H d ( )  H m ( )e
Hossein Sameti, Dept. of Computer Eng.,
Sharif University of Technology
8
  c

• First, we have to decide on the type of the filter.
• Assume Type I filter
(linear-phase)
  0, N  odd ,  
N 1
2
H d ()  H m ()e  j
Hossein Sameti, Dept. of Computer Eng.,
Sharif University of Technology
9
H d ()  H m ()e  j
  c

1   c      c
H m ( )  
0 otherwise

    c      c
H d ( )  
0 otherwise

1   c      c
H d ( )  
0 otherwise

e  j   c      c
H d ( )  

0 otherwise
1    j jn
hd (n)  IDTFT {H d ( )} 
e d
 e
2  
c
c
(1) n 
hd (n) 
sin(c (n   ))
 (n   )
IIR filter
Hossein Sameti, Dept. of Computer Eng.,
Sharif University of Technology
10
h(n)  hd (n)w(n)
0.5
N 7
0.1
0.1
0
1
2 3
0.3
4
5
6
n
0.3
• It is a high-pass FIR filter with 7 taps that approximates
the high-pass IIR filter.
• How can we quickly check that the resulting FIR filter has
the desired properties that we were looking for? (i.e., it is a
high-pass linear-phase filter)?
Hossein Sameti, Dept. of Computer Eng.,
Sharif University of Technology
11
Hossein Sameti, ECE, UBC, Summer 2012
Originally Prepared by: Mehrdad Fatourechi,
12
h(n)  hd (n)w(n)
H ( )  H d ( ) *W ( )
• What condition should we impose on W(ω) so that H (ω)
looks like Hd(ω) ?
• Impulse function in the frequency domain, means an
infinitely-long constant in the time-domain
• Larger window means more computation
Hossein Sameti, Dept. of Computer Eng.,
Sharif University of Technology
13

Windowed frequency response H  e j 
1

2



  

H d e j W e j    d

The windowed version is smeared version of desired
response

If w[n]=1 for all n, then W(ej) is pulse train with 2 period
Hossein Sameti, Dept. of Computer Eng.,
Sharif University of Technology
14
Hossein Sameti, Dept. of Computer Eng.,
Sharif University of Technology
15
Hossein Sameti, Dept. of Computer Eng.,
Sharif University of Technology
16
Hossein Sameti, Dept. of Computer Eng.,
Sharif University of Technology
17
Ideal filter
M 1  N
Rectangular
Window
function
(Oppenheim and Schaffer, 2009)
Hossein Sameti, Dept. of Computer Eng.,
Sharif University of Technology
18
Pass-band:
Stop-band:
0    p
s    
Pass-band ripple:
1   p
Stop-band ripple:
2  s
Transition width:    s   p
• What is the ideal situation?
(Oppenheim and Schaffer, 2009)
Hossein Sameti, Dept. of Computer Eng.,
Sharif University of Technology
19
20 log H ()
Hossein Sameti, Dept. of Computer Eng.,
Sharif University of Technology
20
Width of transition is
not sharp!
• The width of transition depends on
the width of the main lobe of the
window.
• Ripples in the passband / stopband
are proportional to the peaks of side
lobes of the window.
Hossein Sameti, Dept. of Computer Eng.,
Sharif University of Technology
21
• Q: How can we control the transition width (size of the
main lobe)?
• A1: using the size of the window
Uncertainty principle
Hossein Sameti, Dept. of Computer Eng.,
Sharif University of Technology
22
• Q: How can we control the size of transition width
(size of the main lobe)?
• A2: Shape of the window; in other words, windows
with a fixed size that have different shapes can have
different main lobe width.
• Rectangular window Smallest; and Blackman
largest main lobe width
Hossein Sameti, Dept. of Computer Eng.,
Sharif University of Technology
23
• Q: How can we control the peak of the side lobes so
that we can get a good ripple behavior in the FIR filter?
• A: using the shape of the window
Hossein Sameti, Dept. of Computer Eng.,
Sharif University of Technology
24
• Q: Can we control the peak of the side lobes by
changing the size of the window?
• A: It can be shown that changes are not significant.
Hossein Sameti, Dept. of Computer Eng.,
Sharif University of Technology
25
Hossein Sameti, Dept. of Computer Eng.,
Sharif University of Technology
26

Prefer windows that concentrate around DC in frequency
◦ Less smearing, closer approximation

Prefer window that has minimal span in time
◦ Less coefficient in designed filter, computationally efficient

So we want concentration in time and in frequency
◦ Contradictory requirements

Example: Rectangular window
   e
W e
j
M
n 0
e
 j M / 2
 j n
1  e  j  M 1

1  e  j
sin   M  1 / 2 
sin  / 2
Hossein Sameti, Dept. of Computer Eng.,
Sharif University of Technology
27

Narrowest main lobe
◦ 4/(M+1)
◦ Sharpest transitions at
discontinuities in frequency

Large side lobes
◦ -13 dB
◦ Large oscillation around
discontinuities

Simplest window possible
1 0  n  M
w  n  
else
0
Hossein Sameti, Dept. of Computer Eng.,
Sharif University of Technology
28

Medium main lobe
◦ 8/M

Side lobes
◦ -25 dB


Hamming window
performs better
Simple equation
 2n / M

w  n    2  2n / M

0

0 n M /2
M /2 n M
else
Hossein Sameti, Dept. of Computer Eng.,
Sharif University of Technology
29

Medium main lobe
◦ 8/M

Side lobes
◦ -31 dB


Hamming window
performs better
Same complexity as
Hamming
1 
 2 n  
 1  cos 
 0  n  M
w  n   2 
M



0
else

Hossein Sameti, Dept. of Computer Eng.,
Sharif University of Technology
30

Medium main lobe
◦ 8/M

Good side lobes
◦ -41 dB

Simpler than Blackman

 2 n 
0.54

0.46
cos
0nM



w  n  
 M 

0
else

Hossein Sameti, Dept. of Computer Eng.,
Sharif University of Technology
31

Large main lobe
◦ 12/M

Very good side lobes
◦ -57 dB

Complex equation

 2 n 
0.42

0.5cos



 M 

0nM
w  n  
 4 n 
0.08cos



M 


0
else

Hossein Sameti, Dept. of Computer Eng.,
Sharif University of Technology
32
rectangular
Hanning
Bartlett
Hamming
Blackman
Hossein Sameti, Dept. of Computer Eng.,
Sharif University of Technology
33



Approximation Error, defined in passband and
stopband.
1−𝐴 𝜔
𝑖𝑛 𝑡ℎ𝑒 𝑝𝑎𝑠𝑠𝑏𝑎𝑛𝑑
𝐸𝐴 𝜔 =
0−𝐴 𝜔
𝑖𝑛 𝑡ℎ𝑒 𝑠𝑡𝑜𝑝𝑏𝑎𝑛𝑑
Peake Approximation Error is the maximum value of
𝐸𝐴 𝜔
Hossein Sameti, Dept. of Computer Eng.,
Sharif University of Technology
34
Hossein Sameti, Dept. of Computer Eng.,
Sharif University of Technology
35
Main lobe
Shape of
width of the
Main lobe
the window
window
Side lobe
Good design strategy:
1) Use shape to control the behavior of the side lobe.
2) Use width to control the behavior of the main lobe.
Hossein Sameti, Dept. of Computer Eng.,
Sharif University of Technology
36
2

 n    0.5
I
([

(
1


 )] )

0

  
w(n)  
I 0 ( )


otherwise
0
0nM
I 0 : Zeroth order modified Bessel function of the first kind
x2
x4
x6
I 0 ( x)  1  2 2  4

 ...
2 (1!)
2 (2!) 2 2 6 (3!) 2
M 1:
:
Number of taps
2  M
Parameter to control the shape of the Kaiser window and thus
the trade-off between the width of the main lobe and the peak
of the side lobe.
Hossein Sameti, Dept. of Computer Eng.,
Sharif University of Technology
37
M=20
Hossein Sameti, Dept. of Computer Eng.,
Sharif University of Technology
38
 6
Hossein Sameti, Dept. of Computer Eng.,
Sharif University of Technology
39
Hossein Sameti, Dept. of Computer Eng.,
Sharif University of Technology
40
1.
2.
Calculate the transition bandwidth

Calculate A  20 log10
3.
Choose
4.
Choose
   s   p
A8
M  2 
2.285 
Hossein Sameti, Dept. of Computer Eng.,
Sharif University of Technology
41
Specs:  p  0.4
 s  0.6
 p  0.01
 s  0.001
Hossein Sameti, Dept. of Computer Eng.,
Sharif University of Technology
42
Specs:  p  0.4
 s  0.6
 p  0.01
 s  0.001

A  20 log10
 60
  0.001
  5.563
  0.2
M  37
Type II
filter
Use Bessel equation to get w(n)
Hossein Sameti, Dept. of Computer Eng.,
Sharif University of Technology
43
Hossein Sameti, Dept. of Computer Eng.,
Sharif University of Technology
44
Q: Does it satisfy the specs?
Hossein Sameti, Dept. of Computer Eng.,
Sharif University of Technology
45


Windowing method is a fast and efficient solution to
design FIR filters.
Using Kaiser windows, the window can be chosen
automatically.
Hossein Sameti, Dept. of Computer Eng.,
Sharif University of Technology
46
Download