Source: http://onmyphd.com/?p=bode.plot

- Laplace transform
- System transfer function

A Bode plot is a graphical representation of a linear, time-invariant system transfer function. In a linear system, any sinusoidal that inputs the system is only changed in **magnitude**, when it is amplified or attenuated, and **phase**, when delayed. Therefore, the system can be described for every frequency, just by its gain and phase shift. The bode plots simply trace the gain and phase shift of the system to a range of frequencies. There are two bode plots, one plotting the magnitude (or gain) versus frequency (**Bode Magnitude plot**) and another plotting the phase versus frequency (**Bode Phase plot**). They are represented with the frequency in a logarithmic scale, the magnitude in decibels (20log_{10}(magnitude)) and the phase in a linear scale.

There are two ways of drawing a bode plot. One is taking the magnitude and phase of the system transfer function at each frequency and drawing the plot with those points. The other, called **asymptotic bode plot**, considers straight lines between poles or zeros and has some simple rules for the slopes of those lines. Given its simplicity, these can be drawn by hand.

A linear system is composed of poles and zeros, expressed in the form: $$H(s) = A\frac{(s/z_0 + 1)(s/z_1 + 1)\cdots(s/z_n + 1)}{(s/p_0 + 1)(s/p_1 + 1)\cdots(s/p_n + 1)}$$ where $A$ is the gain of the system, $z_0, z_1, ..., z_n$ are the location of the zeros and $p_0, p_1, ..., p_n$ are the location of the poles. The poles and zeros can be in the left hand plane (LHP) or right hand plane (RHP). If we divide the range of values for the poles/zero between negative and positive, the LHP has the negative poles/zeros and the RHP has the positive poles/zeros.

The expression comes from the Laplace transformation of the transfer function from the time domain. For example, a simple first-order low pass filter has a single pole, while a first-order high pass filter has a pole and a zero. The concatenation of these and other higher-order (more poles and zeros) linear systems can give rise to a large expression, but always with the factorization of poles and zeros as in the expression above.

**The rules for drawing the magnitude plot** are the following:

- The plot starts with a horizontal line at a magnitude equal to the DC magnitude of the system ($H(0) = A$)
- For every pole, the slope of the line decreases by 20 dB/decade of frequency at that pole's frequency
- For every zero, the slope of the line increases by 20 dB/decade of frequency at that zero's frequency
- For every pole or zero at zero frequency, the plot starts with the effect of that pole/zero on the slope. Zeros and poles at zero frequency are represented as :
$$H(s)= As$$
$$H(s)= A\frac{1}{s}$$
which means that at frequency 1 rad/s, the magnitude must be equal to the DC magnitude $A$. Then, the trace of the plot must cross $A$ at 1 rad/s and be backtracked to the starting frequency of the plot.
- For multiple zeros or poles at the same frequency, the slope of the line changes according to that number

**The rules for drawing the phase plot** are the following:

- Start the plot with a horizontal line at 0º phase if the gain is positive or -180º if the gain is negative (negative gain corresponds to an inverted sinusoid and thus to a 180º phase between input and output)
- For each LHP pole or RHP zero, decrease the slope by 45º/decade one decade before the pole/zero, and increase by the same amount one decade after the pole/zero. After two decades, the phase will be -90º than before for each pole/zero.
- For each RHP pole or LHP zero, increase the slope by 45º/decade one decade before the pole/zero, and decrease by the same amount one decade after the pole/zero. After two decades, the phase will be +90º than before for each pole/zero.
- For each pole or zero at zero frequency, the plot starts with the effect of that pole/zero on the phase. For a pole:
$$ \angle H(s) = \angle \frac{1}{s} = \angle \frac{1}{j\omega} = \angle -\frac{j}{\omega} = \tan^{-1} -\frac{1/\omega}{0} = \tan^{-1}{-\infty} = -90º.$$
For a zero:
$$ \angle H(s) = \angle s = \angle j\omega = \tan^{-1} \frac{\omega}{0} = \tan^{-1}{\infty} = 90º.$$
Since bode plots are drawn in logarithmic scale, we never see the zero frequency. Hence, for frequencies just above zero, the ratio above for the zero is not indeterminate and leads to 90º.

The magnitude of the system is taken from the absolute value of the magnitude: $$|H(s)| = \left|A\frac{(s/z_0 + 1)(s/z_1 + 1)\cdots(s/z_n + 1)}{(s/p_0 + 1)(s/p_1 + 1)\cdots(s/p_n + 1)} \right|$$ $$|H(s)| = |A|\sqrt{\frac{((\omega/z_0)^2 + 1)((\omega/z_1)^2 + 1)\cdots((\omega/z_n)^2 + 1)}{((\omega/p_0)^2 + 1)((\omega/z_1)^2 + 1)\cdots((\omega/z_n)^2 + 1)}}$$ The phase of the system is taken from the contribution of each pole and zero for the total phase. $$\angle H(s) = \angle A - \tan^{-1}(\frac{\omega}{z_0}) - \tan^{-1}(\frac{\omega}{z_1}) - \cdots - \tan^{-1}(\frac{\omega}{z_n}) + \tan^{-1}(\frac{\omega}{p_0}) + \tan^{-1}(\frac{\omega}{p_1}) + \cdots + \tan^{-1}(\frac{\omega}{p_n})$$ Now let's compare the asymptotic plots with the transfer function plots. You can add poles and zeros to the transfer function and verify the rules for yourself. The plot starts with a pole at -10 rad/s and a zero at -10 Krad/s. You can make your own examples by changing these poles/zeros and adding more.

Try out these examples: $$H(s) = \frac{s+1}{\left(\frac{s}{10}+1\right)\left(\frac{s}{100}+1\right)}$$ $$H(s) = \frac{\frac{s}{10}+1}{s\left(\frac{s}{3}+1\right)}$$ $$H(s) = \frac{s}{\left(s+1\right)^2 \left(\frac{s}{10}+1\right)}$$

$H(s)$ | zeros | ||

poles |

Up until now we dealt with real poles and zeros: the asymptotic plots are pretty close to the transfer function plots. But what if the poles or zeros are complex? Will the rules for drawing the asymptotic plots change? Will the approximation still be good?

Notice that we took the real part of the poles or zeros to draw the plots (which in the previous case was all there was). Now we have some imaginary parts to account for. If we take the real part of the complex poles or zeros, the asymptotic approximation does not capture the effect of the imaginary part. First of all, complex poles or zeros come in pairs, so for every complex zero or pole, the transfer function will also have its conjugate (with the imaginary part negated).

For a pair of roots $\omega \pm i\sigma$, the expression:
$$ (s + \omega + i\sigma)(s + \omega - i\sigma) = s^2 + 2\omega s + \sigma^2 + \omega^2$$
can be converted to the form
$$ s^2 + 2\xi\omega_ns + \omega_n^2.$$
That is, the natural frequency created by the conjugate pair is $\omega_n = \sqrt{\sigma^2 + \omega^2}$ and the damping ratio (how fast the oscillation fades away) is $\xi = \omega/\omega_n$. In other words, **the magnitude plot will change slope around the natural frequency (not the real part of the root)**, which can be calculated as above or by making a simpler approximation of the maximum of the real and imaginary parts.

However, the peaking that exists when the damping ratio is too low is not captured.

Regarding the phase plot, we can use the same rules, but by **changing the pole/zero frequency by the natural frequency of the conjugate pair**. That will give a better approximation, but for small damping ratios ($\sigma > \omega$), the slope of the phase is much bigger than what expected by using the rules. We can however make some better approximations as described in here. The following table shows three approximations, by stating at what frequency the asymptotic phase starts to change and at what frequency it stops changing.

Starts changing at | $\omega_n \frac{log_{10}\left(2 /\xi\right)}{2}$ | $\omega_n \left(\frac{1}{5}\right)^\xi$ | $\omega_n \frac{1}{1+5\xi}$ |
---|---|---|---|

Stops changing at | $\omega_n \frac{2}{log_{10}\left(2/\xi\right)}$ | $\omega_n 5^\xi$ | $\omega_n (1+5\xi)$ |

Now you can add imaginary parts to the poles and zeros and see how they affect the bode plot of the transfer function. The asymptotic approximation takes the natural frequency as the points of change.

Try out these examples: $$H(s) = \frac{\frac{s}{10}+1}{s^2+3s+50}$$ $$H(s) = \frac{s^2+s+25}{s^2 \left(\frac{s}{100}+1\right)}$$

$H(s)$ | zeros | +j | |

poles | +j |

- A PDF bode plot template for you to draw your own plots on paper (from Wikipedia)