Finite Impuse Response Filters. Filters A filter is a system that processes a signal in some desired...

Post on 24-Dec-2015

222 views 0 download

Tags:

Transcript of Finite Impuse Response Filters. Filters A filter is a system that processes a signal in some desired...

Finite Impuse Response Filters

Filters

• A filter is a system that processes a signal in some desired fashion.– A continuous-time signal or continuous signal of

x(t) is a function of the continuous variable t. A continuous-time signal is often called an analog signal.

– A discrete-time signal or discrete signal x(kT) is defined only at discrete instances t=kT, where k is an integer and T is the uniform spacing or period between samples

Types of Filters

• There are two broad categories of filters:– An analog filter processes continuous-time signals

– A digital filter processes discrete-time signals.

• The analog or digital filters can be subdivided into four categories:– Lowpass Filters

– Highpass Filters

– Bandstop Filters

– Bandpass Filters

Ideal Filters

Passband Stopband Stopband Passband

Passband PassbandStopband

Lowpass Filter Highpass Filter

Bandstop Filter

PassbandStopband Stopband

Bandpass Filter

M()

M()

c c

c1 c1

c2 c2

Discrete-Time Signals

Discrete-TimeSystem

T{ }

x[n] y[n]=T{x[n]}

input output

The diagram suggests that the output sequence is related to the input sequence by a process that can be described mathematically by an operator T.

Moving Average Filter

A simple, but useful filter is the moving average filter. Assume we have the following inputs, x[n]:

2

4

6

A 3-point average for a finite-length signal of the values {x[0], x[1], x[2]} = {2, 4, 6} gives the answer ⅓ (2+4+6) = 4.

This value defines one of the output values.

The next output value is obtained by averaging {x[1], x[2], x[3]} = {4, 6, 4} that yields a value of 14/3.

y[0] = ⅓(x[0] + x[1] + x[2])

y[1] = ⅓ (x[1] + x[2] + x[3])

which generalizes to the following input-output equation

y[n] = ⅓ (x[n] + x[n+1] + x[n+2])

This equation is called a difference equation.

N N < -2 -2 -1 0 1 2 3 4 5 N > 5

x[n] 0 0 0 2 4 6 4 2 0 0

y[n] 0 3

2 2 4 14

3 4 2 3

2 0 0

For the triangular input, the result is the signal y[n] as tabulated below:

Note that the values bold type in the x[n] row are the numbers involved in the computation of y[2].

The output sequence is plotted below:

2

4

6

Note that the output sequence is longer than the input sequence and somewhat rounded.

In general, values from either the present or future or both can be used FIR filter calculations.

A filter that uses only the present and past values of the input is called a causal filter.

A filter that uses future values of the input is called a non-causal filter.

An alternative output indexing scheme can produce a filter that is causal.

213

1 nxnxnxny

N N < -2 -2 -1 0 1 2 3 4 5 6 7 N >7

x[n] 0 0 0 2 4 6 4 2 0 0 0 0

y[n] 0 0 0 3

2 2 4 14

3 4 2 3

2 0 0

For the previous problem, the output becomes:

Note that this form is simply a time-shifted form of the original form.

The General FIR Filter

The general form for the FIR filter is:

y n b x n kk

k

M

[ ]

0

Implementation of FIR Filters

Recall that the general form for the FIR filter is:

y n b x n kk

k

M

[ ]

0

The Unit Impulse

The unit impulse is perhaps the simplest sequence because it has only one non-zero value, which occurs at t = 0. The mathematical notation is:

00

01

n

nn1

The Shifted Impulse

1

k

The shifted impulse,[n-k], is non-zero when its argument is zero, i.e., n-k = 0, or when n = 0.

kn

knkn

0

1

The shifted impulse is a very useful concept for representing signals and systems. For example,

x n n n n n n[ ] [ ] [ ] [ ] [ ] [ ] 2 4 1 6 2 4 3 2 4

2

4

6

In order to implement this form, we need the following:

(1) a means of multiplying delayed-input signals by the filter coefficients;

(2) a means of adding the scaled sequence values;

(3) a means of obtaining delayed versions of the input sequence.

It is useful to represent these operations in block diagram form.

×x[n] y[n]

y[n] = x[n]

+

Multiplier

x1[n]

x2[n]y[n]

Adder

y[n] = x1[n] + x2[n]

x[n] y[n]

Delay

y[n] = x[n-1]

UnitDelay

Example: The FIR filter is completely defined once the set of filter coefficients {bk} is known. For example, if the {bk} are

then we have a length 4 filter with M = 3. This expands into a 4-point difference equation:

,1,2,1,3 kb

.322133

0

nxnxnxnxknxbnyk

k

To illustrate the utility of the results that we obtained, consider the cascade of two systems defined by:

The overall cascade system has the impulse response

otherwise

nnhand

otherwise

nnh

0

201

0

30121

nhnhnh 21

convolution

In the analog world, convolution is described by the equation:

dthtx )()(

Constant with respect to .

Rotated about the y-axis.

Moves along the x-axis.

In order to find the overall impulse response we must convolve h1[n] with h2[n].

Thus, the equivalent impulse response is

n 0 1 2 3 4 5

h_1[n] 1 1 1 1

h_2[n] 1 1 1

h_1[0] h_2[n] 1 1 1 1

h_1[1] h_2[n] 1 1 1 1

h_1[2] h_2[n] 1 1 1 1

h[n] 1 2 3 3 2 1

knbnhk

k

5

0

Thus, the equivalent impulse response is

where {bk} is the sequence {1, 2, 3, 3, 2, 1}.

This means that a system with impulse response h[n] can be implemented by the single difference equation

knbnhk

k

5

0

knxbnhk

k

5

0

Use convolution to compute the output y[n] for the length 4 filter that have the coefficients bk = {1, -2, 2, -1}. Use the input signal shown below.

Find the system function H(z) of a FIR filter whose impulse response is:

Find the system function H(z) of a FIR filter whose impulse response is:

Compuational structure for a first order FIR filter. (a) The equivalence between z-1 and the unit delay; (b) Block diagram for the first order filter whose difference equation is

y[n] = b0x[n] + b1x[n-1].

Draw a block diagram similar to (b) for the first difference system:

y[n] = (1- z-1 ){x[n]}.