Вы находитесь на странице: 1из 45

LTI Systems

h(n)

FIR IIR

Determine
coefficients of With rational transfer No rational transfer
h(n) [or P(z) function function
P( z )
and Q(z)] H ( z) 
P( z ) H ( z) 
Q( z ) Q( z )

Hossein Sameti, Dept. of Computer Eng.,


Sharif University of Technology 1
 Design Stages
1. Specifications  Application dependent
2. Design h(n)  Determine coefficients of h(n)
3. Realization  Direct form I,II, cascade and parallel
4. Implementation  Programming in Matlab/C, DSP,
ASIC,…
 Design of FIR filters
◦ Windowing

Hossein Sameti, Dept. of Computer Eng.,


Sharif University of Technology 2
 IDTFT of ideal low-pass filter:


1   c
X ( )  
0 c    

 c
x(n)  1  X ( )e jn d  1  e jn d
2 2
 c
1 jn c e jc n  e jc n sin c n
x(n)  [e ]c  x( n) 
j 2n j 2n n

Hossein Sameti, Dept. of Computer Eng.,


Sharif University of Technology 3
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 linear-
phase FIR filter.

Hossein Sameti, Dept. of Computer Eng.,


Sharif University of Technology 4
 Windows are designed with linear phase in mind
◦ Symmetric around M/2 w M  n 0  n  M
w  n  
 
 0 else
 So their Fourier transform are of the form

   
W e j  We e j e  j M / 2  
where We e j is a real and even

 Will keep symmetry properties of the desired impulse


response
 Assume symmetric desired response
   
H d e j  H e e j e  j M / 2
 With symmetric window 

 
Ae e j  
1
2  H e e   
j
W e e j   
d 

◦ Periodic convolution of real functions
Hossein Sameti, Dept. of Computer Eng.,
Sharif University of Technology 5
 The steps in the design of FIR filters using windows are
as follows:
1. Start with the desired frequency response  results in the
sinc function in time domain H d ( )
2. Compute IDTFT {H d ()}  hd (n)
3. Determine the appropriate window function w(n)
4. Calculate h(n)  hd (n)w(n)

A finite-length window
function

Hossein Sameti, Dept. of Computer Eng.,


Sharif University of Technology 6
 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 7
  c 

• First, we have to decide on the type of the filter.

• Assume Type I filter N 1


  0, N  odd,  
2
(linear-phase)

H d ()  H m ()e  j

Hossein Sameti, Dept. of Computer Eng.,


Sharif University of Technology 8
H d ()  H m ()e  j
1   c      c
H d ( )  
  c   0 otherwise

1   c      c
H m ( )  
 0 otherwise e  j   c      c
H d ( )  

    c      c 0 otherwise
H d ( )  
 0 otherwise

1  c  j jn


hd (n)  IDTFT {H d ( )}   e e d
2  c
(1) n 
hd (n)  sin(c (n   )) IIR filter
 (n   )
Hossein Sameti, Dept. of Computer Eng.,
Sharif University of Technology 9
h(n)  hd (n)w(n) 0.5
N 7
0.1 0.1

0 1 2 3 4 5 6
n

0.3 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 10
Hossein Sameti, ECE, UBC, Summer 2012
Originally Prepared by: Mehrdad Fatourechi, 11
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 12

 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 13
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
Ideal filter

M 1  N

Rectangular
Window
function
(Oppenheim and Schaffer, 2009)

Hossein Sameti, Dept. of Computer Eng.,


Sharif University of Technology 17
Pass-band: 0    p
Stop-band: s    
Pass-band ripple: 1   p

Stop-band ripple: 2  s

Transition width:    s   p
(Oppenheim and Schaffer, 2009)
• What is the ideal situation?

Hossein Sameti, Dept. of Computer Eng.,


Sharif University of Technology 18
20 log H ()

Hossein Sameti, Dept. of Computer Eng.,


Sharif University of Technology 19
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 20
• 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 21
• 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 22
• 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 23
• 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 24
Hossein Sameti, Dept. of Computer Eng.,
Sharif University of Technology 25
 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

1  e  j  M 1
   e
M
j  j n
W e 
n 0 1  e  j
 j M / 2
sin   M  1 / 2 
e
sin  / 2

Hossein Sameti, Dept. of Computer Eng.,


Sharif University of Technology 26
 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  
0 else

Hossein Sameti, Dept. of Computer Eng.,


Sharif University of Technology 27
 Medium main lobe
◦ 8/M

 Side lobes
◦ -25 dB

 Hamming window
performs better
 Simple equation

 2n / M 0 n M /2

w  n    2  2n / M M /2 n M

 0 else

Hossein Sameti, Dept. of Computer Eng.,


Sharif University of Technology 28
 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 29
 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 30
 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 31
rectangular Bartlett

Hanning
Hamming
Blackman

Hossein Sameti, Dept. of Computer Eng.,


Sharif University of Technology 32
 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 33
Hossein Sameti, Dept. of Computer Eng.,
Sharif University of Technology 34
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 35
  n    0.5
2

 I ([  (1    )] )
 0
  
w(n)   0nM
 I 0 ( )

0 otherwise

I 0 : Zeroth order modified Bessel function of the first kind


x2 x4 x6
I 0 ( x)  1  2 2  4 2
 6 2
 ...
2 (1!) 2 (2!) 2 (3!)

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 36
M=20

Hossein Sameti, Dept. of Computer Eng.,


Sharif University of Technology 37
 6

Hossein Sameti, Dept. of Computer Eng.,


Sharif University of Technology 38
Hossein Sameti, Dept. of Computer Eng.,
Sharif University of Technology 39
1. Calculate the transition bandwidth    s   p
2. Calculate A  20 log10

A8
3. Choose M  2 
2.285 

4. Choose

Hossein Sameti, Dept. of Computer Eng.,


Sharif University of Technology 40
Specs:  p  0.4

 s  0.6
 p  0.01

 s  0.001

Hossein Sameti, Dept. of Computer Eng.,


Sharif University of Technology 41
Specs:  p  0.4

 s  0.6
 p  0.01

 s  0.001

  0.001 A  20 log10  60

  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 42
Hossein Sameti, Dept. of Computer Eng.,
Sharif University of Technology 43
Q: Does it satisfy the specs?

Hossein Sameti, Dept. of Computer Eng.,


Sharif University of Technology 44
 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 45

Вам также может понравиться