Top Banner

of 30

Linear Phase Finite Impulse Response

Jun 02, 2018

Download

Documents

Hafizuddin Ali
Welcome message from author
This document is posted to help you gain knowledge. Please leave a comment to let me know what you think about it! Share it to your friends and learn new things together.
Transcript
  • 8/10/2019 Linear Phase Finite Impulse Response

    1/30

    1

    1. OBJECTIVES

    Design the Linear Phase Finite Impulse Response (FIR) Filter and a lowpass filter andbandpass filter through Window Design Technique of FIR

    2. COMPONENTS

    De!stop P" #atlab $ % with &ignal Processing Toolbo'

    3. THEORIES

    3.1. LINEAR PHASE FIR FILTER

    mong all the ob ious ad antages that digital filters offer* the FIR filter can guaranteelinear phase characteristics There are man+ commerciall+ a ailable software pac!agesfor filter design ,owe er* without basic theoretical !nowledge of the FIR filter* it will bedifficult to use them

    Filter coefficient !

  • 8/10/2019 Linear Phase Finite Impulse Response

    2/30

    2

    Filter tr"ct"re causal FIR filter whose impulse response is s+mmetrical is guaranteed to ha e alinear phase response (- en s+mmetr+ . /dd s+mmetr+)

    Frequenc+ Response of an FIR Filter

    To full+ designand implement a filter fi e steps are required0

    (1) Filter specification

    (2) "oefficient calculation(%) &tructure selection(3) &imulation (optional)($) Implementation

    There are se eral different methods a ailable* the most popular are0

    Window method

    Frequenc+ samplingPar!s4#c"lellan

    We will 5ust consider the window method

    Linear phase is a one t+pe of a filter Filter need to modif+ a signal6s magnitude4spectrum when preser ing the signal6s time4domain wa eform as much as possible Thislinear phase filter can be di ided into four t+pe of FIR0

    s+mmetric sequence of odd length s+mmetric sequence of e en length

  • 8/10/2019 Linear Phase Finite Impulse Response

    3/30

    3

    anti4s+mmetric sequence of odd length anti4s+mmetric sequence of e en length

    There are four possible situation0 filter length e en or odd* and impulse response iseither s+mmetric or antis+mmetric 0

    FI#$RE 2.%

    3.2. FIR I AN& FIR II T'PE

    The s+mmetric coefficients shown that the frequenc+ responses are of the

    following form0

    FIR I (# is e en* sequence is s+mmetric and of odd length)

    ,owe er* this s+stem has linear phase (the quantit+ inside the parenthesis is a realquantit+) and the phase dela+ is #72 samples

  • 8/10/2019 Linear Phase Finite Impulse Response

    4/30

    4

    8 FIR II (# is odd* the sequence is s+mmetric and of e en length)

    9otethat this of the form,(:) ; e4 5

  • 8/10/2019 Linear Phase Finite Impulse Response

    5/30

    5

    ,owe er* this s+stem has linear phase (the quantit+ inside the parenthesis is a realquantit+) and the phase dela+ is #72 samples

    8 FIR II (# is odd* the sequence is s+mmetric and of e en length)

    9otethat this of the form,(:) ; e4 5

  • 8/10/2019 Linear Phase Finite Impulse Response

    6/30

    6

    ,(:) ; e45

  • 8/10/2019 Linear Phase Finite Impulse Response

    7/30

    7

    ). RES$LTS

    P*rt A

    Properties of Linear4Phase Finite Impulse Response (FIR) Filters

    T+,e-1 FIR Filter

    # TL H script0

    function [Hr,w,a,L] = Hr_Type1(h !" #o$pute% &$p'itu e re%pon%e Hr(w of a Type)1 L* + - fi'ter " )))))))))))))))))))))))))))))))))))))))))))))))))))))))))))" [Hr,w,a,L] = Hr_Type1(h" Hr = &$p'itu e -e%pon%e

    " w = 5.. fre/uencie% 0etween [. pi] o er which Hr i% co$pute" a = Type)1 L* fi'ter coefficient%" L = r er of Hr " h = Type)1 L* fi'ter i$pu'%e re%pon%e

    = 'en th(h ! L = ( )1 2!a = [h(L 1 2 h(L8)181 ]! " 19(L 1 row ector n = [.818L]! " (L 1 91 co'u$n ector w = [.8185..]: pi 5..!Hr = co%(w n a:!

    ;;h = [)4 1 )1 )2 5 6 5 )2 )1 1 )4]

    h =

    )4 1 )1 )2 5 6 5 )2 )1 1 )4

    ;; = 'en th(h ! n = .8 )1

    n =

    0 1 2 3 4 5 6 7 8 9 10

    ;;[Hr,w,a,L] = Hr_Type1(h !;;a,L

    a =

    6 10 -4 -2 2 -8

    L =

    5

    ;;a$a9 = $a9(a 1! a$in = $in(a )1!;;%u0p'ot(2,2,1 ! %te$(n,h ! a9i%([)1 2 L 1 a$in a$a9];;9'a0e'( :n: ! y'a0e'( :h(n : ! tit'e(: $pu'%e -e%pon%e:;;%u0p'ot(2,2,3 ! %te$(.8L,a ! a9i%([)1 2 L 1 a$in a$a9];;9'a0e'( :n: ! y'a0e'( :a(n : ! tit'e(:a(n coefficient%:;;%u0p'ot(2,2,2 ! p'ot(w pi,Hr ! ri

  • 8/10/2019 Linear Phase Finite Impulse Response

    8/30

    > M = 21; alpha = (M-1) 2; n = 0!M-1

    n = "#l$%ns 1 &h'#$ h 16

    0 1 2 3 4 5 6 7 8 9 10 1112 13 14 15

    "#l$%ns 17 &h'#$ h 21

    16 17 18 19 20

    >> hd = (c#s(p *(n-alpha))). (n-alpha); hd(alpha+1)=0;>> , ha% = (ha%% n (M)) ; h = hd .* , ha%; / ' , L = ' p 3(h);

    >> s$bpl#&(2 2 1); s& %(n hd); & &l ( d al %p$ls R sp#ns )>> a s(/-1 M -1.2 1.2 ); lab l( n ); lab l( hd(n) )>> s$bpl#&(2 2 2); s& %(n , ha%);& &l ( a%% n nd#, )>> a s(/-1 M 0 1.2 ); lab l( n ); lab l( ,(n) )>> s$bpl#&(2 2 3); s& %(n h);& &l ( Ac&$al %p$ls R sp#ns )>> a s(/-1 M -1.2 1.2 ); lab l( n ); lab l( h(n) )>> s$bpl#&(2 2 4);pl#&(, p ' p ); & &l ( A%pl &$d R sp#ns ); ' d;>> lab l( :' $ nc n p $n &s ); lab l( sl#p n p $n &s ); a s(/01 0 1 );

  • 8/10/2019 Linear Phase Finite Impulse Response

    20/30

    2.

    /utput &imulation0

    0 2 4 6 8 10 12 14 16 18 20

    -1

    -0.5

    0

    0.5

    1

    Ideal Impulse Response

    n

    h d ( n )

    0 2 4 6 8 10 12 14 16 18 20

    -1

    -0.5

    0

    0.5

    1

    Actual Impulse R esponse

    n

    h ( n )

  • 8/10/2019 Linear Phase Finite Impulse Response

    21/30

    21

    . &ISC$SSIONS

    .1. PART 1 / TYPE 1 - TYPE 4 LINEAR FIR FILTER)

    6.1.1. MATLAB COMMANDS

    n or er to et the wante output, %o$e at'a0 co$$an which corre%pon in the + - e/uation

    are entere into at'a0 to 0e proce%%e A There are inc'u in %o$e con%tant% an aria0'e%A

    Be'ow are con%tant% which 0een u%e in *art 1 e$on%tration%8

    GL i% or er of HrA GL i% written a%, L = ( )1 2A

    Gw i% fre/uencie% 0etween [., pi] o er which Hr i% co$pute A Gw i% w = [.8185..] G pi 5..A

    Gn written a% n = [.818L]

    Type-1 FIR Filters

    +or type Hr, e/uation u%e i%, Hr = co% (w n a , where, a = [h(L 1 2 h(L8)181 ]A

  • 8/10/2019 Linear Phase Finite Impulse Response

    22/30

    22

    Type- FIR Filters

    +or type Hr, e/uation u%e i%, Hr = co% (w n 0 , where, 0 = 2 [h(L8)181 ]A

    Type-! FIR Filters

    +or type Hr, e/uation u%e i%, Hr = %in (w n c , where, c = [ 2 h (L 18 )1 8 1 ]A

    Type-4 FIR Filters

    +or type Hr, e/uation u%e i%, Hr = %in (w n , where, = 2 [h(L8 )181 ]A

    6.1. O"TP"T #RAP$S

    +ro$ raph enerate 0y at'a0, there are no re%triction% on Hr(w either w=. or w=piA Fy%te$

    po'e% %how% that there are three (3 po'e% on the ri ht of rea' part, one 9 p'ane whi'e the other

    two %y$$etrica''y near y p'aneA n the ne ati e %i e of rea' part, there are two $ore po'e%

    on the 9)p'aneA Fince po'e% pre%ent on the po%iti e %i e of rea' part, %y%te$ i% not %ta0'eA Ie

    cannot ana'y?e ?ero% 0ecau%e error in co in A t %how% that we were $i%%in 'i0rary to

    enerate ?ero co in A

    +ro$ the p'ot%, Hr(w i% ?ero at w = piA *o'e% coor ination i% %a$e a% + - +i'ter% type)1 e9cept

    that on the ne ati e %i e of rea' part, in%tea of the po'e% p'ace on 9)p'ane, po'e% f'oatin up to

    .A5 an to ).A5A Fy%te$ a'%o un%ta0'eA

    +ro$ the p'ot%, Hr(w = . at w = . an w = piA *o'e% coor ination are %a$e with + - +i'ter%Type)3A

    +ro$ p'ot%, it can 0e o0%er e that Hr(w i% ?ero at w = .A The po'e% pattern are %a$e with

    Type)2 an Type)3A

    .2. PART

    +or the %econ part of the 'a0, we were a%Ee to con%truct a i ita' 0an pa%% + - fi'ter u%in the

  • 8/10/2019 Linear Phase Finite Impulse Response

    23/30

    23

    fo''owin %pecification%!

    Be'ow i% the i$a e of the i ita' 0an pa%% fi'ter that $u%t 0e pro uce A Jotice that the hi h'i hte

    one% are the %e'ecte 0an pa%% fi'ter 0a%e on the re/uire$ent% i en a0o eA

    To o thi%, we nee to i entify which

    win ow e%i n to 0e u%e A +ir%t, we nee to $ea%ure the 0an wi th of the 0an %A The two tran%ition

    0an %, an $u%t 0e the %a$e in the win ow e%i n (there i% no in epen ent contro' o er an A +or

    , we can u%e the B'acE$an win owA

    B'acE$an win ow e%i n u%e% the %a$e function of Hann win ow an Ha$$in win ow, e9cept it

    contain% a %econ har$onic ter$ i en a% fo''ow%!

    dB A

    dBR

    dBR

    dB A

    ss

    p p

    p p

    ss

    60 8.0 :edgestopbandupper

    1 65.0 :edgepassbandupper

    1 35.0 :edgepassbandlower

    60 2.0 :edgestopbandlower

    2

    2

    1

    1

    ==

    ==

    ==

    ==

    s p 111 = s p 222 = 1 2

    == 21

  • 8/10/2019 Linear Phase Finite Impulse Response

    24/30

    24

    ( )

    +

    =

    otherwise;0

    10;1

    4cos08.0

    12

    cos5.042.0 MnM

    nM

    nn

  • 8/10/2019 Linear Phase Finite Impulse Response

    25/30

    25

    Ie a'%o nee the i ea' 0an pa%% fi'ter i$pu'%e re%pon%e function, A Therefore, the

    &TL&B routine d al lp(,c M) i% %ufficient to eter$ine the i$pu'%e re%pon%e of an i ea'

    0an pa%% fi'terA Ie a'%o inc'u e the $o ifie function of the fre/uency) o$ain p'ot% or :' < % ,

    which return% the $a nitu e re%pon%e in a0%o'ute a% we'' a% in re'ati e B %ca'e, the pha%e re%pon%e an

    the roup e'ay re%pon%eA

    Ba%e on the re/uire$ent% i en, u%in the co$$an win ow of &TL&B, the fo''owin %trin of

    co e are entere %o that it ec'are the po%ition or the e9act 0an wi th of the 0an pa%% fi'ter8

    w%1 = .A2 pi! wp1 = .A35 pi! wp2 = .A65 pi! w%2 = .A< pi! &% = 6.!

    Je9t, the tran%ition wi th i% ca'cu'ate 0y fin in the $ini$u$ ifference 0etween an !

    tr_wi th = $in((wp1)w%1 ,(w%2)wp2 !

    Fu$$ary of co$$on'y u%e win ow function characteri%tic%A

    WindowNa e

    !ransition Width" #in. $topband%ttenuation%ppro&i ate '&act (alues

    )ectangular 21 d*

    *artlett 25 d*

    +anning 44 d*

    +a ing 53 d**lac, an -4 d*

    Je9t, fin the a'ue of fi'ter 'en th, M for the tran%itiona' wi th, (thi% i% eci e fro$ the

    %u$$ary ta0'e i en a0o e u%in the e9act a'ue% ,

    = cei'(11 pi tr_wi th 1

    ( )nhd

    p s

    4

    M

    1.8 M

    8

    M

    6.1 M

    8

    M

    6.2 M

    8

    M

    6.6 M

    12 M

    11 M

  • 8/10/2019 Linear Phase Finite Impulse Response

    26/30

    26

    which return% the fo''owin re%u't% fro$ the &TL&B output co$$an !

    M =

    75

    Je9t, entere the center fre/uency of the 0an pa%% fi'ter i en a% fo''ow%!

    n = [.818 )1]!

    wc1 = (w%1 wp1 2! wc2 = (wp2 w%2 2!

    Then, we entere the i ea' 0an pa%% fi'ter functionA Fince there are two ifferent center fre/uency, the

    a'ue of hd i% ca'cu'ate a% fo''ow%!

    h = i ea'_'p(wc2, ) i ea'_'p(wc1, !

    The a'ue% of hd wi'' %tore the attache a'ue of nu$0er of pu'%e%, n i en a0o eA

    Je9t, run the B'acE$an win ow a% blac %an(M) an $u'tip'ie with the i en hd , an %tore in

    h A

    w_0'a = (0'acE$an( :!

    h = h A w_0'a!

    The function of :' < % i% u%e in thi% ti$e with the %tore a'ue of the pre iou% h A

    [ 0,$a ,pha, r ,w] = fre/?_$(h,[1] !

    i% i en 0y the efau't for$u'a a% !

    e'ta_w =2 pi 1...!

    100

    2

  • 8/10/2019 Linear Phase Finite Impulse Response

    27/30

    27

    Then, fina''y we o0taine the actua' 0an pa%% ripp'e, R p an $ini$u$ %top0an attenuation, A sA The%e

    are i en 0y the for$u'a a% fo''ow%!

    -p = )$in( 0(wp1 e'ta_w 1818wp2 e'ta_w

    &% = )roun ($a9( 0(w%2 e'ta_w 18185.1

    which co$e% the re%u't% a% fo''ow%!

    Rp =

    0.0030

    As =

    75

    Then, to con%truct the fo''owin output %i$u'ation, the fo''owin %trin co e of &TL&B co$$an

    i% inputte a% fo''ow%!

    %u0p'ot(2,2,1 ! %te$(n,h ! tit'e(: ea' $pu'%e -e%pon%e:

    a9i%([. )1 ).A4 .A5] ! 9'a0e'( :n: ! y'a0e'( :h (n :

    %u0p'ot(2,2,2 ! %te$(n,w_0'a ! tit'e( :B'acE$an Iin ow:

    a9i%([. )1 . 1A1] ! 9'a0e'( :n: ! y'a0e'( :w(n :

    %u0p'ot(2,2,3 ! %te$(n,h ! tit'e( :&ctua' $pu'%e -e%pon%e:

    a9i%([. )1 ).A4 .A5] ! 9'a0e'( :n: ! y'a0e'( :h(n :

    %u0p'ot(2,2,4 ! p'ot(w pi, 0 ! a9i%([. 1 )15. 1.] !

    ( )

    ( )1 01

    log20

    0 011log20

    1

    210

    1

    110

    >>>+=

    >+=

    s

    p

    A

    R

  • 8/10/2019 Linear Phase Finite Impulse Response

    28/30

    2