# Signal Processing/Analog Filters
## Analog Filters

Historically, electric signal processing started with analog circuits. Signal analysis and filter design methods first based on these kind of circuits. Later came the avent of digital systems. The first digital filters relied on the techniques used for their analog parents. Still today, some digital filters rely on the simulation of analog filters in order to profit from some of their interesting properties.

## Passive Filters
### Lumped Elements Filters

Lumped elements filters base on the frequency characteristics of the following components:
* the resistance, R
* the capacitance, C
* the inductance, L
Their characteristics are given by:
       $U=R\cdot I$
       $U={\frac {1}{sC}}\cdot I$
       $U=sL\cdot I$

#### Ladder filters

The following image shows a 4th order all-pole lowpass ladder filter:
The overall appearance of the circuit explains the name.
In the drawing, the source and load resistance are identical. This corresponds to the situation with the best energy transfer from source to load. At DC, the inductances act as short circuits and the capacitances as open circuits. Hence the output amplitude will be half of the one of the input.
Doubly terminated ladder filters show to have excellent passband sensitivity properties . In other terms, a given change in L or C element values results in a much smaller relative change in the filter transfer function. Because of this, ladder filters have been widely used as a model for analog active filters and for digital filters.

### Filters with Distributed Elements

A distributed element filter is an electronic filter in which capacitances, inductances and resistances (the elements of the circuit) are not localised in discrete (lumped) elements as they are in conventional filters. At high frequencies, in the microwave region, the strips on a printed circuit board act as impedances and a careful design of them allows to implement filter functions.

## Active Filters

Active filters are analog filters using amplifying devices such as operational amplifiers. They allow to realize filter functions with resistances and capacitances, freing the designer of the need to use inductances.

### Canonical filters

The first attempts to realize active filters was to devise a circuit realizing the transfer function, with R and C element value combinations corresponding to the transfer function's numerator and denominator coefficients: the canonical filters. However, this kind of circuits showed to be very sensitive to element values: a small change in an R or C element value had a large effect on the transfer function.
For that reason, the design of active filters has shifted from canonical filters to other structures such as chains of second order sections or leapfrog filters.

### Chain of Second Order Sections

A second order section, often referred as biquad, implements a second order transfer function. The transfer function of a filter can be split into a product of transfer functions each associated to a pair of poles and possibly a pair of zeroes.
The transfer function of a system given with an equal number of complex conjugate zeroes, $z_{i}$ and $z_{i}^{*}$, and poles $p_{i}$ and $p_{i}^{*}$, together with a gain $k$ is:
    $H(s)=k\cdot \prod _{i=1}^{N/2}{\frac {(s-z_{i})(s-z_{i}^{*})}{(s-p_{i})(s-p_{i}^{*})}}$
This is the case for Chebyshev type 2 and Elliptic filter functions.
Writing:
    $D_{i}(s)=(s-p_{i})(s-p_{i}^{*})=s^{2}-2Re(p_{i})s+abs(p_{i})^{2}=s^{2}+a_{1i}s+a_{0i}$
shows that the denominator polynomial functions of $s$ have real coefficients. The same can be said for the numerator. With this, the transfer function can be rewritten as:
    $H(s)=k\cdot \prod _{i=1}^{N/2}{\frac {s^{2}+b_{1i}s+b_{0i}}{s^{2}+a_{1i}s+a_{0i}}}$
If the transfer function's order is odd, then a first order section has to be added to the chain. This section is associated to the real pole $p_{r}$ and to the real zero $z_{r}$, if there is one. The transfer function becomes:
    $H(s)=k\cdot {\frac {s-z_{r}}{s-p_{r}}}\cdot \prod _{i=1}^{{N-1}/2}{\frac {s^{2}+b_{1i}s+b_{0i}}{s^{2}+a_{1i}s+a_{0i}}}$
An all-pole even order transfer function is in the form:
    $H(s)=k\cdot \prod _{i=1}^{N/2}{\frac {1}{(s-p_{i})(s-p_{i}^{*})}}=k\cdot \prod _{i=1}^{N/2}{\frac {1}{s^{2}+a_{1i}s+a_{0i}}}$
This is the case for Butterworth, Chebyshev type 1 and Bessel filter functions.
An all-pole odd order transfer function is in the form:
    $H(s)=k\cdot {\frac {1}{s-p_{r}}}\cdot \prod _{i=1}^{{N-1}/2}{\frac {1}{s^{2}+a_{1i}s+a_{0i}}}$

#### State Variable Filters

State Variable Filters have a topology with two integrators whose outputs correspond to the state-space variables associated with the transfer function.
The following circuit was proposed by Kerwin, Huelsman and Newcomb :
The following circuit is know as the Tow-Thomas circuit :
It is possible with both the Kerwin-Huelsman-Newcomb and the Tow-Thomas to build a weighted sum of all op-amp outputs in order to obtain a more generic transfer function.
Certain second order canonical structures directly use the transfer function's coefficients as amplifier gains.

#### Sallen and Key circuits

The Sallen–Key topology uses an operational amplifier to drive the output and R C elements to set the transfer function. Due to the driving capacity of operational amplifiers, Sallen–Key circuits are easily cascaded to form a higher order filters.
The following circuits shows a Sallen–Key lowpass filter circuit:

### Leapfrog Filters
#### Filter Structure

Leapfrog filters are based on the simulation of passive ladder filters. The incentive for this choice is to inherit from the excellent passband sensitivity properties of the original circuit.
Taking the example of the following 4th order all-pole lowpass ladder filter,
one can write the following equations:
       ${\begin{cases}sC_{1}\cdot U_{1}={\frac {1}{R}}\cdot (U_{in}-U_{1})-I_{2}\\sL_{2}\cdot I_{2}=U_{1}-U_{3}\\sC_{3}\cdot U_{3}=I_{2}-I_{4}\\sL_{4}\cdot I_{4}=U_{3}-R\cdot I_{4}\\U_{out}=R\cdot I_{4}\end{cases}}$
Rewriting these equations gives:
       ${\begin{cases}U_{1}={\frac {1}{sRC_{1}}}(U_{in}-U_{1}-RI_{2})\\RI_{2}={\frac {R}{sL_{2}}}(U_{1}-U_{3})\\U_{3}={\frac {1}{sRC_{3}}}(RI_{2}-RI_{4})\\RI_{4}={\frac {R}{sL_{4}}}(U_{3}-RI_{4})\\U_{out}=RI_{4}\end{cases}}$
This new set of equations shows that the filter can be implemented with a chain of 4 integrators with:
* state variables having the form of $w_{i}=U_{i}$ or $w_{i}=RI_{i}$
* time constants having the form of $t_{i}=RC_{i}$ or $t_{i}={\frac {L_{i}}{R}}$
The resulting circuit is an integrator chain where each integrator output is brought back to the preceeding integrator input. Hence the name Leapfrog.

#### Transfer Function

The set of equations describing the filter can be rewritten using the state space representation as:
    ${\begin{array}{ccrcccccc}s\cdot {\begin{bmatrix}U_{1}\\RI_{2}\\U_{3}\\RI_{4}\end{bmatrix}}&=&{\begin{bmatrix}-{\frac {1}{t_{1}}}&-{\frac {1}{t_{1}}}&0&0\\{\frac {1}{t_{2}}}&0&-{\frac {1}{t_{2}}}&0\\0&{\frac {1}{t_{3}}}&0&-{\frac {1}{t_{3}}}\\0&0&{\frac {1}{t_{4}}}&-{\frac {1}{t_{4}}}\end{bmatrix}}&\cdot &{\begin{bmatrix}U_{1}\\RI_{2}\\U_{3}\\RI_{4}\end{bmatrix}}&+&{\begin{bmatrix}{\frac {1}{t_{1}}}\\0\\0\\0\end{bmatrix}}&\cdot &U_{in}\\U_{out}&=&{\begin{bmatrix}0&0&0&1\end{bmatrix}}&\cdot &{\begin{bmatrix}U_{1}\\RI_{2}\\U_{3}\\RI_{4}\end{bmatrix}}&+&{\begin{bmatrix}0\end{bmatrix}}&\cdot &U_{in}\end{array}}$
From this equation set, one can write the A, B, C, D matrices as:
    $A={\begin{bmatrix}-{\frac {1}{t_{1}}}&-{\frac {1}{t_{1}}}&0&0\\{\frac {1}{t_{2}}}&0&-{\frac {1}{t_{2}}}&0\\0&{\frac {1}{t_{3}}}&0&-{\frac {1}{t_{3}}}\\0&0&{\frac {1}{t_{4}}}&-{\frac {1}{t_{4}}}\end{bmatrix}}$
    $B={\begin{bmatrix}{\frac {1}{t_{1}}}\\0\\0\\0\end{bmatrix}}$
    $C={\begin{bmatrix}0&0&0&1\end{bmatrix}}$
    $D={\begin{bmatrix}0\end{bmatrix}}$
From this representation, signal processing tools such as Octave or Matlab allow to plot the filter's frequency response or to examine its zeroes and poles.

### Switched-Capacitor Filters

Switched-capacitor filters are analog sampled devices. Charging and discharging a capacitor can show to produce an impedance close to the one of a resistance. With this, RC time constants of an analog active filter are changed into a factor proportional to the ratio of two capacitances. This kind of circuit is most interesting for integrated circuit design, where R and C element values can largely vary from one die to another, whilst the ratio of two capacitances in the same region of a silicon device remains very precise.

## References

* ↑ Johns David A.; et al. (1989). "Orthonormal Ladder Filters" (PDF). IEEE Transactions on Circuits and Systems. New York, IEEE Circuits and Systems Society. 36 (3): 337–343. {{cite journal}}: Explicit use of et al. in: |author= (help)
* ↑ Kerwin, W.J. Huelsman, L.P. Newcomb, R.W. (1967). "State-Variable Synthesis for Insensitive Integrated Circuit Transfer Functions". IEEE Journal of Solid-State Circuits. 2 (3): 87–92.{{cite journal}}: CS1 maint: multiple names: authors list (link)
* ↑ Lee C. Thomas (1971). "The Biquad: Part I-Some practical design considerations". IEEE Transactions on Circuit Theory. 18 (3): 350–357.