Control:
Frequency Response
Table of Contents
1. Sinusoidal Steady-State Analysis¶
Previously, we studied the time-domain response of linear systems to arbitrary inputs and initial conditions. We also examined how standard systems behave when subjected to simple inputs.
In this section, we focus on the steady-state response of linear time-invariant (LTI) systems to sinusoidal inputs. This form of analysis is fundamental in understanding the frequency-domain characteristics of systems.
1.1. Response to a Sinusoidal Input¶
We are now interested exclusively in the steady-state component of the response. The transient part, which decays over time in stable systems, is no longer of concern.
To characterize system behavior in the frequency domain, we apply sinusoidal inputs of varying frequencies and observe the steady-state output.
Let $x(t) = e^{j\omega t}$ be the complex exponential input to an LTI system with impulse response $h(t)$. The system output is given by the convolution:
$$ \begin{align*} y(t) &= h(t) * x(t) = \int_{-\infty}^{\infty} h(\tau) e^{j\omega(t - \tau)} d\tau \\ &= e^{j\omega t} \underbrace{\int_{-\infty}^{\infty} h(\tau) e^{-j\omega \tau} d\tau}_{H(j\omega)} \\ &= e^{j\omega t} H(j\omega) \end{align*} $$
Hence, the steady-state output is also a complex exponential of the same frequency $\omega$, but generally with a modified amplitude and phase.
Specifically:
- The frequency remains unchanged.
- The amplitude is scaled by $|H(j\omega)|$.
- The phase is shifted by $\angle H(j\omega)$.
This fundamental property holds for all stable LTI systems.
1.2. Fourier Transform and Frequency Response¶
The frequency response of an LTI system is defined as the Fourier Transform of its impulse response:
$$ H(j\omega) = \int_{-\infty}^{\infty} h(\tau) e^{-j\omega \tau} d\tau $$
This complex function characterizes the system's response to sinusoidal inputs of frequency $\omega$.
The output in the frequency domain takes the form:
$$ y(t) = H(j\omega) e^{j\omega t} $$
Since $H(j\omega)$ is a complex number, it can be expressed in polar form:
$$ H(j\omega) = |H(j\omega)| e^{j\angle H(j\omega)} $$
This decomposition reveals how the system scales and shifts the phase of the input sinusoid.
(MATLAB Code) Example
$$ \dot{y} + 5y = x(t)$$
% use lsim
A = -5;
B = 1;
C = 1;
D = 0;
G = ss(A,B,C,D);
w = pi;
t = linspace(0,2*pi,200);
x0 = 0;
x = sin(w*t);
[y,tout] = lsim(G,x,t,x0);
plot(t,x), hold on
plot(tout,y), hold off
grid on
xlabel('t')
axis tight, ylim([-1,1])
leg = legend('input','output');
set(leg, 'fontsize', 12)
% sinusoidal inputs with different w
A = -5;
B = 1;
C = 1;
D = 0;
G = ss(A,B,C,D);
x0 = 0;
t = linspace(0,2*pi,200);
W = [1,5,10,20];
for w = W
x = sin(w*t);
[y,tout] = lsim(G,x,t,x0);
plot(tout,y), hold on
end
hold off
grid on
axis tight, ylim([-0.3,0.3])
xlabel('t')
leg = legend('\omega = 1','\omega = 5','\omega = 10','\omega = 20');
set(leg, 'fontsize', 12)
1.3. Frequency Sweep and Steady-State Characterization¶
When a sinusoidal input of the form $x(t) = e^{j\omega t}$ is applied to a system, the steady-state output is:
$$ y(t) = H(j\omega) e^{j\omega t} $$
Two key quantities describe the system’s frequency response:
- Magnitude response*
$$ |H(j\omega)| = \left| \frac{Y(j\omega)}{X(j\omega)} \right| $$
- Phase response*
$$ \angle H(j\omega) = \angle \left( \frac{Y(j\omega)}{X(j\omega)} \right) $$
These quantities are essential in analyzing how a system processes signals of different frequencies.
Example: First-Order System Response
Consider the first-order differential equation:
$$ \dot{y}(t) + 5y(t) = 5x(t) $$
Suppose the input is $x(t) = e^{j\omega t}$. We seek a steady-state solution of the form:
$$ y(t) = A e^{j(\omega t + \phi)} $$
Differentiating $y(t)$:
$$ \dot{y}(t) = j\omega A e^{j(\omega t + \phi)} $$
Substituting into the differential equation:
$$ j\omega A e^{j(\omega t + \phi)} + 5A e^{j(\omega t + \phi)} = 5e^{j\omega t} $$
Factoring:
$$ (j\omega + 5) A e^{j\phi} = 5 $$
Solving for $A$ and $\phi$ gives:
$$ A = \frac{5}{|j\omega + 5|}, \quad \phi = -\angle(j\omega + 5) $$
Thus, the frequency response of the system is:
$$ H(j\omega) = \frac{5}{j\omega + 5} $$
and its polar form reveals how the amplitude and phase of the input are modified.
w = 0.1:0.1:100;
A = 5./abs(1j*w+5);
P = -angle(1j*w+5)*180/pi;
subplot(2,1,1), plot(w, A, 'linewidth', 2)
yticks([0,0.5,1])
ylabel('|H(j\omega)|', 'fontsize', 13)
xlabel('\omega', 'fontsize', 15)
subplot(2,1,2), plot(w, P, 'linewidth', 2)
yticks([-90, -45, 0])
ylabel('\angle H(j\omega)', 'fontsize', 13)
xlabel('\omega', 'fontsize', 15)
% later, we will see that this is kind of a bode plot
A fundamental result in system theory is that complex exponentials are eigenfunctions of linear time-invariant (LTI) systems.
Suppose the input to an LTI system is $x(t) = e^{st}$ and the impulse response is $h(t)$. Then the output is:
$$ \begin{align*} y(t) &= h(t) * x(t) = \int_{-\infty}^{\infty} h(\tau) e^{s(t - \tau)} \, d\tau \\ &= e^{st} \int_{-\infty}^{\infty} h(\tau) e^{-s\tau} \, d\tau \\ &= \underbrace{H(s)}_{\text{eigenvalue}} \, e^{st} \end{align*} $$
where the system function $H(s)$ is defined as:
$$ H(s) = \int_{-\infty}^{\infty} h(\tau) e^{-s\tau} \, d\tau $$
Thus, for input $e^{st}$, the system output is $H(s)e^{st}$. The complex exponential is an eigenfunction, and $H(s)$ is its corresponding eigenvalue.
2.2. Rational Transfer Functions¶
Eigenvalues are particularly easy to evaluate for systems governed by linear differential equations with constant coefficients. These systems have rational transfer functions. i.e., ratios of polynomials in $s$.
Example:
Consider the system governed by the differential equation:
$$ \ddot{y}(t) + 3 \dot{y}(t) + 4 y(t) = 2 \ddot{x}(t) + 7 \dot{x}(t) + 8 x(t) $$
Taking the Laplace Transform of both sides (assuming zero initial conditions), we obtain the transfer function:
$$ H(s) = \frac{2s^2 + 7s + 8}{s^2 + 3s + 4} $$
2.3. Vector Diagrams¶
The value of $H(s)$ at a specific point $s = s_0$ in the complex plane can be interpreted graphically using vector analysis.
To facilitate this, we factor $H(s)$ to expose its poles and zeros:
$$ H(s_0) = K \cdot \frac{(s_0 - z_0)(s_0 - z_1)(s_0 - z_2)\cdots}{(s_0 - p_0)(s_0 - p_1)(s_0 - p_2)\cdots} $$
Each term in the numerator and denominator corresponds to a vector in the complex plane from a zero or pole to the evaluation point $s_0$.
The magnitude and phase of $H(s_0)$ are then given by:
- Magnitude:
$$ \lvert H(s_0) \rvert = \lvert K \rvert \cdot \frac{\lvert s_0 - z_0 \rvert \lvert s_0 - z_1 \rvert \cdots}{\lvert s_0 - p_0 \rvert \lvert s_0 - p_1 \rvert \cdots} $$
- Phase:
$$ \angle H(s_0) = \angle K + \angle(s_0 - z_0) + \angle(s_0 - z_1) + \cdots - \angle(s_0 - p_0) - \angle(s_0 - p_1) - \cdots $$
This graphical method offers intuitive insights into how poles and zeros shape the frequency response.
2.4. Vector Diagrams for Frequency Response¶
To evaluate the frequency response of an LTI system, we consider the input $x(t) = e^{j\omega t}$ and evaluate the system function at $s = j\omega$:
- The magnitude of the response is $|H(j\omega)|$
- The phase of the response is $\angle H(j\omega)$
This means that complex exponentials of the form $e^{j\omega t}$ produce outputs that are scaled and phase-shifted versions of the input.
Examples
$$ H(s) = \frac{1}{s + 2} $$
Evaluate $H(j\omega)$ at $\omega = 2$:
$$ H(j2) = \frac{1}{j2 + 2} $$
Let's examine four different cases.
(1) Isolated zero:
$$ H(s) = s - z_1 $$
The response at $s = j\omega$ is simply $H(j\omega) = j\omega - z_1$
(2) Isolated pole:
$$H(s) = \frac{9}{s - p_1}$$
(3) Pole and zero:
$$ H(s) = 3 \cdot \frac{s - z_1}{s - p_1} $$
The magnitude and phase depend on the relative positions of $z_1$, $p_1$, and $j\omega$.
(4) Two poles:
$$ H(s) = \frac{15}{(s - p_1)(s - p_2)} $$
Evaluate by computing the product of vectors from each pole to $s = j\omega$.
r = 0:0.05:4;
zeta = 0.1:0.2:1;
A = [];
for i = 1:length(zeta)
A(i,:) = 1./sqrt((1-r.^2).^2 + (2*zeta(i)*r).^2);
end
plot(r, A)
xlabel('\gamma')
ylabel('A')
legend('0.1','0.3','0.5','0.7','0.9')
phi = [];
for i = 1:length(zeta)
phi(i,:) = -atan2((2*zeta(i).*r),(1-r.^2));
end
plot(r,phi*180/pi)
xlabel('\gamma')
ylabel('\phi')
legend('0.1','0.3','0.5','0.7','0.9')
from IPython.display import YouTubeVideo
YouTubeVideo('ZGPtPkTft8g', width = "560", height = "315")
3: Frequency Response and Bode Plots¶
3.1. Introduction to Frequency Response¶
The frequency response of a system describes how a system's output responds to inputs of varying frequencies. It is a critical concept in system analysis and design, providing insights into a system's stability, bandwidth, and how it modifies the magnitude and phase of sinusoidal inputs. Understanding frequency response allows engineers to predict system behavior under dynamic conditions and to design controllers that achieve desired performance characteristics.
The frequency response, denoted as $H(j\omega)$, is obtained by evaluating the system's transfer function $H(s)$ on the imaginary axis of the s-plane, where $s = j\omega$:
$$ H(j\omega) = H(s) \big|_{s = j\omega} $$
Here, $\omega$ represents the angular frequency in radians per second, and $j$ is the imaginary unit.
Poles and Zeros
A fundamental concept in understanding system behavior, especially frequency response, is the notion of poles and zeros. These are the roots of the denominator and numerator polynomials, respectively, of a system's transfer function $H(s)$.
- Representing systems in terms of poles and zeros offers a remarkably simple characterization using just a few numbers.
- This representation provides complete information about the system's frequency response and transient behavior.
3.1. Bode Plots: Magnitude¶
Bode plots are graphical representations of a system's frequency response, consisting of two separate plots: one for magnitude and another for phase. The magnitude plot typically uses a logarithmic scale for frequency (horizontal axis) and magnitude (vertical axis), often expressed in decibels (dB).
(1) Asymptotic Behavior: Isolated Zero
For a zero at $s = z_1$, the transfer function is:
$$ H(s) = s - z_1 $$
- Low-frequency asymptote ($\omega \to 0$):
$$ \lim_{\omega \to 0} |H(j\omega)| = |z_1| $$
- High-frequency asymptote ($\omega \to \infty$):
$$ \lim_{\omega \to \infty} |H(j\omega)| \approx \omega $$
Two asymptotes provide a good approximation on log-log axes
- This yields a slope of +20 dB/decade on a log-log plot.
(2) Asymptotic Behavior: Isolated Pole
For a pole at $s = p_1$, the transfer function is:
$$ H(s) = \frac{9}{s - p_1} $$
- Low-frequency asymptote ($\omega \to 0$):
$$ \lim_{\omega \to 0} |H(j\omega)| = \frac{9}{|p_1|} $$
- High-frequency asymptote ($\omega \to \infty$):
$$ \lim_{\omega \to \infty} |H(j\omega)| \approx \frac{9}{\omega} $$
This yields a slope of -20 dB/decade on a log-log plot.
(3) General Transfer Function
$$ H(s) = K \frac{\prod_{m=1}^{M} (s - z_m)}{\prod_{n=1}^{N} (s - p_n)} $$
- Magnitude:
$$ |H(j\omega)| = |K| \cdot \frac{\prod_{m=1}^{M} |j\omega - z_m|}{\prod_{n=1}^{N} |j\omega - p_n|} $$
- Log magnitude (dB):
$$ \log |H(j\omega)| = \log |K| + \sum_{m=1}^{M} \log |j\omega - z_m| - \sum_{n=1}^{N} \log |j\omega - p_n| $$
This makes it easy to build Bode plots by adding/subtracting contributions of poles, zeros, and constant gain.
Example:
$$ H(s) = \frac{s}{(s+1)(s+10)} $$
Plot by summing the asymptotes from the zero at $s = 0$, and poles at $s = -1$ and $s = -10$.
3.2. Bode Plots: Phase¶
(1) Isolated Zero at $s = z_1$
Consider the transfer function:
$$ H(s) = s - z_1 $$
This corresponds to a single zero at $s = z_1$. To evaluate the phase response, we substitute $s = j\omega$:
$$ H(j\omega) = j\omega - z_1 $$
The phase of this expression is:
$$ \angle H(j\omega) = \angle (j\omega - z_1) $$
Asymptotic Behavior
Low frequency ($\omega \to 0$):
$$ \angle H(j\omega) \to 0 $$
High frequency ($\omega \to \infty$):
$$ \angle H(j\omega) \to \frac{\pi}{2} $$
This reflects the fact that at very low frequencies, the imaginary component is negligible, while at very high frequencies, the imaginary part dominates.
Piecewise Linear Approximation (Bode Phase Plot)
The phase response can be approximated by three straight-line segments on a $\log \omega$ scale:
- For $\omega < 0.1|z_1|$:
$$ \angle H(j\omega) \approx 0 $$
- For $0.1|z_1| \leq \omega \leq 10|z_1|$:
$$ \angle H(j\omega) \approx \frac{\pi}{2} \cdot \frac{\log_{10}(\omega / |z_1|)}{2} $$
$\quad\;$(i.e., a straight-line ramp from 0 to $\frac{\pi}{2}$)
- For $\omega > 10|z_1|$:
$$ \angle H(j\omega) \approx \frac{\pi}{2} $$
This approximation is commonly used when sketching Bode phase plots and provides a quick and intuitive understanding of phase behavior around a zero.
(2) Isolated Pole at $s = p_1$
Consider the transfer function:
$$ H(s) = \frac{1}{s - p_1} $$
This corresponds to a single pole at $s = p_1$. The frequency response is:
$$ H(j\omega) = \frac{1}{j\omega - p_1} $$
and its phase is:
$$ \angle H(j\omega) = -\angle (j\omega - p_1) $$
Asymptotic Behavior
- Low frequency ($\omega \to 0$):
$$ \angle H(j\omega) \to 0 $$
- High frequency ($\omega \to \infty$):
$$ \angle H(j\omega) \to -\frac{\pi}{2} $$
This occurs because the imaginary part becomes dominant at high frequencies, but the inversion introduces a negative phase shift.
Piecewise Linear Approximation (Bode Phase Plot)
The phase can be approximated by three straight-line segments on a $\log \omega$ axis:
- For $\omega < 0.1|p_1|$:
$$ \angle H(j\omega) \approx 0 $$
- For $0.1|p_1| \leq \omega \leq 10|p_1|$:
$$ \angle H(j\omega) \approx -\frac{\pi}{2} \cdot \frac{\log_{10}(\omega / |p_1|)}{2} $$
$\quad\;$(a straight-line ramp from 0 to $-\frac{\pi}{2}$)
- For $\omega > 10|p_1|$:
$$ \angle H(j\omega) \approx -\frac{\pi}{2} $$
This behavior mirrors that of a zero, but the ramp direction is reversed due to the negative phase introduced by the pole.
(3) General Transfer Function
For a general transfer function of the form:
$$ H(s) = K \cdot \frac{\prod_{m=1}^{M} (s - z_m)}{\prod_{n=1}^{N} (s - p_n)}, $$
the phase response at $s = s_0$ is given by:
$$ \angle H(s_0) = \angle K + \sum_{m=1}^{M} \angle(s_0 - z_m) - \sum_{n=1}^{N} \angle(s_0 - p_n) $$
Evaluating at $s_0 = j\omega$, the frequency response phase becomes:
$$ \angle H(j\omega) = \angle K + \sum_{m=1}^{M} \angle(j\omega - z_m) - \sum_{n=1}^{N} \angle(j\omega - p_n) $$
The constant $K$ contributes a fixed phase:
- If $K > 0$, then $\angle K = 0$
- If $K < 0$, then $\angle K = \pi$
Each zero contributes a positive phase ramp, and each pole contributes a negative phase ramp, following the same piecewise-linear approximations as in the isolated cases.
Example
Consider the transfer function:
$$ H(s) = \frac{s}{(s + 1)(s + 10)} $$
This system has:
- A zero at $s = 0$
- Two poles at $s = -1$ and $s = -10$
- A positive gain constant $K = 1 \Rightarrow \angle K = 0$
The phase response is:
$$ \angle H(j\omega) = \angle (j\omega - 0) - \angle(j\omega + 1) - \angle(j\omega + 10) $$
This means:
- The zero at the origin contributes a ramp from $0$ to $\frac{\pi}{2}$
- The pole at $s = -1$ contributes a ramp from $0$ to $-\frac{\pi}{2}$
- The pole at $s = -10$ contributes a second ramp from $0$ to $-\frac{\pi}{2}$
Therefore, the total asymptotic phase behaves as:
- Low frequency ($\omega \ll 1$):
$$\angle H(j\omega) \approx 0$$
- Mid frequency ($\omega \approx 1$ to $10$):
Phase begins decreasing
- High frequency ($\omega \gg 10$):
$$\angle H(j\omega) \to -\frac{\pi}{2}$$
(One upward ramp from the zero, and two downward ramps from the poles sum to a net $-\frac{\pi}{2}$ shift)
This decomposition allows us to sketch the phase Bode plot by summing individual contributions over $\log \omega$.
3.3. Bode Magnitude in Decibels¶
The Bode magnitude plot is typically expressed in decibels (dB), which compresses the scale and converts multiplicative relationships into additive ones.
The magnitude in dB is defined as:
$$ \text{Magnitude (dB)} = 20 \log_{10} |H(j\omega)| $$
This form is especially useful for sketching and interpreting frequency response characteristics.
Example
Consider the transfer function:
$$ H(s) = \frac{10s}{(s + 1)(s + 10)} $$
We decompose the response into the following components:
(1) Constant gain:
The gain factor is 10, which contributes a flat offset of:
$$ 20 \log_{10}(10) = 20 \text{ dB} $$
(2) Zero at the origin ($s = 0$):
- Contributes a slope of +20 dB/decade
- Begins at very low frequencies and continues indefinitely
(3) Pole at $s = -1$:
- Introduces a slope of -20 dB/decade
- Begins to affect the magnitude around $\omega = 1$
(4) Pole at $s = -10$:
- Introduces an additional -20 dB/decade
- Starts contributing around $\omega = 10$
Asymptotic Approximation
Using the standard Bode slope rules:
For $\omega \ll 1$:
- Only the zero dominates → slope is +20 dB/decade
For $1 \ll \omega \ll 10$:
- One zero and one pole → net slope is 0 dB/decade
For $\omega \gg 10$:
- One zero and two poles → net slope is -20 dB/decade
This leads to a piecewise-linear Bode magnitude plot with clear slope transitions at the corner frequencies $\omega = 1$ and $\omega = 10$.
from IPython.display import YouTubeVideo
YouTubeVideo('_eh1conN6YM', width = "560", height = "315")
from IPython.display import YouTubeVideo
YouTubeVideo('CSAp9ooQRT0', width = "560", height = "315")
from IPython.display import YouTubeVideo
YouTubeVideo('E6R2XUEyRy0', width = "560", height = "315")
from IPython.display import YouTubeVideo
YouTubeVideo('O2Cw_4zd-aU', width = "560", height = "315")
from IPython.display import YouTubeVideo
YouTubeVideo('4d4WJdU61Js', width = "560", height = "315")
from IPython.display import YouTubeVideo
YouTubeVideo('GIlx9Yu__y8', width = "560", height = "315")
4. Frequency Response and Nyquist Plots¶
While Bode plots display the magnitude and phase of a transfer function as separate functions of frequency, the Nyquist plot provides an alternative representation by capturing the complete frequency response in a single, two-dimensional plot.
Key Idea
The Nyquist plot is a parametric plot of the frequency response $G(j\omega)$ in the complex plane, where the frequency $\omega$ is used as the parameter.
Specifically, it plots:
$$ \text{Re}\{G(j\omega)\} \quad \text{vs.} \quad \text{Im}\{G(j\omega)\} $$
as $\omega$ varies from $0$ to $\infty$ (and optionally from $-\infty$ to $0$ for a full Nyquist contour).
Advantages
- Compactness: All magnitude and phase information is encoded in a single plot.
- Intuition: The geometry of the plot provides insight into system behavior, such as resonance and damping.
- Stability analysis: Nyquist plots are particularly useful for closed-loop stability analysis via the Nyquist stability criterion.
Example
$$G(s) = \frac{1}{s+1}$$
G = tf([1],[1,1]);
bode(G)
grid on
nyquist(G)
axis equal
Example
$$G(s) = \frac{1}{(s+1)(0.1s + 1)}$$
G = tf([1],conv([1,1],[0.1,1]));
bode(G)
grid on
nyquist(G)
axis equal
Example
$$G(s) = \frac{1}{(s+1)^3}$$
s = tf('s');
G = 1/(s+1)^3;
bode(G)
grid on
nyquist(G)
axis equal
%%javascript
$.getScript('https://kmahelona.github.io/ipython_notebook_goodies/ipython_notebook_toc.js')