Convolution Sum and Transfer Function

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

The most important property of the Z-transform, as it was for the Laplace transform, is the convolution property.

The outputy[n]of a causal LTI system is computed using the convolution sum

y[n]=[xh][n]= n X k=0

x[k]h[nk]= n X k=0

h[k]x[nk] (9.19)

wherex[n]is a causal input andh[n]is the impulse response of the system. The Z-transform ofy[n]is the product

Y(z)=Z{[xh][n]} =Z{x[n]}Z{h[n]} =X(z)H(z) (9.20)

and the transfer function of the system is thus defined as H(z)= Y(z)

X(z) = Z[output y[n]]

Z[input x[n]] (9.21) That is,H(z)transfers the inputX(z)into the outputY(z).

Remarks

n The convolution sum property can be seen as a way to obtain the coefficients of the product of two polyno- mials. Whenever we multiply two polynomials X1(z)and X2(z), of finite or infinite order, the coefficients of the resulting polynomial can be obtained by means of the convolution sum. For instance, consider

X1(z)=1+a1z−1+a2z−2

9.4 One-Sided Z-Transform 527

−2 0 2

−1 0 1

Real part

Imaginary part

0 5 10 15 20

h2(n)

−1 0 1

n

−2 0 2

−1 0 1

Real part

Imaginary part

0 5 10 15 20

0 0.5 1

h1(n)

n (a)

(b)

(c)

(d)

Imaginary part

0 5 10 15 20

h3(n)

−1 0 1

n

−2 0

2

2

−1 0 1

Real part

−3 −2 −1 0 1 2 3

−1 0 1

2

Imaginary part

0 5 10 15 20

h4(n)

−50 0 50

Real part n

FIGURE 9.3

Effect of pole location on the inverse Z-transform: (a) if the pole is atz=1the signal isu[n], constant forn≥0;

(b) if the pole is atz= −1the signal is a cosine of frequencyπcontinuously changing, constant amplitude; (c, d) when poles are complex, if inside the unit circle the signal is a decaying modulated exponential, and if outside the unit circle the signal is a growing modulated exponential.

and

X2(z)=1+b1z−1 Their product is

X1(z)X2(z)=1+b1z−1+a1z−1+a1b1z−2+a2z−2+a2b1z−3

=1+(b1+a1)z−1+(a1b1+a2)z−2+a2b1z−3

The convolution sum of the two sequences[1a1 a2]and[1b1], formed by the coefficients of X1(z)and X2(z), is[1(a1+b1) (a2+b1a1)a2], which corresponds to the coefficients of the product of the polyno- mials X1(z)X2(z). Also notice that the sequence of length 3 (corresponding to the first-order polynomial X1(z))and the sequence of length 2 (corresponding to the second-order polynomial X2(z)) when convolved give a sequence of length3+2−1=4(corresponding to the third-order polynomial X1(z)X2(z)).

n A finite-impulse response or FIR filter is implemented by means of the convolution sum. Consider an FIR with an input–output equation

y[n]=

N−1

X

k=0

bkx[nk] (9.22)

where x[n]is the input and y[n]is the output. The impulse response of this filter is (let x[n]=δ[n]and set initial conditions to zero, so that y[n]=h[n])

h[n]=

N−1

X

k=0

bkδ[nk]

giving h[n]=bnfor n=0,. . .,N−1, and accordingly, we can write Equation (9.22) as

y[n]=

N−1

X

k=0

h[k]x[nk]

which is the convolution of the input x[n]and the impulse response h[n]of the FIR filter. Thus, if X(z)= Z(x[n])and H(z)=Z(h[n]), then

Y(z)=H(z)X(z) and y[n]=Z−1[Y(z)]

n The length of the convolution of two sequences of lengthsMandNisM+N−1.

n If one of the sequences is of infinite length, the length of the convolution is infinite. Thus, for an infinite- impulse response (IIR) or recursive filters the output is always of infinite length for any input signal, given that the impulse response of these filters is of infinite length.

9.4 One-Sided Z-Transform 529

nExample 9.7

Consider computing the output of an FIR filter, y[n]= 1

2 x[n]+x[n−1]+x[n−2]

for an inputx[n]=u[n]−u[n−4] using the convolution sum, analytically and graphically, and the Z-transform.

Solution

The impulse response is h[n]=0.5(δ[n]+δ[n−1]+δ[n−2]), so that h[0], h[1], h[2] are, respectively, 0.5, 0.5, and 0.5, andh[n] is zero otherwise.

Convolution sum formula: The equation y[n]=

n

X

k=0

h[k]x[nk]

=x[0]h[n]+x[1]h[n−1]+ ã ã ã +x[n]h[0] n≥0

with the condition that in each entry the arguments ofx[.] andh[.] add ton≥0, gives y[0]=x[0]h[0]=0.5

y[1]=x[0]h[1]+x[1]h[0]=1

y[2]=x[0]h[2]+x[1]h[1]+x[2]h[0]=1.5

y[3]=x[0]h[3]+x[1]h[2]+x[2]h[1]+x[3]h[0]=x[1]h[2]+x[2]h[1]+x[3]h[0]=1.5 y[4]=x[0]h[4]+x[1]h[3]+x[2]h[2]+x[3]h[1]+x[4]h[0]=x[2]h[2]+x[3]h[1]=1 y[5]=x[0]h[5]+x[1]h[4]+x[2]h[3]+x[3]h[2]+x[4]h[1]+x[5]h[0]=x[3]h[2]=0.5 and the rest are zero. In the above computations, we notice that the length ofy[n] is 4+3−1= 6 since the length ofx[n] is 4 and that ofh[n] is 3.

Graphical approach: The convolution sum is given by either y[n]=

n

X

k=0

x[k]h[nk]

=

n

X

k=0

h[k]x[nk]

Choosing one of these equations, let’s say the first one, we needx[k] andh[nk], as functions ofk, for different values ofn. Multiply them and then add the nonzero values. For instance, for n=0 the sequenceh[−k] is the reflection ofh[k]; multiplyingx[k] byh[−k] gives only one value different from zero atk=0, ory[0]=1/2. Forn=1, the sequenceh[1−k], as a function ofk,

x[k]

h[−1 −k]

h[2−k]

h[5−k]

x[k]

x[k]

1 2 3

0 4 5 k

k k

−3 −2 −1

−3 −2 −1

−3 −2 −1

0 0

1

1 2

2 3

3

4 4

5 5 n= −1

n=2

n=5

y[−1]=0

y[2]=x[0]h[2]+x[1]h[1]+x[2]h[0]

y[5]=x[3]h[2]

(a)

(b)

(c) FIGURE 9.4

Graphical approach: convolution sum for (a)n= −1, (b)n=2, and (c)n=5with corresponding outputsy[−1], y[2], andy[5]. Bothx[k]andh[nk]are plotted as functions ofkfor a given value ofn. The signalx[k]remains stationary, whileh[nk]moves linearly from left to right. Thus, the convolution sum is also called a linear convolution.

ish[−k] shifted to the right one sample. Multiplyingx[k] byh[1−k] gives two values different from zero, which when added givesy[1]=1, and so on. For increasing values ofnwe shift to the right one sample to geth[nk], multiply it byx[k], and then add the nonzero values to obtain the outputy[n]. Figure 9.4 displays the graphical computation of the convolution sum forn= −1,n=2 andn=5.

Convolution sum property: We have

X(z)=1+z−1+z−2+z−3 H(z)= 1

2

1+z−1+z−2

9.4 One-Sided Z-Transform 531

−2 0 2

n

x[n] h[n]

y[n]

n

n

4 6

(a) (b)

(c) 8 0

0.5 1

−2 0 2 4 6 8

0 0.5 1

−2 0 2 4 6 8

0 0.5 1 1.5

FIGURE 9.5

Convolution sum for an averager FIR: (a)x[n], (b)h[n], and (c)y[n]. The outputy[n]is of length 6 given thatx[n]

is of length 4 andh[n]is the impulse response of a second-order FIR filter of length 3.

and according to the convolution sum property, Y(z)=X(z)H(z)=1

2(1+2z−1+3z−2+3z−3+2z−4+z−5)

Thus,y[0]=0.5,y[1]=1,y[2]=1.5,y[3]=1.5,y[4]=1, andy[5]=0.5, just as before.

In MATLAB the functionconvis used to compute the convolution sum giving the results shown in Figure 9.5, which coincide with the ones obtained in the other approaches. n

nExample 9.8

Consider an FIR filter with impulse response

h[n]=δ[n]+δ[n−1]+δ[n−2]

Find the filter output for an inputx[n]=cos(2πn/3)(u[n]−u[n−14]). Use the convolution sum to find the output, and verify your results with MATLAB.

Solution

Graphical approach: Let us use the formula y[n]=

n

X

k=0

x[k]h[nk]

which keeps the more complicated signalx[k] as the unchanged signal. The termh[nk] is h[k] reversed forn=0, and then shifted to the right forn≥1. The output is zero for negative values ofn, and forn≥0 we have

y[0]=1 y[1]=0.5

y[n]=0 2≤n≤13 y[14]=0.5

y[15]= −0.5

The first value is obtained by reflecting the impulse response to geth[−k], and when multiplied by x[k] we only have the value atk=0 different from zero, thereforey[0]=x[0]h[0]=1. As we shift the impulse response to the right to geth[1−k] forn=1 and multiply it byx[k], we get two values different from zero; when added they equal 0.5. The result for 2≤n≤13 is zero because we add three values of−0.5, 1 and−0.5 from the cosine. These results are verified by MATLAB as shown in Figure 9.6. (the cosine does not look like a sampled cosine given that only three values are used per period).

Convolution property approach: By the convolution property, the Z-transform of the outputy[n] is Y(z)=X(z)H(z)=X(z)(1+z−1+z−2)=X(z)+X(z)z−1+X(z)z−2

The coefficients ofY(z)can be obtained by adding the coefficients ofX(z),X(z)z−1, andX(z)z−2: z0 z−1 z−2 z−3 z−4 z−5 z−6 z−7 z−8 z−9 z−10 z−11 z−12 z−13 z−14 z−15

1 −0.5 −0.5 1 −0.5 −0.5 1 −0.5 −0.5 1 −0.5 −0.5 1 −0.5 1 −0.5 −0.5 1 −0.5 −0.5 1 −0.5 −0.5 1 −0.5 −0.5 1 −0.5

1 −0.5 −0.5 1 −0.5 −0.5 1 −0.5 −0.5 1 −0.5 −0.5 1 −0.5 Adding these coefficients vertically, we obtain

Y(z)=1+0.5z−1+0z−2+ ã ã ã +0z−13+0.5z−14−0.5z−15

=1+0.5z−1+0.5z−14−0.5z−15 Notice from this example that

n The convolution sum is simply calculating the coefficients of the polynomial product X(z)H(z).

9.4 One-Sided Z-Transform 533

0 5 10 15

−1

−0.5 0 0.5 1 1.5

n

x[n]

0 5 10 15

0 0.5 1

n

h[n]

−2 0 2 4 6 8 10 12 14 16 18

−1

−0.5 0 0.5 1

n

y[n]

(a) (b)

(c) FIGURE 9.6

Convolution sum for FIR filter: (a)x[n], (b)h[n], and (c)y[n].

n The length of the convolution sum=length ofx[n]+length ofh[n]−1=14+3−1=

16—that is,Y(z)is a polynomial of order 15. n

nExample 9.9

The convolution sum of noncausal signals is more complicated graphically than that of the causal signals we showed in the previous examples. Let

h1[n]= 1

3 δ[n+1]+δ[n]+δ[n−1]

be the impulse response of a noncausal averager FIR filter, andx[n]=u[n]−u[n−4] be the input.

Compute the filter output using the convolution sum.

Solution

Graphically, it is a bit confusing to plot h1[nk], as a function of k, to do the convolution sum. Using the convolution and the time-shifting properties of the Z-transform we can view the computation more clearly.

According to the convolution property the Z-transform of the output of the noncausal filter is

Y1(z)=X(z)H1(z)

=X(z)[zH(z)] (9.23)

where we let

H1(z)=Z[h1[n]]=1

3(z+1+z−1)

=z 1

3(1+z−1+z−2)

=zH(z)

where H(z)=(1/3)Z[δ[n]+δ[n−1]+δ[n−2]] is the transfer function of a causal filter. Let Y(z)=X(z)H(z)be the Z-transform of the convolution sumy[n]=[xh][n] ofx[n] andh[n], both of which are causal and can be computed as before.

According to Equation (9.23), we then haveY1(z)=zY(z)ory1[n]=[xh1][n]=y[n+1].

n Letx1[n]be the input to a noncausal LTI system, with an impulse responseh1[n]such thath1[n]=0for n<N1<0. Assumex1[n]is also noncausal (i.e.,x1[n]=0forn<N0<0). The outputy1[n]=[x1∗h1][n]

has a Z-transform of

Y1(z)=X1(z)H1(z)=[zN0X(z)][zN1H(z)]

whereX(z)andH(z)are the Z-transforms of a causal signalx[n]and of a causal impulse responseh[n]. If we let

y[n]=[xh][n]=Z−1[X(z)H(z)]

then

y1[n]=[x1∗h1][n]=y[n+N0+N1]

Remarks

n The impulse response of an IIR system, represented by a difference equation, is found by setting the initial conditions to zero, therefore, the transfer function H(z)also requires a similar condition. If the initial conditions are not zero, the Z-transform of the total response Y(z)is the sum of the Z-transforms of the zero-state and the zero-input responses—that is, its Z-transform is of the form

Y(z)= X(z)B(z)

A(z) +I0(z)

A(z) (9.24)

and it does not permit us to compute the ratio Y(z)/X(z)unless the component due to the initial conditions is I0(z)=0.

9.4 One-Sided Z-Transform 535

n It is important to remember the relations

H(z)=Z[h[n]]=Y(z)

X(z)= Z[y[n]]

Z[x[n]]

where H(z)is the transfer function and h[n]is the impulse response of the system, with x[n]as the input and y[n]as the output.

nExample 9.10

Consider a discrete-time IIR system represented by the difference equation

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

withx[n] as the input andy[n] as the output. Determine the transfer function of the system and from it find the impulse and the unit-step responses. Determine under what conditions the system is BIBO stable. If stable, determine the transient and steady-state responses of the system.

Solution

The system transfer function is given by

H(z)=Y(z)

X(z)= 1 1−0.5z−1 and its impulse response is

h[n]=Z−1[H(z)]=0.5nu[n]

The response of the system to any input can be easily obtained by the transfer function. If the input isx[n]=u[n], we have

Y(z)=H(z)X(z)= 1

(1−0.5z−1)(1−z−1)

= −1

1−0.5z−1 + 2 1−z−1 so that the total solution is

y[n]= −0.5nu[n]+2u[n]

From the transfer functionH(z)of the LTI system, we can test the stability of the system by finding the location of its poles—very much like in the analog case. An LTI system is BIBO stable if and only if the impulse response of the system is absolutely summable—that is,

X

n

|h[n]| ≤ ∞

An equivalent condition is that the poles of H(z) are inside the unit circle. In this case,h[n] is absolutely summable, indeed

X∞ n=0

0.5n= 1 1−0.5 =2 On the other hand,

H(z)= 1

1−0.5z−1 = z z−0.5

has a pole atz=0.5, inside the unit circle. Thus, the system is BIBO stable. As such, its transient and steady-state responses exist. Asn→ ∞,y[n]=2 is the steady-state response, and−0.5nu[n] is

the transient solution. n

nExample 9.11

An FIR system has the input–output equation y[n]= 1

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

wherex[n] is the input andy[n] is the output. Determine the transfer function and the impulse response of the system, and from them indicate whether the system is BIBO stable or not.

Solution

The transfer function is

H(z)=1

3[1+z−1+z−2]

=z2+z+1 3z2 and the corresponding impulse response is

h[n]=1

3[δ[n]+δ[n−1]+δ[n−2]]

The impulse response of this system only has three nonzero values,h[0]=h[1]=h[2]=1/3, and the rest of the values are zero. As such,h[n] is absolutely summable and the filter is BIBO stable.

FIR filters are always BIBO stable given their impulse responses will be absolutely summable, due to their final support, and equivalently because the poles of the transfer function of these system are at the origin of thez-plane, very much inside the unit circle. n Nonrecursive or FIR systems: The impulse responseh[n] of an FIR or nonrecursive system

y[n]=b0x[n]+b1x[n−1]+ ã ã ã +bMx[nM]

9.4 One-Sided Z-Transform 537

has finite length and is given by

h[n]=b0δ[n]+b1δ[n−1]+ ã ã ã +bMδ[nM]

Its transfer function is

H(z)= Y(z) X(z)

=b0+b1z−1+ ã ã ã +bMzM

= b0zM+b1zM−1+ ã ã ã +bM

zM

with all its poles at the originz=0 (multiplicityM), and as such the system is BIBO stable.

Recursive or IIR systems: The impulse responseh[n] of an IIR or recursive system

y[n]= −

N

X

k=1

aky[nk]+

M

X

m=0

bmx[nm]

has (possible) infinite length and is given by h[n]=Z−1[H(z)]

=Z−1

" PM

m=0bmzm 1+PN

k=1akzk

#

=Z−1 B(z)

A(z)

= X∞

`=0

h[`]δ[n−`]

whereH(z)is the transfer function of the system. If the poles ofH(z)are inside the unit circle, or A(z)6=0 for|z| ≥1, the system is BIBO stable.

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

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

(769 trang)