• No results found

Basic DSP Theory

Step 5: Direct evaluation

5.19 First-Order Pole-Zero Filter: The Shelving Filter

The fi rst-order pole-zero fi lter consists of a fi rst-order pole and fi rst-order zero in the same algorithm. The topology in the block diagram in Figure 5.52 is a combination feed forward and feed back since it contains both paths.

The difference equation is as follows:

y(n) 5 a0x(n) 1 a1x(n 2 1) 2 b1y(n 2 1) (5.78) Steps 1 to 3: Take the z transform of the difference equation to get the transfer function, then factor out a 0 as the scalar gain coeffi cient

Y(z) 5 a0X(z) 1 a1X(z)z212 b1Y(z)z21 (5.79)

Figure 5.50: Impulse response of the fi lter from RackAFX.

Table 5.4: Challenge answers.

Frequency (v) zH(v)z Arg(H)

Nyquist (p) 210.2 dB 0.08

½ Nyquist (p/2) 22.56 dB 285.88

¼ Nyquist (p/4) 123.15 dB 240.38

+24.0 dB +16.0 dB +8.0 dB 0.0 dB –8.0 dB –16.0 dB

–24.0 dB 2 kHz 4 kHz 6 kHz 8 kHz 10 kHz 12 kHz 14 kHz 16 kHz 18 kHz 20 kHz +180.0°

+120.0° +60.0°

0.0°

–60.0°

–120.0°

–180.0° 2 kHz 4 kHz 6 kHz 8 kHz 10 kHz 12 kHz 14 kHz 16 kHz 18 kHz 20 kHz

x(n) a0 y(n)

z –1 a1

Z–1 –b1

Separate variables:

Y(z) 1 b1Y(z)z215 a0X(z) 1 a1X(z)z21 Y(z)31 1 b1z214 5 X(z)3a0 1 a1z214 Form the transfer function:

H(z) 5 Y(z)

X(z) 5a01 a1z21 1 1 b1z21 Factor out a0:

H(z) 5 a01 1 a1z21 1 1 b1z21 where

a1 5a1 a0

Figure 5.52: First-order pole-zero fi lter.

Figure 5.51: RackAFX’s frequency and phase responses are taken from the z -transform of the impulse response.

Im

Re 0.71

0.92

Step 4: Estimate the frequency response

This transfer function has one pole and one zero and both are fi rst order. Like the other fi rst-order cases, we can fi nd the pole and zero by inspection of the transfer function:

H(z) 5 a01 1 a1z21 1 1 b1z21

5 a0 1 1a1

z 1 1b1

z

(5.80)

In the numerator, you can see that if z 5 2a 1 the numerator will go to zero and the transfer function will go to zero. In the denominator, you can see that if z 5 2b 1 the denominator will go to zero and the transfer function will go to infi nity. Therefore we have a zero at z 5 2a 1 and a pole at z 5 2b 1 . For this example, use the following values for the coeffi cients: a 0 5 1.0, a 1 5 20.92, b 1 5 20.71. Then, a 1 5 20.92, and so we now have a zero at z 5 2a 1 5 0.92 1 j 0 and a pole at z 5 2b 1 5 0.71 1 j 0. The pole/zero pair are plotted in Figure 5.53 .

Evaluating the frequency response when you have mixed poles and zeros is the same as before, but you have to implement both magnitude steps.

• Locate each evaluation frequency on the outer rim of the unit circle.

Draw a line from the point on the circle to each zero and measure the length of these vectors. Do it for each evaluation frequency.

Draw a line from the point on the circle to each pole and measure the length of these vectors. Do it for each evaluation frequency.

Figure 5.53: The pole and zero are both purely real and plotted on the real axis in the z -plane.

• Multiply all the zero magnitudes together.

Multiply all the inverse pole magnitudes together.

• Divide the zero magnitude by the pole magnitude for the fi nal result at that frequency.

Mathematically, this last rule looks like Equation 5.81 :

Ui5 the geometric length from the point(v)on the unit circle to the ith zero Vi5 the geometric length from the point(v)on the unit circle to the ith pole Equation 5.81 is the fi nal, generalized magnitude response equation for the geometric interpretation of the pole/zero plots in the z -plane. For completeness, here’s the equation for calculating the phase response of a digital fi lter using the geometric method:

Arg(H(ejv))|v5 a

Equations 5.81 and 5.82 together complete the DSP theory for pole/zero interpretation for estimating the frequency and phase responses of any fi lter. So, let’s do the analysis for this fi lter—by going through the math, you can see the tug of war going on between the pole and zero. Follow the analysis sequence in Figures 5.54 through 5.58 .

Step 5: Direct evaluation

You can evaluate the fi lter the same way as before using Euler’s equation to separate the real and imaginary components from the transfer function. Evaluate at the following frequencies:

• DC: 0

• Nyquist: p

• ½ Nyquist: p/2

• ¼ Nyquist: p/4

Im

Figure 5.54: The magnitude response at DC is 211.1 dB. Look at the equation and you can see the zero value bringing down the total while the pole value is trying to push it back up. In this case, the zero wins and the response is down almost 12 dB. Geometrically,

you can see this is because the zero is closer to the evaluation point and so it has more effect on the outcome.

Figure 5.55: The magnitude response at p is almost unity gain because the pole and zero distances are almost the same. The tug of war ends in stalemate here at 0.17 dB of gain.

Figure 5.56: With the pole slightly closer to the evaluation frequency, the magnitude response at p/2 picks up a bit to 10.64 dB.

I m

First, get the transfer function in a form to use for all the evaluation frequencies ( Equation 5.83 ). Then evaluate at our four frequencies.

H(z) 5 a0 1 a1z21

Figure 5.57: At p/4 the pole/zero ratio favors the pole and the response perks up to 1.0 dB; notice that this is the frequency where the pole is clearly dominating,

but just barely.

Figure 5.58: The composite frequency response plot shows a 212 dB low shelving fi lter response, a useful fi lter in audio.

Apply Euler’s equation:

H(v) 51 2 0.92e2j1v 1 2 0.71e2j1v

H(v) 51 2 0.923cos(v) 2 jsin(v)4 1 2 0.713cos(v) 2 jsin(v)4

5.19.1 DC (0Hz)

H(v) 51 2 0.923cos(v) 2 jsin(v)4 1 2 0.713cos(v) 2 jsin(v)4 5 1 2 0.923cos(0) 2 jsin(0)4

1 2 0.713cos(0) 2 jsin(0)4 5 1 2 0.9231 2 j04

1 2 0.7131 2 j04 (5.84)

5 0.08 1 j0

0.29 1 j0

0 H(v) 0 5 0 0.08 1 j0 0 0 0.29 1 j0 0

5"a21 b2

"a21 b2 5"0.082

"0.292 5 0.276 5 2 11.2 dB (5.85) Arg(H) 5 Arg(Num) 2 Arg(Denom)

5 tan21(0/0.08) 2 tan21(0/0.29)

5 08

By now this should be getting very familiar; the only difference in this situation is that we have to evaluate the numerator and denominator, but the method is the same.

15.19.2 Challenge

Finish the rest of the direct evaluation calculations on your own. The answers are in Table 5.5 . Table 5.5: Challenge answers.

Frequency (v) zH(v)z Arg(H)

Nyquist (p) 1.00 dB 0.0o

½ Nyquist (p/2) 0.82 dB 7.23o

¼ Nyquist (p/4) 0.375 dB 16.60o

1.000

Thus, once again the direct evaluation backs up the estimation from the z -plane. Because we have a feedback path, extracting the impulse response will be tedious but we can use RackAFX’s pole/zero fi lter module to analyze the impulse response. Figure 5.59 shows the measured impulse response, while Figure 5.60 shows the frequency and phase responses.

Figure 5.59: Impulse response of the fi rst-order shelving fi lter.

Figure 5.60: Frequency and phase responses of the fi rst-order shelving fi lter.

x(n) a0 y(n)

a1

a2

–b1

–b2

Z –1

z–1

z –1

z –1

A fi rst-order shelving fi lter is a pole-zero design. The shelf will be located in the region between where the zero dominates and where the pole dominates. When neither really dominates, the response is approximately unity gain. The RackAFX frequency and phase plots are shown in Figure 5.60 ; the log frequency plot has been included to reveal the textbook shelving fi lter curve.