# Signals and Systems/Second Order Transfer Function

The second order transfer function is the simplest one having complex poles. Its analysis allows to recapitulate the information gathered about analog filter design and serves as a good starting point for the realization of chain of second order sections filters.

## All-Pole Second Order Transfer Function
### Transfer Function

The transfer function of a continuous-time all-pole second order system is:
    $H(s)={\frac {b_{0}}{s^{2}+a_{1}s+a_{0}}}$
Note that the coefficient of $s^{2}$ has been set to 1. This simplifies the writing without any loss of generality, as numerator and denominator can be multiplied or divided by the same factor.
The frequency response, taken for $s=i\omega$, has a DC amplitude of:
    $H(i\omega =0)={\frac {b_{0}}{a_{0}}}$
For very high frequencies, the most important term of the denominator is $(i\omega )^{2}$ and the frequency response gets closer and closer to:
    $H(i\omega )\cong {\frac {b_{0}}{(i\omega )^{2}}}$
At high frequencies, the amplitude response looks like a (squared) hyperbol in a linear plot and like a straight line with a negative slope in a log-log plot. Plotting the frequencies in decades and the amplitude in decibels reveals a slope of -40 [dB/decade].
Having a given amplitude at DC and an amplitude nearing zero at high frequencies indicates that the transfer function is of lowpass type.

### Poles

The poles of the system are given by the roots of the denominator polynomial:
    $p,p^{*}={\frac {-a_{1}\pm {\sqrt {a_{1}^{2}-4a_{0}}}}{2}}$
If the term inside the square root is negative, then the poles are complex conjugates. This is the general case in filter design: there is poor interest in a second order transfer function having two real poles.
From the location of the poles, the transfer function can be rewritten as:
    $H(s)={\frac {k}{(s-p)(s-p^{*})}}={\frac {k}{s^{2}-2Re(p)s+abs(p)^{2}}}$
The amplitude of the poles gives the corner frequency of the filter. The corner frequency is defined as the abscissa of the point where the horizontal and the -40 [dB/decade] lines meet in the log-log magnitude response plot. Note that this is not necessarily the -3 [dB] attenuation frequency of the filter.
    $\omega _{0}=abs(p)={\sqrt {a_{0}}}$
The ratio between the real part of the poles and the corner frequency is proportional to the damping, or inversely proportional to the quality factor of the system.
    $\zeta ={\frac {-Re(p)}{\omega _{0}}}={\frac {a_{1}}{2\omega _{0}}}$
    $Q={\frac {1}{2\zeta }}={\frac {\omega _{0}}{-2Re(p)}}={\frac {\omega _{0}}{a_{1}}}$
The closer the poles are to the imaginary axis, the more a resonance will appear at a frequency smaller but close to the corner frequency of the system.

### Transfer Function Rewritten

With this, the transfer function with unity gain at DC can be rewritten as a function of the corner frequency and the damping in the form:
    $H(s)={\frac {\omega _{0}^{2}}{s^{2}+2\zeta \omega _{0}\cdot s+\omega _{0}^{2}}}$
Both $s$ and $\omega _{0}$ have a unit of [s$^{-1}$]. $\zeta$ has a unit of [1] and so does the total transfer function.

## Biquadratic Second Order Transfer Function
### Transfer Function

The name biquadratic stems from the fact that the functions has two second order polynomials:
    $H(s)={\frac {b_{2}s^{2}+b_{1}s+b_{0}}{s^{2}+a_{1}s+a_{0}}}$

### Poles

The poles are analysed in the same way as for an all-pole second order transfer function. They determine the corner frequency and the quality factor of the system.

### Zeroes

The zeroes are used to affect the shape of the amplitude response:
* Placing zeroes on the imaginary axis at frequencies a little higher than the corner frequency gives more attenuation in the stopband and allows a faster transition from passband to stopband. This is what happens with Chebyshev type 2 and elliptic filter functions.
* Placing the zeroes on the imaginary axis precisely at the corner frequency forces the amplitude to zero at that specific point. This corresponds to a bandstop (or notch) function.
* Placing a single zero at the (0, 0) coordinate of the s-plane transforms the function into a bandpass one. This is done by setting coefficients $b_{2}=0$ and $b_{0}=0$.
* Placing both zeroes at the (0, 0) coordinate transforms the function into a highpass one. This is done by setting coefficients $b_{1}=0$ and $b_{0}=0$.
* Placing the zeroes on the right half plane, symmetrically to the poles gives an allpass function: any point on the imaginary axis is at the same distance from a zero and from the associated pole. This allpass function is used to shape the phase response of a transfer function.

## Example
### 6th Order Normalized Butterworth Filter

The poles of the Butterworth filter are regularly spaced on the left half of a circle centered at the origin of the complex plane. Each complex conjugate pole pair builds a second order all-pole transfer function. The product of these second order functions gives the 6th order Butterworth transfer function.

#### Pole Pairs

In the figure on the side, the pole $p_{1}$ and its complex conjugate are close to the imaginary axis. Their amplitude response will show an overshoot at the corner frequency. This corresponds to an underdamped case and the second order section will show some resonance at frequencies close to the corner frequency.
The pole $p_{2}$ and its complex conjugate are at 45° in respect to the imaginary axis. Their amplitude response will show 3 dB loss at the corner frequency. It is the limiting case where the amplitude response shows no overshoot. Nevertheless, this doesn't correspond to a critically damped case: the step response will have overshoots before stabilization.
The pole $p_{3}$ and its complex conjugate are far away from the imaginary axis. Their amplitude response will show a large attenuation at the corner frequency. This corresponds to an overdamped case.

#### Amplitude Responses

The following Octave code allows to plot the amplitude responses of the individual second order sections and of the global Butterworth amplitude response:
The blue curve on the side shows the global amplitude response.
The green curves are the responses of the individual second order sections. They all have a hozizontal asymptote towards DC. They also all have a -40 dB/decade asymptote for high frequencies. Both asymptotes cross at the point ($\omega =1$ [s$^{-1}$], $A=0$ [dB]). The corner frequency is found at $\omega =1$ [s$^{-1}$] or $f=1/{(2\pi )}$ [Hz]

#### High-Q Second Order Function

The top green amplitude response shows what a response with a high quality factor looks like. It has a maximum of more than 0 dB (here 6.02 dB) at a frequency a little below the corner frequency. At the corner frequency, the amplitude has already fallen down (here to 5.68 dB).

#### Maximally Flat Second Order Function

The middle green amplitude response shows what a maximally flat response looks like. It has an amplitude of -3.02 dB at the corner frequency.
Whatever its order, a Butterworth function shows the same -3.02 dB loss at the corner frequency.

#### Low-Q Second Order Function

The bottom green amplitude response shows what a response with a low quality factor looks like. It has an amplitude of less than -3 dB (here -5.72 dB) at the corner frequency.