Frequency domain analysis of signals and control systems
Aleksei Tepljakov
Lecture outline
- Fourier Series and Transform
- Laplace Transform
- Frequency Domain Analysis
- Stability Margins and Robust Control
- PID Control Case Studies (live demo)
Periodic functions
A function $f(x)$ is called a periodic function with a period $p$, if for all $x$ there holds
\begin{equation}
f(x+p) = f(x).
\end{equation}
If $f(x)$ has a period $p$, then it also has a period $2p$, $3p$, and so on. In general,
\begin{equation}
f(x+np) = f(x),
\end{equation}
where $n=1,2,3,\dots$.
In what follows, we will consider the representation of functions $f(x)$ of period $2\pi$.
Fundamental trigonometric functions
The phase difference between $\sin(x)$ and $\cos(x)$ is $\frac{\pi}{2}$ rad.
Fourier series
Suppose that $f(x)$ is a function of period $2\pi$ that can be represented by a convergent series of the form
\begin{multline}
f(x) = a_0 + a_1 \cos x + b_1\sin x\\
+ a_2 \cos 2x + b_2 \sin 2x + \cdots.
\end{multline}
Then, the Fourier series of $f(x)$ is given by
\begin{equation}
f(x) = a_0 + \sum_{n=1}^{\infty}(a_n \cos nx + b_n \sin nx),
\end{equation}
where $a_0$, $a_n$, and $b_n$ are called the Fourier coefficients.
Fourier coefficients
Assuming $f(x)$ is known, the Fourier coefficients can be computed using the Euler formulas:
\begin{eqnarray}
a_0 & = & \frac{1}{2\pi}\int_{-\pi}^{\pi} f(x){\rm d}x,\\
a_n & = & \frac{1}{\pi}\int_{-\pi}^{\pi} f(x) \cos(nx) {\rm d}x,\\
b_n & = & \frac{1}{\pi}\int_{-\pi}^{\pi} f(x) \sin(nx) {\rm d}x,
\end{eqnarray}
for $n=1,2,3,\dots$. These coefficients comprise the spectrogram of the studied signal.
Spectrograms for common signals
Importance of Fourier Analysis
- Every periodic function (or signal) has a corresponding Fourier series representation.
- Constant signals can be seen as periodic functions with relatively long periods.
- Therefore, every signal $u(t)$ has a Fourier series representation, that is, every signal can be seen as a combination of fundamental harmonic functions.
Interactive Fourier series demo
Fourier Transform for identification
When the FFT of the input signal $u(t)$ is known, measure the output signal $y(t)$, and process it with FFT. Then, use the difference in input/output signal spectrum to figure out the system model. Above: process identification for PID tuning.
Differential equations and transfer functions
A linear, continuous-time, single input, single output dynamic system can be expressed by a differential equation
\begin{multline}
\def\dif{\mathrm{d}}
\def\dft#1{\frac{\dif#1}{\dif t}}
\def\dftn#1#2{\frac{\dif^{#2}#1}{\dif t^{#2}}}
a_{n}\dftn{y(t)}n+a_{n-1}\dftn{y(t)}{n-1}+\cdots+a_{1}\dftn{y(t)}{}+a_{0}y(t)=\\
b_{m}\dftn{u(t)}m+b_{m-1}\dftn{u(t)}{m-1}+\cdots+b_{1}\dftn{u(t)}{}+b_{0}u(t),
\end{multline}
where $a_k,b_k\in\mathbb{R}$.
Applying the Laplace transform to the DE with zero initial conditions we obtain the transfer function representation of the dynamic system
\begin{equation}
G(s)=\frac{Y(s)}{U(s)}=\frac{b_{m}s^{m}+b_{m-1}s^{m-1}+\cdots+b_{1}s+b_{0}}{a_{n}s^{n}+a_{n-1}s^{n-1}+\cdots+a_{1}s+a_{0}}.\label{eq:Gs}
\end{equation}
Frequency domain analysis
Recall that for a function $f(x)$ the Fourier series is given by
\begin{equation}
f(x) = a_0 + \sum_{n=1}^{\infty}(a_n \cos nx + b_n \sin nx),
\end{equation}
which means that any signal $u(t)$ can be represented by a Fourier series, i.e., as an infinite sum of weighted harmonic functions.
Now, consider an input signal $u(t)=U\sin(\omega t)$ passed through an asymptotically stable transfer function $H(s)$ such that
\[
\stackrel{u(t)}{\longrightarrow}\boxed{H(s)}\stackrel{y(t)}{\longrightarrow}
\]
Steady-state output will be $y(t)=U \left|H(j\omega)\right|\sin\left(\omega t+\angle H(j\omega)\right)$.
Frequency domain analysis (continued)
To construct the magnitude and phase responses of a system represented by a transfer function $G(s)$ with a transport delay $L$, substitute $s=j\omega$. Then, for
\begin{equation} G(j\omega)=\frac{b_{m}(j\omega)^{m}+b_{m-1}(j\omega)^{m-1}+\cdots+b_{1}(j\omega)+b_{0}}{a_{n}(j\omega)^{n}+a_{n-1}(j\omega)^{n-1}+\cdots+a_{1}(j\omega)+a_{0}}{\rm e}^{-L(j\omega)}
\end{equation}
at a particular frequency $\omega_k$ we have
\begin{equation}
A_{k}=\left|G(j\omega_{k})\right|,\quad\phi_{k}=\arg(G(j\omega_{k}))=\angle G(j\omega_{k}),
\end{equation}
where $|\cdot|$ denotes the absolute value, and $\arg(\cdot)$—the argument (or angle, in radians) of the complex value $G(j\omega_k)$.
Recall: polar form of complex numbers
\[
\left|z\right|=r=\sqrt{a^{2}+b^{2}},\quad\arg(z)=\angle z=\theta=\arctan\left(\frac{b}{a}\right).
\]
Frequency domain analysis (continued)
Frequency domain characteristics completely describe the behavior of a linear, time-invariant system. Frequency response is graphically represented in the following ways:
- Bode plot—two separate graphs for magnitude and phase against frequency, usually on logarithmic scales;
- Nyquist plot—a single graph depicting real vs. imaginary parts of the response covering the full frequency range;
- Nichols plot—a single graph depicting magnitude vs. argument.
Since it is possible to assess qualitative properties of the linear system under study (e.g., relative stability margins), frequency domain analysis is essential in control design.
Bode plot (continued)
Bode frequency analysis
To study the frequency response of a system it is useful to rewrite the transfer function $G(s)$ in Bode form:
\[
G(s) = \frac{K}{s^h} \cdot \frac{\displaystyle \prod_{i=1}^{N}(1+s\tau_i)}{\displaystyle\prod_{j=1}^{M}(1+sT_j)}\cdot\frac{\displaystyle\prod_{i=1}^{P}(1+\frac{2\xi'_i}{\omega'_{ni}}s+\frac{1}{\omega'^2_{ni}}s^2)}{\displaystyle\prod_{j=1}^{Q}(1+\frac{2\xi_j}{\omega_{nj}}s+\frac{1}{\omega^2_{nj}}s^2)},
\]
where $K$ is the Bode gain; $h$ is the type of system, i.e., the number of poles in $s=0$; $T_j$ (for real $T_j>0$) is a time constant; $\xi_j$ is a damping ratio, with $-1<\xi_j<1$; and $\omega_{nj}$ is a natural frequency of the system.
Analysis using Bode form
Nyquist (polar) plot
- The Nyquist plot (named after Harry Nyquist), also called polar plot, is the graph in polar coordinates of $G(j\omega)$ for $\omega\in[0,+\infty)$ in the complex plane.
- The Nyquist plot combines the Bode magnitude and phase plot on a single plot and therefore provides a more compact representation.
- Stability assessment: For an open-loop asymptotically stable system $G(s)$, the closed-loop system $W(s)$ is asymptotically stable if and only if the Nyquist plot $G(j\omega)$ does not encircle clockwise the critical point $-1+j0$.
Example: First-order system
$G_1$: Bode plot
$G_1$: Nyquist plot
$G_1$: Sine wave response ($\omega=1.47$)
$G_1$: Step response
Example: Second-order system
$G_2$: Bode plot
$G_2$: Nyquist plot
$G_2$: Sine wave response ($\omega=0.446$)
$G_2$: Step response
Relative stability margins
- Assume $N(s)=C(s)G(s)$ is open-loop asymptotically stable
\[ \stackrel{r(t)}{\longrightarrow}\boxed{C(s)}\stackrel{u(t)}{\longrightarrow}\boxed{G(s)}\stackrel{y(t)}{\longrightarrow}
\]
- Let $\omega_c$ be the gain crossover frequency: $|N(j\omega_c)|=1$. The phase margin is the quantity
\[
\varphi_m = \angle N(j\omega_c)-(-\pi).
\]
- Let $\omega_p$ be the phase crossover frequency: $\angle N(j\omega_p)=-\pi$. The gain margin is the quantity
\[
G_m = 20 \log_{10} \frac{1}{|N(j\omega_p)|}.
\]
Stability margins on Bode plot
Stability margins on Nyquist plot
Robust control
- The characteristics of real-life systems may change during operation, and frequency characteristics may get shifted from the nominal case potentially causing instability.
- For robustness of stability, the values of the gain and phase margins should be as large as possible.
- The phase margin is linked to damping of the system.
- Gain and phase margins should be chosen such that a balance is achieved between ensuring stability, fast reference tracking, and disturbance rejection.
Example: Negative stability margins
Suppose that the plant to be controlled is described by the transfer function
\[
G(s)=\frac{1}{1+s+5s^2}.
\]
A PI controller is used with $K_p=K_i=1$:
\[
C(s)=1+s^{-1}.
\]
Let us observe what happens in this case. In MATLAB, we can use the margin(sys)
command.
Bode plot of open-loop control system
Closed-loop system: intended operation
When we close the loop, we expect to have
Negative unity feedback introduces a phase lag of $-180^{\circ}$ between the error input $e(t)$ and output $y(t)$. The error converges to zero as the output reaches the reference value $r(t)$.
Closed-loop system: positive feedback
However, the following situation is possible
when the phase lag between error input and output is $-360^{\circ}$. In this case, the output signal is in phase with the error input signal, and, if amplified with gain $K>1$, it grows uncontrollably.
Open-loop system analysis
Open-loop system analysis: magnitude
Certain frequency components of the input signal are amplified with a gain $K>1$. Any transient input signal has these components, even if they have infinitesimally small amplitudes at given frequencies.
Open-loop system analysis: phase
In a closed-loop system, these same frequency components are fed back with a phase shift $\varphi<-360^{\circ}$ which means they effectively contribute to positive feedback. A signal in phase with itself is quickly added up and grows uncontrollably. The system is unstable.
Open-loop system analysis: Nyquist plot
Closed-loop step response
BODEPID tool for MATLAB: UI
BODEPID tool for MATLAB: UI
BODEPID tool for MATLAB: UI
BODEPID tool for MATLAB: UI
BODEPID tool for MATLAB: UI
BODEPID tool for MATLAB: UI
Case study: Heating furnace
Case study: Coupled tanks
Laboratory model of the coupled tanks system
Case study: Coupled tanks
Case study: Modular servo system
Servo system manufactured by INTECO
Case study: Modular servo system
Further reading
- K. Ogata, Modern Control Engineering, 5th edition, Prentice Hall, 2009.
- E. Kreyszig, Advanced Engineering Mathematics, 10th edition, John Wiley & Sons, 2010.
- N. Nise, Control Systems Engineering, 6th edition, John Wiley & Sons, 2011.