• No results found

Basic DSP Theory

Step 5: Direct evaluation

5.18 Second-Order Feed-Back Filter

Analysis of the second-order feed-back fi lter starts with the block diagram and difference equation. Figure 5.42 shows the topology of a second-order feed-back fi lter.

The difference equation is as follows:

y(n) 5 a0x(n) 2 b1y(n 2 1) 2 b2y(n 2 2) (5.70) 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

We’ll continue to combine steps. Once again, the z transform can be taken by inspection using the rules from Section 5.8 , and then you need to get it into the form Y ( z )/ X ( z ) for the transfer function in Equation 5.71 .

y(n) 5 a0x(n) 2 b1y(n 2 1) 2 b2y(n 2 2) Y(z) 5 a0X(z) 2 b1Y(z)z212 b2Y(z)z22 Separate variables:

Y(z) 1 b1Y(z)z21 1 b2Y(z)z225 a0X(z) Y(z)31 1 b1z211 b2z224 5 a0X(z) Form transfer function:

H(z) 5 Y(z)

X(z) 5 a0

1 1 b1z211 b2z22 Factor outa0:

H(z) 5 a0 1

1 1 b1z21 1 b2z22

(5.71)

Figure 5.42: Second-order feed-back fi lter.

Step 4: Estimate the frequency response

Now you can see why the feed-back fi lter block diagrams have all the b coeffi cients negated.

It puts the quadratic denominator in the fi nal transfer function in Equation 5.71 in the same polynomial form as the numerator of the feed-forward transfer function. Thus, you can use the same logic to fi nd the poles of the fi lter; since the coeffi cients b 1 and b 2 are real values, the poles must be complex conjugates of each other, as shown in Equation 5.72 :

H(z) 5 a0 1

1 1 b1z21 1 b2z22 can be factored as

H(z) 5 a0 1

(1 2 P1z21)(1 2 P2z21) where

P15 Reju P25 Re2ju

11 2 P1z212 11 2 P1z212 5 1 2 2Rcos(u)z211 R2z22 therefore

H(z) 5 a0 1

1 1 b1z21 1 b2z22

5 a0 1

(1 2 2Rcos(u)z211 R2z22) and

(5.72)

b1 5 22Rcos(u) b2 5 R2

This results in two poles, P 1 and P 2 , located at complex conjugate positions in the z -plane.

Figure 5.43 shows an arbitrary conjugate pair of poles plotted in the z -plane. You can see how they are at complementary angles to one another with the same radii.

To estimate we’ll need some coeffi cients to test with. Use the following: a 0 5 1.0, b 1 5 21.34, b 2 5 0.902. Now, calculate the location of the poles from Equation 5.72 :

R25 b25 0.902 (5.73)

R 5"0.902 5 0.95 then

22Rcos(u) 5 21.34 2(0.95)cos(u) 5 1.34

Im

R

θ

Re R –θ

Im

45°

–45° Re

0.95

0.95

cos(u) 5 1.34 2(0.95) u 5 arccos(0.707)

u 5 458

Figure 5.44 shows the complex conjugate pair of poles plotted in the z -plane at angles 645 8 and radii of 0.95. Evaluating the frequency response of the complex pair is similar to before, but with an extra step. When estimating the frequency response with more than one pole:

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

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.

For each evaluation frequency, the magnitude of the transfer function is the product of the inverse lengths of the two vectors to each pole pair.

Figure 5.43: A complementary pair of poles in the z -plane.

Figure 5.44: The poles of the fi lter.

Mathematically, this last rule looks like Equation 5.74 : 0 H(ejv)0v5 a0 1

q

N

i 5 1

Vi where

N 5 the filter order

Vi5 the geometric length from the point(v)on the unit circle to the ith pole

(5.74)

Thus, the process is the same as with the zeros, except that you take the inverse of the length to the pole.

For feed-forward fi lters:

• The closer the frequency is to the zero, the more attenuation it receives.

If the zero is on the unit circle, the magnitude would go to zero at that point.

For feed-back fi lters:

• The closer the evaluation frequency is to the pole, the more gain it receives.

If a pole is on the unit circle, the magnitude would theoretically go to infi nity, and it would produce an oscillator, ringing forever at the pole frequency.

You blew up the fi rst-order back fi lter as an exercise in Chapter 4 . All feed-back fi lters are prone to blowing up when their poles go outside the unit circle.

We can now continue with the estimation process for our standard four evaluation frequencies. This time, we’ll convert the raw magnitude values into dB. The reason for doing this is that there will be a very wide range of values that will be diffi cult to sketch if we don’t use dB. Follow the evaluation sequence in Figures 5.45 through 5.48 . Finally, you can put it all together to form the frequency response plot in Figure 5.49 .

In a digital filter:

• Zeros may be located anywhere in the z -plane, inside, on, or outside the unit circle since the filter is always stable; it’s output can’t go lower than 0.0.

• Poles must be located inside the unit circle.

• If a pole is on the unit circle, it produces an oscillator.

• If a pole is outside the unit circle, the filter blows up as the output goes to infinity.

Im

Figure 5.46: The magnitude response at 1/4 Nyquist is a whopping 123 dB since the inverse of 0.05 is a large number.

Figure 5.45: The magnitude response at 0 Hz (DC) is the product of the inverse of the two vectors drawn to each zero, or (1/0.71)(1/0.71) 5 5.9 dB.

71 2 Im

Now 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

First, get the transfer function in a form to use for all the evaluation frequencies:

H(z) 5 a0 1

1 1 b1z211 b2z22 (5.75)

5 1

1 2 1.34z21 1 0.902z22

Figure 5.48: The magnitude response at Nyquist is 210.1 dB.

Figure 5.49: The composite magnitude response of the fi lter shows that it is a resonant low-pass fi lter; the resonant peak occurs at the pole frequency.

Let z 5 ejv.

H(v) 5 1

1 2 1.34e2j1v1 0.902e2j2v Apply Euler’s equation:

H(v) 5 1

1 2 1.34e2j1v1 0.902e2j2v

H(v) 5 1

1 2 1.343cos(v) 2 jsin(v)4 1 0.9023cos(2v) 2 jsin(2v)4 Now evaluate for each of our four frequencies starting with DC.

5.18.1 DC (0 Hz)

H(v) 5 1

1 2 1.343cos(v) 2 1 2 j0 jsin(v)4 1 0.9023cos(2v) 2 jsin(2v)4

5 1

1 2 1.343cos(0) 2 jsin(0)4 1 0.9023cos(2*0) 2 jsin(2*0)4

5 1

1 2 1.3431 2 j04 1 0.902 (5.76)

5 1

1 2 1.34 1 0.902

5 1

0.562 1 j0

H(v) 5 1 0.562 1 j0 0 H(v)0 5 0 1 0

0 0.562 1 j0 0

5 1

"a21 b2 (5.77)

5 1

"0.5622 5 1.78 5 5.00 dB Arg(H) 5 Arg(Num) 2 Arg(Denom)

5 tan21(0/1) 2 tan21(0/0.562)

5 08

Remember that for magnitudes of fractions, you need to take the magnitude of the numerator and denominator separately; also for phase, the total is the difference of the Arg(num) and Arg(denom). The direct evaluation yields 5.0 dB and shows our sketch evaluation was a little off at 5.9 dB.

1.000 0.707 0.500 0.000 –0.500 –0.707 –1.000

0 17 34 51 68 85 102 119 136 153

5.18.2 Challenge

Finish the rest of the direct evaluation calculations on your own. The answers are in Table 5.4 . The exact evaluation once again produces results pretty close to our estimated version. You can get the complete answers at the RackAFX websites.

Step 6: z transform of impulse response

The impulse response for this fi lter is shown in Figure 5.50 . Once again, fi nding the impulse response by hand is going to be tedious. Instead, I will use RackAFX to do the analysis so we can compare our estimated and direct evaluation results. The measured responses are shown in Figure 5.51 .