Example: marketing

FIR Filters Chapter

ECE 2610 Signal and Systems5 1 FIR FiltersWith this Chapter we turn to systems as opposed to sig-nals. The systems discussed in this Chapter are finiteimpulse response (FIR) digital Filters . The term digital filter arises because these Filters operate ondiscrete-time signals The term finite impulse response arises because the filter out-put is computed as a weighted, finite term sum, of past, pres-ent, and perhaps future values of the filter input, ,( )where both and are finite One of the simplest FIR Filters we may consider is a 3 termmoving average filter of the form( ) An FIR filter is based on a feed-forward difference equationas demonstrated by ( ) Feed-forward means that there is no feedback of past orfuture outputs to form the present output, just input relatedterms Continuous-time Filters will be discussed in the circuits andsystems coursesyn bkxnk kM1 =M2 =M1M2yn 13---xn1+ xn xn1 ++ =Chapter5 Discrete-Time SystemsECE 2610 Signals and Systems5 2 Discrete-Time Systems A discrete-time system transforms or maps an input sequ

ECE 2610 Signal and Systems 5–1 FIR Filters With this chapter we turn to systems as opposed to sig-nals. The systems discussed in this chapter are finite

Tags:

  Chapter, Filter, Fir filters chapter, Fir filters

Information

Domain:

Source:

Link to this page:

Please notify us if you found a problem with this document:

Other abuse

Advertisement

Transcription of FIR Filters Chapter

1 ECE 2610 Signal and Systems5 1 FIR FiltersWith this Chapter we turn to systems as opposed to sig-nals. The systems discussed in this Chapter are finiteimpulse response (FIR) digital Filters . The term digital filter arises because these Filters operate ondiscrete-time signals The term finite impulse response arises because the filter out-put is computed as a weighted, finite term sum, of past, pres-ent, and perhaps future values of the filter input, ,( )where both and are finite One of the simplest FIR Filters we may consider is a 3 termmoving average filter of the form( ) An FIR filter is based on a feed-forward difference equationas demonstrated by ( ) Feed-forward means that there is no feedback of past orfuture outputs to form the present output, just input relatedterms Continuous-time Filters will be discussed in the circuits andsystems coursesyn bkxnk kM1 =M2 =M1M2yn 13---xn1+ xn xn1 ++ =Chapter5 Discrete-Time SystemsECE 2610 Signals and Systems5 2 Discrete-Time Systems A discrete-time system transforms or maps an input sequence(signal) into and output sequence (signal) via afunction or operation denoted as( ) Some examples are:The Running (Moving) Average filter A three-sample causal moving average filter is a special caseof ( ),( )which uses no future input values to compute the present out-put Note.

2 The term causal means that the present output, sayxn yn T xn yn yn Txn =yn xn 3=minxn xn1 xn2 =xn xn1 =12---xn xn1 + =yn 13---xn xn1 xn2 ++ =The Running (Moving) Average FilterECE 2610 Signals and Systems5 3, utilizes only past and present signal values (no futurevalues of the input) Consider a finite-length input sequence having support (non-zero values) over the interval For the 3 point causal moving average filter of ( )forms the output as( ) If we put this into a spreadsheet we could write formulas intothe cells that calculate the output sequence values as follows The output is can be calculated using MATLAB func-yn 1 n3 nxn 01 2 3 4-2-3-15-12464n0=y0 13---x0 x1 x2 ++ =13---21 0+ 13---642++ 123------4===yn The Running (Moving) Average FilterECE 2610 Signals and Systems5 4tions as follows>> n= -3:5;>> x = [0 0 -1 2 4 6 4 0 0]>> % We will learn about the filter function later>> y = filter (1/3*[1 1 1],1,x).

3 >> stem(n,y,'filled') The input/output relationship of ( ) is known as a differ-ence equation The action of the moving average filter has resulted in theoutput being smoother than the input Since only past and present values of the input are being usedto calculate the present output, this filtering operation canoperate in real-time A variation of the above 3-point averager is( )which can be termed a centralized averager, since the previ-ous input, the present input, the next input are used to formthe outputnyn 01 2 3 beyondn = 5yn 13---xn1+ xn xn1 ++ =The General FIR FilterECE 2610 Signals and Systems5 5 This system is noncausal and cannot be computed in real-time, since the future input would not be available Inside the spreadsheet we have the following: Notice that the output is the same as before, except it occursone sample index earlier To implement the causal filter we have to delay the outputby one sample How we position and choose the width of the averaging win-dow over the input signal are design choices What happens if we make the window wider?

4 The General FIR filter The class of causal FIR Filters has difference equation of theform( )PresentInput/OutputFuture Inputsrelative to n = 0relative to n = 0 Past Inputsrelative to n = 0yn bkxnk k0=M =The General FIR FilterECE 2610 Signals and Systems5 6 Note: When and , we havethe special case of the causal 3-point moving average filterof ( ) The text has defined the following terms regarding filteringwith an Mth order causal FIR filterExample: An FIR Suppose that and is as given inthe following spreadsheet table Fill-in the missing table entriesM2=b0b1b213 ===M4=bk 2 0123 =xn y3 2 4 03 12 21 30 ++++4 ==The General FIR FilterECE 2610 Signals and Systems5 7 Example: Filtering A Windowed Noise Sequence In this example we create an input sequence composed ofuniformly distributed random numbers for and zero otherwise The filter coefficients represent both 3-point and 7-point moving average Filters >> n = -5:50;>> x = [zeros(1,5), rand(1,41)-1/2, zeros(1,10)];>> y3 = filter (ones(1,3)/3,1,x);>> y7 = filter (ones(1,7)/7,1,x).

5 X12 12 0n40 bk 505101520253035404550 [n] 505101520253035404550 [n] 505101520253035404550 [n]Time Index (n)With a longer smoothingwindow the noise averageapproaches zeroThe General FIR FilterECE 2610 Signals and Systems5 8 The Unit Impulse ResponseThree interconnected concepts of this subsection are the unitimpulse sequence, the unit impulse response, and the Impulse Sequence: A sequence having a nonzero value of one only when itsargument is equal to zero, , ( ) The unit impulse sequence can be shifted right or left by inte-ger by writing( ) We can both time shift and amplitude scale the impulsesequence, such that a linear combination of them can be usedto form any sequence, , n n0= n 1,n0=0,n0 =n0 nn0 1,nn0=0,nn0 =n n 1230-1-2-3n n2 1230-1-2-311 The General FIR FilterECE 2610 Signals and Systems5 9( ) Each of the five scaled and time shifted impulses forms a sin-gle nonzero sample value of the complete sequence The generalization to the above is the ability to expand anysequence in this fashion, ,( )Unit Impulse Response Sequence.

6 When we input to an FIR filter the sequence ,the filter output (assuming the filter is initially at rest) is theunit impulse response, denoted 2 n 4 n1 6 n2 ++= 4 n3 2 n4 ++2 n 4 n1 6 n2 4 n3 2 n4 xn xn xk nk k = x1 n1+ x0 n ++= x1 n1 x2 n2 +++hn xn n =yn hn =The General FIR FilterECE 2610 Signals and Systems5 10 Note this definition holds for any discrete-time filter , not just FIR filtersExample: 3-Point Moving Average filter Impulse Response For this filter Using ( )( ) For a general FIR filter of ( ) we observe that( )Discrete-TimeFilter n hn bk13 13 13 =hn bk nk k0=2 =13--- nk k0=2 =13--- n n1 n2 ++ =nhn 1230-1-2-31/3bk13---13---13--- =hn bk nk k0=M =The General FIR FilterECE 2610 Signals and Systems5 11 Note in particular that the impulse response is finite, that isit extends over , hence the term finite impulseresponse (FIR) system is justifiedExample: Triangle Impulse Response( ) Evaluate point-by-point and plot, ,The Unit-Delay System.

7 When , corresponds to a systemimparting a unit delay A unit delay system is a special FIR filter where( )and the filter order is n0M M10=hn 6k5 nk k0=10 =6k5 k5=6=6k5 k4=5= 224681012n123456hn yn xnn0 =n01=yn xn1 =bk01 =M1=The General FIR FilterECE 2610 Signals and Systems5 12 The impulse response of a delay by system is( )Convolution and FIR Filters It can be shown (more on this later) that a general expressionof a filter s output can be expressed in terms of the impulseresponse and the input as( ) This formula has a special name: convolution sum formula We say that is the convolution of and Example: Convolution Using the Text Table Method Convolve with ,where both sequence start at and are nonzero for thevalues given012345670 24642000 003-1210 61218126000 000-2-4-6-4-20000 004812840 00 00024642 0061018161812820n0hn nn0 =yn hk xnk k0=M =yn xn hn xn 24642 =hn 31 21 =n0=nn0 n7 xn hn h0 xn h1 xn1 h2 xn2 h3 xn3 yn sum downThe General FIR FilterECE 2610 Signals and Systems5 13 We can check the answers using MATLAB s filter function>> n = 0:8;>> x = [2 4 6 4 2 0 0 0 0];>> h = [3 -1 2 1];>> y = filter (h,1,x).

8 >> yy = 6 10 18 16 18 12 8 2 0 Example: Convolution Using an Alternate Table Method In this example we consider another approach to performingconvolution of finite length sequences using a table Convolve and In the convolution sum formula we need to multiply thesequence by the sequence for a fixed/givenvalue of 012345678024681012141618 Index ny[n]xn 0123 =hn 1123 =hk xnk nThe General FIR FilterECE 2610 Signals and Systems5 14 What is relative to ? is flipped from left to right about is flipped and shifted by n Check by plugging into OK! Also plug into OK!yn hk xnk k0=M =kkM01 hk xnk multiply and addon the intervalwhere h[k] is nonzeroxnk xk xk xk k0=kk0n1n20n 1n 2xk xk xnk xk kk0n1n20nn1 nn 2xk xnk nn1 xnk xnnn1 xn1 =nn2 xnk xnnn2 xn2 =The General FIR FilterECE 2610 Signals and Systems5 15 Using the above view of the convolution sum, we obtain analternate table form for the convolution sum Check using MATLAB s filter function>> n = 0:7;>> x = [0 1 2 3 0 0 0 0];>> h = [1 1 2 3];>> y = filter (h,1,x).

9 >> y = 0 1 3 7 10 12 9 001234567024681012 Index ny[n]The General FIR FilterECE 2610 Signals and Systems5 16 Using MATLAB s filter Function We have been using the function filter () in the fewexamples, so how does it work?>> help filter filter One-dimensional digital filter . Y = filter (B,A,X) Filters the data in vector X with the filter described by vectors A and B to create the filtered data Y. The filter is a "Direct Form II Transposed" implementation of the standard difference equation: a(1)*y(n) = b(1)*x(n) + b(2)*x(n-1) + .. + b(nb+1)*x(n-nb) - a(2)*y(n-1) - .. - a(na+1)*y(n-na) If a(1) is not equal to 1, filter normalizes the filter coefficients by a(1).

10 [Y,Zf] = filter (B,A,X,Zi) gives access to initial and final conditions, Zi and Zf, of the delays. Zi is a vector of length MAX(LENGTH(A),LENGTH(B))-1, or an array with the leading dimension of size MAX(LENGTH(A),LENGTH(B))-1 and with remaining dimensions matching those of X. From the help listing we see that it simply evaluates a generaldifference equation of the form( ) At the present time ( Chapter 5) we do not have any feedbackterms in our difference equation, so and we assumethat , resulting in ( ) reducing to( )akynk k0=N bkxnk k0=M =N0=a01=yn bkxnk k0=M =The General FIR FilterECE 2610 Signals and Systems5 17 When using filter () to implement an FIR filter , we setthe vectors and Convolution in MATLAB We have seen how MATLAB s filter function can directlyevaluate (number crunch) a difference equation for a givenfilter coefficient set and input sequence Convolution between any two finite support (duration)


Related search queries