Draft:Filter Design Process

Filter design process
Filter designs begin with a set of design requirements and end with a final optimized filter of desired topology. Filter design requirements generally consist of pass band attenuation, stop band attenuation, pass band frequency, stop band frequency, and group delay. Some requirements may include cut-off frequencies to be different that the pass band frequency. Once a set of design requirements is defined, they are used as input parameters to design the final filter. Determining the minimum order of the filter to be designed is a common starting point, which may be calculated analytically if equations are known to exist, or experimentally, otherwise.

Classical filter design
Classical filter designs are a category of designs that may be implemented from Characteristic polynomials generally refereed to as $$K(s)$$ that embody the reflection zeros, frequencies where 100% transmission occurs, of the filter in the numerator and the transmission zeros, frequencies where no transmission occurs, in the denominator. The magnitude of $$K(s)$$ is normalized such that $$|K(j)|=1$$. Reflection and transmission zeros may be real, imaginary, complex, 0 or $$\infty$$. Imaginary transmission zeros are generally used to filter out specific undesired frequencies. Real and complex transmission zeros may be used to shape the group delay into a more desirable form. Any classical filter may be designed directly with the use of $$K(s)$$. However, this design method involves the use to root finding, and may not necessarily be the most efficient means to design a classical filter in many cases. Butterworth, Chebyshev, Inverse Chebyshev, and Elliptic filters are all classical filters that may be designed directly with classical design techniques.

The mathematical definition of $$K(s)$$ is as follows:

$$\begin{align} &K(s) = \frac{\prod_{i=1}^{N_r}(s-r_i)}{\prod_{i=1}^{N_t}(s-t_i)} \\ &|K(s)| = 1 \text{ at } s=j \\ &r_i \text{are the reflection zeros} \\ &t_i \text{are the transmission zeros} \\ \end{align}$$

Reflection zeros and transmission zero at $$\infty$$ are omitted from the expression above. For example, a five pole Butterworth filter has five reflection zeros at 0 and five transmission zeros at $$\infty$$. for this filter, $$K(s)$$ is simply $$s^5$$. If the Butterworth has a stop band zero at 2 rad/sec, $$K(s)$$ would be $$\frac{3s^5}{s^2+4}$$. The addition of "3" to the numerator meets the requirement that $$|K(j)|=1$$. A low pass all-pole (no finite transmission zeros) Chebyshev filter has its reflection zeros at the imaginary Chebyshev nodes and all transmission zeros at infinity, so a Chebyshev $$K(s)$$ would be the Hurwitz (all left half plane roots) Chebyshev polynomial.

The minimum size of the filter, set by variable N in the expression, is determined mathematically using topology dependent equations, or experimentally if no equations are known to exist.

Classical related design
Some filter designs, such as Legendre and Gaussian filters, are not designed explicitly with a $$K(s)$$ as defined above, but embody $$K(s)$$ style polynomials. For example, the $$L_N(\omega^2)$$ in the Legendre page may be expressed in the form of $$K(s)K(-s)$$. The denominator of $$F_N(j\omega)$$ in the Gaussian filter page may be expressed as $$1+\varepsilon^2 K(s)K(-s)$$, which embodies a $$K(s)$$ term. Both of these expressions may be used in the classical design process.

Nonclassical design
Other filter designs, such as Bessel filters, are designed directly on the transfer functio n, $$G(s)$$, without any interim process resembling a $$K(s)$$.

Obtaining the transfer function, G(s)
For the classical and related filter designs, the square of the transfer function is obtained from the expression below using the design pass band attenuation in dB..

$$\begin{align} G(s)G(-s) &= \frac{1}{1+\varepsilon^2K(s)K(-s)} = \frac{K_{den}(s)K_{den}(-s)}{K_{den}(s)K_{den}(-s) + \varepsilon^2K_{num}(s)K_{num}(-s)}\\ \varepsilon^2 &= 10^{A_p/10}-1\\ A_p &\text{ is the pass band attenuation} \\ \end{align}$$

It can be seen from the expression above that the poles of $$K(s)$$ define the transmission zeros of $$G(s)$$, the frequencies where $$|G(s)|=0$$, and the zeros of $$K(s)$$ define the reflection zeros of $$G(s)$$, the frequencies where $$|G(s)|=1$$, with $$\varepsilon$$ as an interim variable used to set the pass band attenuation. It may also be seen in the expression above that a typical 3dB pass band attenuation results in an $$\varepsilon^2 = 0.99526231 \approx 1$$, which is usually close enough to simply eliminate $$\varepsilon^2$$ from the expression when the pass band attenuation is designed to be 3dB.

$$G(s)G(-s)$$ is a ratio of even polynomials. That is, all zeros and poles of $$G(s)G(-s)$$ contain an equal and signed opposite zero and pole. To extract $$G(s)$$ from $$G(s)G(-s)$$, all opposing signed pairs of zeros and poles need to be found and one of the paired entries needs to be eliminated. For the $$G(s)$$ poles, only the $$G(s)G(-s)$$ poles with negative real values should be retained for the denominator of $$G(s)$$, creating a Hurwitz polynomial composed of only left half plane poles. The numerator of $$G(s)$$ may contain positive real values, so determining which zero to remove may be subjective and driven by the application, within the constraint that all zeros with an imaginary component retain their respective conjugate. Frequently, it is simply a matter of eliminating repeating pairs of zeros for the $$G(s)$$ numerator. Since $$G(s)$$ is ultimately derived from polynomials constructed from roots, it is generally necessary to magnitude scale $$G(s)$$ to retain $$|G(s)| = 1$$ at the reflection zeros.

Nonstandard cut-off attenuation
The classical design equations assume the pass band edge occurs at the cut-off frequency, which works fine for maximally flat functions such as Butterworth and Inverse Chebyshev. However, functions such as Chebyshev and Legendre that have specific shapes associated with the pass band are problematic in that the design attenuation at the cutoff frequency is not necessarily the same as the design attenuation of the pass band. For example, Chebyshev designs for 0.05 dB pass band attenuation and -3 dB cut-off frequency attenuation are common. Although Chebyshev filters have an algebraic means to set the cutoff attenuation, other filter typologies such as Legendre may not. Therefore, a method is needed to universally set the cut-off attenuation for any filter topology.

Setting the cut-off attenuation frequency involves first finding the frequency that achieves the desired attenuation, which will be referred to as $$\omega_c $$, and then scaling either the $$G(s)$$ polynomials or the final filter design to the inverse of that frequency. If $$K(s)$$ is to be used as the reflection coefficient (see paragraph below), then $$K(s)$$ will also need to be inversely scaled. To scale the polynomials, simply append $$\omega_c $$ to the $$s$$ term in each coefficient, as shown in the 3 pole Bessel filter example below.

$$\begin{align} G(s) &= \frac{15}{s^3+6s^2+15s+15}\\ G(s)'&=G(s)_{\text{desired dB at }\omega=1}=\frac{15}{(\omega_cs)^3+6(\omega_cs)^2+15\omega_cs+15}\\ \end{align}$$

$$\omega_c $$ may be found with Newton's method, or with root finding.

Finding attenuation frequency with Newton's method
Newton's method requires a known magnitude value and derivative magnitude value for the for $$|G(j\omega_c )|$$. However, it is easier to operate on $$|G(j\omega_c)G(-j\omega_c)|$$ and use the square of the desired cutoff gain, and is just as accurate, so the square terms will be used.

To obtain $$\omega_c $$, follow the steps below.


 * 1) If $$G(s)G(-s)$$ is not already available, multiply $$G(s)$$ by $$G(-s)$$ to obtain $$G(s)G(-s)$$.
 * 2) negate all terms of $$s^n$$ when $$(n+2)$$ is divisible by $$4$$.  That would be $$s^2$$, $$s^6$$, $$s^{10}$$, and so on.  The modified function will be called  $$G_2(s)G_2(-s)$$, and this modification will allow the use of real numbers instead of complex numbers when evaluating the polynomial and its derivative.  the real $$\omega_a$$can now be used in place of the complex $$j\omega_a$$
 * 3) Convert the desired attenuation in dB, $$A_{dB}$$, to a squared arithmetic gain value, $$B^2_{arith}$$, by using $$B^2_{arith} = 10^{A_{dB}/10}$$.  For example, 3.010 dB converts to 0.5, 1 dB converts to 0.79432823 and so on.
 * 4) Calculate the modified $$|G_2(s)G_2(-s)|$$ in Newton's method using the real value, $$\omega_a$$.  Always take the absolute value.
 * 5) Calculate the derivative the modified $$G_2(\omega_a)G_2(-\omega_a)$$ with respect to the real value, $$\omega_a$$.  DO NOT take the absolute value of the derivative.

When steps 1) through 4) are complete, the expression involving Newton's method may be written as:

$$\omega_a = \omega_a - ([G_2(\omega_a)G_2(-\omega_a)| - B^2)/(d[G_2(\omega_a)G_2(-\omega_a)]/d\omega_a)$$

using a real value for $$\omega_a$$with no complex arithmetic needed. The movement of $$\omega_a$$ should be limited to prevent it from going negative early in the iterations for increased reliability. When complete, $$\omega_a$$ can used for the $$\omega_c$$ that can be used to scale the original $$G(s)$$ transfer function denominator. The attenuation of the modified $$G(s)$$ will then be virtually the exact desired value at 1 rad/sec. If performed properly, only a handful of iterations are needed to set the attenuation through a wide range of desired attenuation values for both small and very large order filters.

Finding attenuation frequency from the roots
Since $$|G(j\omega_a )|$$ does not contain any phase information, directly factoring the transfer function will not produce usable results. However, the transfer function may be modified by multiplying it with $$G(-s)$$ to eliminate all odd powers of $$G(j\omega a)$$, which in turn forces $$G(j\omega a)$$ to be real at all frequencies, and then finding the frequency that result on the square of the desired attention.


 * 1) If $$G(s)G(-s)$$ is not already available, multiply $$G(s)$$ by $$G(-s)$$ to obtain $$G(s)G(-s)$$.
 * 2) Convert the desired attenuation in dB, $$A_{dB}$$, to a squared arithmetic gain value, $$B^2_{arith}$$, by using $$B^2_{arith} = 10^{A_{dB}/10}$$.  For example, 3.010 dB converts to 0.5, 1 dB converts to 0.79432823 and so on.
 * 3) Find $$P(S) = G_{num}(S)G_{num}(-S) - B^2_{arith}G_{den}(S)G_{den}(-S)$$
 * 4) Find the roots of P(S) using a root finding algorithm.
 * 5) Of the set of roots from above, select the positive imaginary root for off order filters, and positive real root for even order filters.
 * 6) Cutoff attenuations that are above the pass band ripple or below the stop band ripple will come back with multiple roots, so the correct root will have to be selected.

Obtaining the reflection coefficient, R(s)
for doubly terminated networks, networks with a finite resistive termination at both ends, the reflection coefficient, $$\rho(s)$$, is usually needed to synthesize the network. $$\rho(s)$$ is obtainable from the network transfer function $$T(s)$$, where $$T(S) = \frac{R_2}{R_1+R_2}G(S)$$, and $$R_1$$ and $$R_2$$ are the input and output termination resistances respectively. For simplicity, $$R_2$$ may be normalized to 1, yielding $$T(S) = \frac{1}{R_1+1}G(S)$$, and then the synthesized network may be denormalized later by impedance scaling.

$$\rho(s)$$ may be derived with use of two-port network scattering parameter theory, namely taking advantage of the relations below.

$$\begin{align} &|s_{11}|^2 + |s_{12}|^2=1 \\ &S_{12} = 2\sqrt{\frac{R_1}{R_2}}T(s) \\ &S_{12} = 2\sqrt{R_1}T(s) \\ \\ &T(S) = \frac{1}{R_1+1}G(S) \\ &R_2 \text{ is normalized to 1} \\ \end{align}$$

Since $$\rho(s)$$ is $$s_{11}$$, the deriving expression for $$\rho(s)$$ for normalized $$R_2$$ is below.

$$\rho(s)\rho(-s) = 1-4R_1T(s)T(-s) = \frac{T(s)_{den}T(-s)_{den}-4R_1T(s)_{num}T(-s)_{num}}{T(s)_{den}T(-s)_{den}}$$

Since the denominator of $$T(s)$$ is already known, only the numerator need be reconstructed, as shown.

$$\rho(s) = \frac{\sqrt{T(s)_{den}T(-s)_{den}-4R_1T(s)_{num}T(-s)_{num}}}{T(s)_{den}}$$

zeros selection to obtain $$\rho(s)_{num}$$ from $$\rho(s)_{num}\rho(-s)_{num}$$ follows the same guidelines as those for $$K(s)$$ above.

The special case where $$R_1=1$$ simplifies $$\rho(s)$$ substantially in that $$\rho(s)_{num}$$ reduces to $$K(s)_{num}$$. For design cases where $$R_1=1$$ and $$K(s)$$ is already known, $$K(s)_{num}$$ may be directly substituted for $$\rho(s)_{num}$$ and then $$\rho(s)$$ simplifies to the following:

$$\begin{align} &\rho(s) = \frac{K(s)_{num}}{G(s)_{den}} \\ \end{align} $$

When $$R_1=1 \text{ and }K(s) \text{ is known}$$

Obtaining the driving point impedance
The driving point impedance, $$Z_{j}(s)$$, the network impedance seen from the $$R_j$$ port, may be calculated directly from $$\rho_j(s)$$ for doubly terminated networks, and may be calculated directly from $$G(s)$$ for singly terminated networks.

Doubly terminated networks
Doubly terminated networks are networks with finite termination resistances at both ports. For these networks, $$Z_1(s)$$ may be found with algebraic manipulation of the following well known relation :

$$\rho_j(s) = s_{jj}(s) = \frac{Z_j(s) - R_j}{Z_j(s) + R_j}$$

Algebraic manipulation yields the following relation:

$$Z_j(s) = R_j\frac{1+\rho_j(s)}{1-\rho_j(s)}$$

To insure that the final $$R_2$$ remains normalized to 1, and for simplicity reasons, the driving point impedance is taken from port 2, which effectively drops $$R_j$$ from the expression above, and the network synthesis process will calculate $$R_1$$ as the last element, which in some cases is not assured to be the same as the design $$R_1$$. This translation is permissible because $$|\rho_1| = |\rho_2|$$. The final expression for the driving point impedance, $$Z_{in}$$, used to synthesize the network is then as follows, with $$\rho(s)$$ being computed from $$T(s)$$ shown above.

$$Z_{in}(s) = \frac{1+\rho(s)}{1-\rho(s)} = \frac{\rho_{den}(s)+\rho_{num}(s)}{\rho_{den}(s)-\rho_{num}(s)} $$

Singly terminated networks
Singly terminated networks are networks with no resistive termination at the source. For even order singly terminated networks, $$Z_{in}(s)$$ may be found by the following relation, where "even" and "odd" suffixes refer to the even and odd coefficients of the polynomial, respectively:

$$Z_{in}(s) = \frac{G_{den}(s)_{even}}{G_{den}(s)_{odd}}$$

for odd order networks, $$Z_{dps}(s)$$ may be found by the following :

$$Z_{in}(s) = \frac{G_{den}(s)_{odd}}{G_{den}(s)_{even}}$$

Obtaining the network parameters
For some passive network applications, such as coupling matrix synthesis, it is useful to know the Z parameters, and/or Y parameters of the designed network. When needed, these parameters may be extracted from $$Zin(s)$$ through Darlington's method without the need to synthesize the network.

Final filter designs
For passive networks, the final frequency and impedance normalized filter design elements may be found through network synthesis from the driving point impedance of port 2. The first element extracted will be attached to port 2, and the final element for singly terminated networks will be attached to port 1. The final element extracted from doubly terminated networks will be the port 1 termination resistance, $$R_1$$. Some networks contain a transformative step up or step down, and will result in a termination source resistance other than the design $$R_1$$. When this happens, a Norton capacitor or inductor transformer or coupled coil transformer will have to be installed, or the calculated $$R_1$$ will have to be substituted for the design $$R_1$$. The normalized design may be converted to a final design by denormalizing both the impedance and frequency.

Some active filters typologies, such as Sallen and Key, MFB, Tow-Thomas, and GIC, are synthesized directly on the $$G(s)$$ polynomials followed by denormalization of the impedance and frequency. Other active filters simulate the corresponding normalized passive network, such as leapfrog and FDNR typologies followed by denormalization.

Digital filters may be synthesized from $$G(s)$$ and the desired sample rate using digital transformations such as bilinear transform, impulse invariance, or other desired digital transformation.