Lecture 16 FIR Design

Document Sample
Lecture 16 FIR Design Powered By Docstoc
					FIR Filter Design

   Chapter 12.8
    Lecture 16


                    1
               2 Types of Filters
• Finite Impulse Response (FIR)
  –   Easy to design                                  No poles:
  –   Always stable!                                  always stable
  –   Phase distortion is LINEAR
  –   Large and slow to implement
       • y[n] = b0x[n] + b1x[n-1] + ….+ bmx[n-m]
• Infinite Impulse Response (IIR)
  – Harder to design
  – Can be unstable
  – More efficient (faster)!
       • y[n] = -a1y[n-1] + …+ aNy[n-N] + b0x[n] + ….+ bmx[n-m]


                                                                      2
          Design an FIR LPF
• Start with Ideal Filter:



• Obtain the time domain impulse response




                                            3
4
• Now, let’s observe this filter in the time
  domain using MATLAB:
  – Let Ω1 = π/3




                                               5
                 MATLAB CODE
• close all
• clear all
•
• %note: we must truncate a sinc function! So, let's begin by
  observing the
• %function from n = -m:m for different values of m
•
• n = -10:10;
• h = sin(pi/3*n)./(pi*n);
• h(11) = 1/3;
• figure, stem(n, h)
• a = 1;
• figure, freqz(h, a)



                                                                6
                 Example
• Design a LPF-FIR filter if Ω1 = π/3, m = 10

                                fB = 0.3π
             0db in pass band               Ringing in stop band




                                                                   7
                  Example 2
• Design a LPF-FIR filter if Ω1 = π/3, m = 20
            Ringing in pass band (we’ll
            see this better in a bit)        More ringing in the stop band
                                          Steeper cut off
                  0db in pass band




                                                                        8
               Example 3
• Design a LPF-FIR filter if Ω1 = π/3, m = 50




                                                9
         Design a FIR BPF
• How do you think we could adjust the LPF
  into a BPF?




                                         10
                       Example
• Design a BPF-FIR filter if   •
                               •
                                   close all
                                   clear all
         Ω0 = 0.6π,            •
                               •   %note: we must truckate a sinc function! So, let's
         Ω1 = π/6,             •
                                   begin by observing the
                                   %function from n = -m:m for different values of m
         m = 20, 40, 100       •
                               •   n = -20:20;
                               •   h = (1./(pi.*n)).*(sin(pi/6.*n)).*(cos(0.6*pi.*n));
                               •   h(21) = 0.1667;
                               •   figure, stem(n, h)
                               •   a = 1;
                               •   figure, freqz(h, a)




                                                                                         11
         BPF with
Ω0 = 0.6π, Ω1 = π/6, m = 20




                              12
         BPF with
Ω0 = 0.6π, Ω1 = π/6, m = 40




                              13
         BPF with
Ω0 = 0.6π, Ω1 = π/6, m = 100




                               14
Design an FIR HPF
             •   n = -10:10;
             •   h=
                 (1./(pi.*n)).*(sin(2*pi/3.*n)).*(cos(pi.*n));
             •   h(11) = 2/3;
             •   figure, stem(h)
             •   a = 1;
             •   figure, freqz(h, a)




                                                    15
    HPF with
Ω1 = π/3, m = 10




                   16
         Improving FIR Filter
• Look again at LPF results




• What would we really like to see? Where
  does this problem come from?

                                            17
Improving FIR Filter: Ideal vs Real
• Ideal LPF



• Real LPF




• How do we improve?

                                  18
            Types of windows
• What if a more “gradual” window is used?
  – Triangle:



  – Von Hann (aka: the raised cosine window)



  – Hamming Window (an improved Von Hann Window)


                                               19
                Example
  Design a 51-term FIR LPF with Ω1=0.3π
Using a rectangular window:
    h[n] =

    h[0] =




                                          20
Rectangular Window




                     21
               Example
  Design a 51-term FIR LPF with Ω1=0.3π
Using a Triangular window
    h[n] =

    h[n] =




                                          22
Triangular Window




                    23
               Example
  Design a 51-term FIR LPF with Ω1=0.3π
Using a Von Hann window
    h[n] =

    h[n] =




                                          24
Von Hann Window




                  25
              Example
 Design a 51-term FIR LPF with Ω1=0.3π
Using a Hamming window
    h[n] =

    h[n] =




                                         26
Hamming Window




                 27
Closer comparison




                    28
Log Comparison




                 29

				
DOCUMENT INFO
Shared By:
Categories:
Tags:
Stats:
views:15
posted:10/1/2012
language:English
pages:29