Section 11.4.  FILTERING ASPECTS OF TIME-DOMAIN AVERAGING

Prev don't be afraid of buying books Next

11.4. FILTERING ASPECTS OF TIME-DOMAIN AVERAGING

In Section 5.2 we introduced FIR filters with an averaging example, and that's where we first learned that the process of time-domain averaging performs low-pass filtering. In fact, successive time-domain outputs of an N-point averager are identical to the output of an (N–1)-tap FIR filter whose coefficients are all equal to 1/N, as shown in Figure 11-11.

Figure 11-11. An N-point averager depicted as an FIR filter.




The question we'll answer here is "What is the frequency magnitude response of a generic N-point averager?" We could evaluate Eq. (6-28), with all a(k) = 0, describing the frequency response of a generic N-stage FIR filter. In that expression, we'd have to set all the b(0) through b(N) coefficient values equal to 1/N and calculate HFIR(w)'s magnitude over the normalized radian frequency range of 0 w p. That range corresponds to an actual frequency range of 0 f fs/2 (where fs is the equivalent data sample rate in Hz). A simpler approach is to recall, from Section 5.2, that we can calculate the frequency response of an FIR filter by taking the DFT of the filter's coefficients. In doing so, we'd use an M-point FFT software routine to transform a sequence of N coefficients whose values are all equal to 1/N. Of course, M should be larger than N so that the sin(x)/x shape of the frequency response is noticeable. Following through on this by using a 128-point FFT routine, our N-point averager's frequency magnitude responses, for various values of N, are plotted in Figure 11-12. To make these curves more meaningful, the frequency axis is defined in terms of the sample rate fs in samples/s.

Figure 11-12. N-point averager's frequency magnitude response as a function of N.




Amazon
Prev don't be afraid of buying books Next

11.5. EXPONENTIAL AVERAGING

There is a kind of time-domain averaging used in some power measurement equipment—it's called exponential averaging[8–11]. This technique provides noise reduction by multiplying an input sample by a constant and adding that product to the constant's ones complement multiplied by the most recent averager output. Sounds complicated in words, but the equation for the exponential averager is the simple expression


where y(n) is the current averager output sample, y(n–1) is the previous averager output sample, and a is the weighting factor constant. The process described by Eq. (11-22) is implemented as shown in Figure 11-13. The advantage of exponential averaging is that only one storage register is needed to hold the value y(n–1) while waiting for the next input data sample x(n).

Figure 11-13. Exponential averager.




The exponential averager's name stems from its time-domain impulse response. Let's assume that the input to the averager is a long string of zeros and we apply a single sample of value 1 at time t = 0. Then the input returns again to a string of zero-valued samples. Now, if the weighting factor is a = 0.4, the averager's output is shown as the curve in Figure 11-14. When t = 0, the input sample is multiplied by a, so the output is 0.4. On the next clock cycle, the input is zero, and the old value of 0.4 is multiplied by (1 – 0.4), or 0.6, to provide an output of 0.24. On the following clock cycle, the input is zero, and the old value of 0.24 is multiplied by 0.6 to provide an output of 0.144. This continues with the averager's output, or impulse response, falling off exponentially because of successive multiplications by 0.6.

Figure 11-14. Exponential averager impulse response with a = 0.4.




A useful feature of the exponential averager is its capability to vary the amount of noise reduction by changing the value of the a weighting factor. If a equals one, input samples are not attenuated, past averager outputs are ignored, and no averaging takes place. In this case, the averager output responds immediately to changes at the input. As a is decreased in value, input samples are attenuated, and past averager outputs begin to affect the present output. These past values represent an exponentially weighted sum of recent inputs, and that summation tends to smooth out noisy signals. The smaller a gets, the more noise reduction is realized. However, with smaller values for a, the slower the averager is in responding to changes in the input. We can demonstrate this behavior by looking at the exponential averager's time-domain step response for various values of a as shown in Figure 11-15.[]

[] The step response is the averager's output when a string of all zeros followed by a string of all ones is applied to the input.

Figure 11-15. Exponential averager output vs. a when a step input is applied at time t = 0.




So we have a trade-off. The more the noise reduction, the more sluggish the averager will be in responding to changes at the input. We can see in Figure 11-15 that, as a gets smaller, affording better noise reduction, the averager's output takes longer to respond and stabilize. Some test instrumentation manufacturers use a clever scheme to resolve this noise reduction versus response time trade-off. They use a large value for a at the beginning of a measurement so that the averager's output responds immediately with a nonzero value. Then, as the measurement proceeds, the value of a is decreased to reduce the noise fluctuations at the input.

The exponential averager's noise variance reduction as a function of the weighting factor a has been shown to be[9,10]

Equation 11-23


Thus, the exponential averager's noise-power reduction in dB is given by

Equation 11-24


Equation (11-24) is plotted in Figure 11-16 to illustrate the trade-off between noise reduction and averager response times.

Figure 11-16. Exponential averager noise-power reduction as a function of the weighting factor a.




To demonstrate the exponential averager's noise-power reduction capabilities, Figure 11-17 shows the averager's output with a cosine wave plus noise as an input. The weighting factor a starts out with a value of 1.0 and decreases linearly to a final value of 0.1 at the 180th data input sample. Notice that the noise is reduced as a decreases. However, the cosine wave's peak amplitude also decreases due to the smaller a value.

Figure 11-17. Exponential averager output noise reduction as a decreases.




The reader may recognize the implementation of the exponential averager in Figure 11-13 as a one-tap infinite impulse response (IIR) digital filter[12]. Indeed it is, and, as such, we can determine its frequency response.

We do this by remembering the general expression in Chapter 6 for the frequency response of an IIR filter, or Eq. (6-28) repeated here as

Equation 11-25


From Figure 6-18, we modify Eq. (11-25) to set N = 0, and M = 1, so that

Equation 11-26


Now with b(0) = a and a(1) = 1 – a, our exponential averager's frequency response is the complex expression

Equation 11-26'


For now, we're interested only in the magnitude response of our filter, so we can express it as

Equation 11-27


Evaluating Eq. (11-27) over the normalized angular range of 0 w p (corresponding to a frequency range of 0 f fs/2 Hz), the frequency magnitude responses of our exponential averaging filter for various values of a are shown in Figure 11-18(a) using a normalized decibel scale. Notice that, as a decreases, the exponential averager behaves more and more like a low-pass filter.

Figure 11-18. Exponential averager frequency response vs. a: (a) normalized magnitude response in dB; (b) phase response in degrees.




We can get some practice manipulating complex numbers by deriving the expression for the phase of an exponential averager. We know that the phase angle, as a function of frequency, is the arctangent of the ratio of the imaginary part of Hexp(w) over the real part of Hexp(w), or

Equation 11-27'


To find those real and imaginary parts, knowing that Hexp(w) is itself a ratio, we determine what the variables are in Eq. (11-26') corresponding to the form of Eq. (A-20), from Appendix A. Doing that, we get


Substituting those variables in Eq. (A-20) yields

Equation 11-28


Representing the denominator of this messy Eq. (11-28) with the term Den, we use Eq. (11-27) to express the phase angle of Hexp(w) as

Equation 11-29


The very nonlinear phase of øexp(w) from Eq. (11-29) is calculated over the normalized angular range of 0 w p, corresponding to a frequency range of 0 f fs/2 Hz, and plotted in Figure 11-18(b).

URL http://proquest.safaribooksonline.com/0131089897/ch11lev1sec5

Amazon