IIR and FIR Discrete Filters

Một phần của tài liệu Signals and systems using matlab (Trang 660 - 665)

CHAPTER 11 Introduction to the Design of Discrete Filters

11.2 Frequency-Selective Discrete Filters

11.2.2 IIR and FIR Discrete Filters

n A discrete filter with transfer function H(z)= B(z)

A(z)=

PM−1 m=0bmzm 1+PN−1

k=1 akzk = X∞ n=0

h[n]zn (11.7)

is calledinfinite-impulse responseorIIRsince its impulse responseh[n]typically has infinite length. It is also calledrecursivebecause if the input of the filterH(z)isx[n]andy[n]is its output, the input–output relationship is given by the difference equation

y[n]= − N−1

X

k=1

aky[nk]+ M−1

X

m=0

bmx[nm] (11.8)

where the output recurs on previous outputs (i.e., the output is fed back).

n The transfer function of afinite-impulse responseorFIRfilter is

H(z)=B(z)= M−1

X

m=0

bmzm (11.9)

Its impulse response ish[n]=bn,n=0,. . .,M−1, and zero elsewhere, thus of finite length. This filter is callednonrecursivegiven that the input–output relationship is given by

y[n]= M X

m=0

bmx[nm]=(bx)[n] (11.10) or the convolution sum of the filter coefficients (or impulse response) and the input.

For practical reasons, these filters are causal (i.e., h[n]=0 for n<0) and bounded-input bounded-output (BIBO) stable (i.e., all the poles ofH(z)must beinside the unit circle). This guaran- tees that the filter can be implemented and used in real-time processing, and that the output remains bounded when the input is bounded.

Remarks

n Calling the IIR filters recursive is more appropriate. It is possible to have a filter with a rational transfer function that does not have an infinite-length impulse response. However, it is traditional to refer to these filters as IIR.

n When comparing the IIR and the FIR filters, neither has a definite advantage:

n IIR filters are implemented more efficiently than FIR filters in terms of number of operations and required storage (having similar frequency responses, an IIR filter has fewer coefficients than an FIR filter).

n The implementation of an IIR filter using the difference equation resulting from its transfer function is simple and computationally efficient, but FIR filters can be implemented using the Fast Fourier Transform (FFT) algorithm, which is computationally very efficient.

n Since the transfer function of any FIR filter only has poles at the origin of the z-plane, FIR filters are always BIBO stable, but for an IIR filter we need to check that the poles of its transfer function (i.e., zeros of A(z)) are inside the unit circle if the design procedure does not guarantee stability.

n FIR filters can be designed to have linear phase, while IIR filters usually have nonlinear phase, but approximately linear phase in the passband region.

nExample 11.1

The phase of IIR filters is always nonlinear. Although it is possible to design FIR filters with linear phase, not all FIR filters have linear phase. As we will see, symmetry conditions on the impulse response of FIR filters are needed to have linear phase. Consider the following two filters with input–output equations

(a)y[n]=0.5y[n−1]+x[n]

(b)y[n]= 1

3 x[n−1]+x[n]+x[n+1]

wherex[n] is the input andy[n] is the output. Use MATLAB to compute and plot the magnitude and the phase response of each of these filters.

Solution

The transfer functions of the given filters are:

(a)H1(z)= 1 1−0.5z−1 (b)H2(z)= 1

3[z−1+1+z]= 1+z+z2

3z = (z−1ej2.09)(z−1ej2.09) 3z

11.2 Frequency-Selective Discrete Filters 645

|H2(ejω)| <H2(ejω)

0 1 2 3

0.5 1 1.5 2

ω

|H1(ejω)| <H1(ejω)

0 1 2 3

−0.6

−0.4

−0.2 0 0.2

ω

0 1 2 3

0 0.2 0.4 0.6 0.8 1

ω

0 1 2 3

−2 0 2 4

ω (a)

(b) FIGURE 11.4

Magnitude and phase responses of an IIR filter with a transfer function of (a)H1(z)=1/(1−0.5z−1), and of an FIR filter with a transfer function of (b)H2(z)=(z−1ej2.09)(z−1ej2.09)/3z. Notice the phase responses are nonlinear.

Thus, the first is an IIR filter and the second is an FIR filter (notice that this filter is noncausal as it requires future values of the input to compute the present output). The phase responses of these filters are clearly nonlinear. The transfer functionH2(z)has zeros on the unit circlez=1e±j2.09, making the phase of this filter not continuous and so it cannot be unwrapped. Figure 11.4 shows the magnitude and the phase responses of the filtersH1(z)andH2(z). n

nExample 11.2

A simple model for the multipath effect in the channel of a wireless system is y[n]=x[n]−αx[nN0] α=0.8, N0 =11

That is, the outputy[n] is a combination of the inputx[n] and of a delayed and attenuated version of the input. Determine the transfer function of the filter that gives the above input–output equa- tion. Use MATLAB to plot its magnitude and phase. If the phase is nonlinear, how would you recover the inputx[n] (which is the message)? Let the input bex[n]=2+cos(πn/4)+cos(πn). In practice, the delayN0and the attenuationαare not known at the receiver and need to be estimated.

What would happen if the delay is estimated to be 12 and the attenuation 0.79?

Solution

The transfer function of the filter with inputx[n] and outputy[n] is H(z)= Y(z)

X(z) =1−0.8z−11= z11−0.8 z11

with a pole ofz=0 of multiplicity 11, and zeros the roots ofz11−0.8=0, or zk=(0.8)1/11ejk/11 k=0,. . ., 10

Using thefreqzfunction to plot its magnitude and phase responses (see Figure 11.5), we find that the phase is nonlinear, and as such the output ofH(z),y[n], will not be a delayed version of the input. To recover the input, we use aninverse filter G(z)such that cascaded withH(z)the overall filter is an all-pass filter (i.e.,H(z)G(z)=1). Thus,

G(z)= z11 z11−0.8

The poles and zeros and the magnitude and the phase responses of H(z) are shown in Figure 11.5(a). The filters with transfer functionsH(z)andG(z) are calledcomb filters given the shape of their magnitude responses.

If the delay is estimated to be 11 and the attenuation 0.8, the input signalx[n] (the message) is recovered exactly; however, if we have slight variations on these values the message might not be recovered. When the delay is estimated to be 12 and the attenuation 0.79, the inverse filter is

G(z)= z12 z12−0.79

having the poles, zeros, and magnitude and phase responses shown in Figure 11.5(b). In Figure 11.5(c), the effect of these changes are illustrated. The output of the inverse filterz[n] does not resemble the sent signal x[n]. The signal y[n] is the output of the channel with a transfer

functionH(z). n

11.2 Frequency-Selective Discrete Filters 647

0 10 20 30 40 50 60 70 80 90 100

−10 0 10

x[n]

0 10 20 30 40 50 60 70 80 90 100

0 10 20 30 40 50 60 70 80 90 100

−10 0 10

y[n]

−10 0 10

n

n

n

z[n]

(c)

0 0.5 1

0 0.5 1 1.5

ω/π

|H(e)|

−1 0 1

−1

−0.5 0 0.5 1

11

Real part

Imaginary part

12

−1

−0.5 0 0.5 1

Imaginary part

−1 0 1

Real part

0 2 4

|G(e)|

0 0.5 1

ω/π

0 0.5 1

−1

−0.5 0 0.5 1

<G(e)

ω/π (b)

0 0.5 1

−1

−0.5 0 0.5 1

ω/π

<H(e)

(a)

FIGURE 11.5

(a) Poles and zeros and frequency response of the FIR comb filterH(z)=(z11−0.8)/z11, and (b) the estimated inverse IIR comb filterG(z)=z12/(z12−0.79). (c) The messagex[n]=2+cos(πn/4)+cos(πn), the output y[n]of channelH(z), and the outputz[n]of the estimated inverse filterG(z).

Một phần của tài liệu Signals and systems using matlab (Trang 660 - 665)

Tải bản đầy đủ (PDF)

(769 trang)