## Elementary Filter Sections

This section gives condensed analysis summaries of the four most elementary digital filters: the one-zero, one-pole, two-pole, and two-zero filters. Despite their relative simplicity, they are quite valuable to master in practice. In particular, recall from Chapter 9 that every causal, finite-order, LTI filter (any difference equation of the form Eq.(5.1)) may be factored into a*series and/or parallel combination*of such sections. Implementing high-order filters as parallel and/or series combinations of low-order sections offers several advantages, such as numerical robustness and easier/safer control in real time.

### One-Zero

Figure B.1 gives the signal flow graph for the general one-zero filter. The frequency response for the one-zero filter may be found by the following steps:### One-Pole

Fig.B.3 gives the signal flow graph for the general one-pole filter. The road to the frequency response goes as follows:*boost*in the passband rather than

*attenuation*in the stopband; thus it is usually desirable when using a one-pole filter to set to a small value, such as , so that the peak gain is 1 or so. When the peak gain is 1, the filter is unlikely to overflow.

^{B.1}Finally, note that the one-pole filter is stable if and only if .

### Two-Pole

The signal flow graph for the general two-pole filter is given in Fig.B.5. We proceed as usual with the general analysis steps to obtain the following:*denominator coefficients*, and they determine the two

*poles*of . Using the quadratic formula, the poles are found to be located at

*multiply pointwise*two magnitude plots such as Fig.B.4a, and

*add pointwise*two phase plots such as Fig.B.4b. When the poles are complex, they can be written as

*polar form*as

*radius*, or distance from the origin in the -plane. As discussed in Chapter 8, we must have for stability of the two-pole filter. The angles are the poles' respective

*angles*in the plane. The pole angle corresponds to the

*pole frequency*via the relation

*resonance*

^{B.2}at radian frequency . We may call or the

*center frequency*of the resonator. Note, however, that the resonance frequency is not usually the precise frequency of

*peak-gain*in a two-pole resonator (see Fig.B.9 on page ). The peak of the amplitude response is usually a little different because each pole sits on the other's ``skirt,'' which is slanted. (See §B.1.5 and §B.6 for an elaboration of this point.) Using polar form for the (complex) poles, the two-pole transfer function can be expressed as

Comparing this to the transfer function derived from the difference equation, we may identify The difference equation can thus be rewritten as

Note that coefficient depends only on the pole radius R (which determines damping) and is independent of the resonance frequency, while is a function of both. As a result, we may

*retune*the resonance frequency of the two-pole filter section by modifying only. The gain at the resonant frequency , is found by substituting into Eq.(B.1) to get

See §B.6 for details on how the resonance gain (and peak gain) can be normalized as the tuning of is varied in real time. Since the radius of both poles is , we must have for filter stability (§8.4). The closer is to 1, the higher the gain at the resonant frequency . If , the filter degenerates to the form , which is a nothing but a scale factor. We can say that when the two poles move to the origin of the plane, they are canceled by the two zeros there.

#### Resonator Bandwidth in Terms of Pole Radius

The*magnitude*of a complex pole determines the

*damping*or

*bandwidth*of the resonator. (Damping may be defined as the reciprocal of the bandwidth.) As derived in §8.5, when is close to 1, a reasonable definition of 3dB-bandwidth is provided by

where is the pole radius, is the bandwidth in Hertz (cycles per second), and is the sampling interval in seconds. Figure B.6 shows a family of frequency responses for the two-pole resonator obtained by setting and varying . The value of in all cases is , corresponding to . The analytic expressions for amplitude and phase response are

### Two-Zero

The signal flow graph for the general two-zero filter is given in Fig.B.7, and the derivation of frequency response is as follows:*numerator coefficients*, and they determine the two

*zeros*. Using the quadratic formula for finding the roots of a second-order polynomial, we find that the zeros are located at

*notch frequency*, or

*antiresonance frequency*. The closer R is to 1, the narrower the notch centered at . The approximate relation between bandwidth and given in Eq.(B.5) for the two-pole resonator now applies to the

*notch width*in the two-zero filter. Figure B.8 gives some two-zero frequency responses obtained by setting to 1 and varying . The value of , is again . Note that the response is exactly analogous to the two-pole resonator with notches replacing the resonant peaks. Since the plots are on a linear magnitude scale, the two-zero amplitude response appears as the reciprocal of a two-pole response. On a dB scale, the two-zero response is an upside-down two-pole response.

### Complex Resonator

Normally when we need a resonator, we think immediately of the two-pole resonator. However, there is also a*complex one-pole resonator*having the transfer function

where is the single complex pole, and is a scale factor. In the time domain, the complex one-pole resonator is implemented as

*z*transform of the transfer function, we can write down the impulse response of the complex one-pole resonator by recognizing Eq.(B.6) as the closed-form sum of an infinite geometric series, yielding

*unit step function*:

*complex sinusoidal oscillator*at radian frequency rad/sec. If we like, we can extract the real and imaginary parts separately to create both a sine-wave and a cosine-wave output:

*phase-quadrature sinusoids*, since their phases differ by 90 degrees. The phase quadrature relationship for two sinusoids means that they can be regarded as the real and imaginary parts of a complex sinusoid. By allowing to be complex,

*real*resonator in that the resonance occurs only for one positive or negative frequency , but not both. As a result, the resonance frequency is also the frequency where the

*peak-gain*occurs; this is only true in general for the complex one-pole resonator. In particular, the peak gain of a real two-pole filter does not occur exactly at resonance, except when , , or . See §B.6 for more on peak-gain versus resonance-gain (and how to normalize them in practice).

#### Two-Pole Partial Fraction Expansion

Note that every real two-pole resonator can be broken up into a sum of two complex one-pole resonators:where and are constants (generally complex). In this ``parallel one-pole'' form, it can be seen that the peak gain is no longer equal to the resonance gain, since each one-pole frequency response is ``tilted'' near resonance by being summed with the ``skirt'' of the other one-pole resonator, as illustrated in Fig.B.9. This interaction between the positive- and negative-frequency poles is minimized by making the resonance sharper ( ), and by separating the pole frequencies . The greatest separation occurs when the resonance frequency is at one-fourth the sampling rate ( ). However, low-frequency resonances, which are by far the most common in audio work, suffer from significant overlapping of the positive- and negative-frequency poles.

*partial fraction expansion*(PFE) (discussed more fully in §6.8). Note that the inverse

*z*transform of a sum of one-pole transfer functions can be easily written down by inspection. In particular, the impulse response of the PFE of the two-pole resonator (see Eq.(B.7)) is clearly

### The BiQuad Section

The term ``biquad'' is short for ``bi-quadratic'', and is a common name for a two-pole, two-zero digital filter. The*transfer function*of the biquad can be defined as

where can be called the

*overall gain*of the biquad. Since both the numerator and denominator of this transfer function are quadratic polynomials in (or ), the transfer function is said to be ``bi-quadratic'' in (or ). As derived in §B.1.3, for real second-order polynomials having complex roots, it is often convenient to express the polynomial coefficients in terms of the radius and angle of the positive-frequency pole. For example, denoting the denominator polynomial by , we have

*resonance frequency*(in radians per sample-- , where is the resonance frequency in Hz), and determines the ``Q'' of the resonance (see §B.1.3). The numerator is less often represented in this way, but when it is, we may think of the zero-angle as the

*antiresonance frequency*, and the zero-radius affects the

*depth*and

*width*of the antiresonance (or

*notch*). As discussed on page , a common setting for the zeros when making a resonator is to place one at (dc) and the other at (half the sampling rate),

*i.e.*, and in Eq.(B.8) above . This zero placement normalizes the peak gain of the resonator if it is swept using the parameter. Using the shift theorem for

*z*transforms, the

*difference equation*for the biquad can be written by inspection of the transfer function as

*direct-form I*implementation. (To obtain the official direct-form I structure, the overall gain must be not be pulled out separately, resulting in feedforward coefficients instead. See Chapter 9 for more about filter implementation forms.)

### Biquad Software Implementations

In matlab, an efficient biquad section is implemented by callingoutputsignal = filter(B,A,inputsignal);where

`BiQuad`STK class.) Figure B.10 lists an example biquad implementation in the

`C`programming language.

typedef double *pp; // pointer to array of length NTICK typedef word double; // signal and coefficient data type typedef struct _biquadVars { pp output; pp input; word s2; word s1; word gain; word a2; word a1; word b2; word b1; } biquadVars; void biquad(biquadVars *a) { int i; dbl A; word s0; for (i=0; i<NTICK; i++) { A = a->gain * a->input[i]; A -= a->a1 * a->s1; A -= a->a2 * a->s2; s0 = A; A += a->b1 * a->s1; a->output[i] = a->b2 * a->s2 + A; a->s2 = a->s1; a->s1 = s0; } } |

**Next Section:**

Allpass Filter Sections

**Previous Section:**

A Sum of Sinusoids at the Same Frequency is Another Sinusoid at that Frequency