Shake it
To see how a system treats fast and slow changes, shake its input with a sine wave. Our plant is G(s) = 1/(s + 1)², two one-second lags in a row. The generator feeds it u(t) = sin(ωt) with ω = 1 rad/s.
The plant starts at rest, so its output first wobbles. That start-up part, the transient, dies away (roughly like e^(−t)); after 5.8 s it is below 2 % of the output's size. What remains is a steady sine: the sinusoidal steady state.
Gain and phase
Count the peaks: the output repeats every 6.28 s, exactly like the input. A linear, time-invariant system cannot create new frequencies. A sine in gives a sine out at the same ω. Only its size and its timing can change.
The input swings between −1 and +1; the output only between −0.50 and +0.50. Output amplitude over input amplitude is the gain, written |G(jω)|. Here it is 0.50 at ω = 1 rad/s, which is −6.0 dB.
Each output peak comes 1.57 s after the input peak: a quarter of the 6.28 s cycle. A whole cycle is 360°, so a quarter is 90°. The phase, ∠G(jω), is −90°: negative, because the output lags behind.
No experiment needed: put s = jω into G(s), where j = √−1, the imaginary unit. G(j1) = 1/(1 + j)² = 1/(2j) = −0.5j. That complex number has length 0.50 and angle −90°: exactly the gain and phase we just measured.
Every frequency
Turn the generator down to ω = 0.1 rad/s. The plant easily keeps up: gain 0.990 (−0.09 dB) and a lag of only 11.4°. Slow inputs pass through almost untouched.
Now ω = 3 rad/s. Each lag takes its share: the output shrinks to 0.100 of the input (−20.0 dB) and lags 143.1°. Fast inputs are filtered out, so this plant is a low-pass filter.
Sweep ω from slow to fast and plot the gain in dB and the phase against log ω. That pair is the Bode plot; our three tests are the three dots. The Circuits lesson on transfer functions and Bode plots shows how to sketch one.
Or draw G(jω) as a point in the complex plane (real part across, imaginary part up): distance from 0 is the gain, angle the phase. Let ω run from 0 upwards and the point traces the Nyquist plot, from 1 curling into the origin.
Close a loop with gain K and it reaches the edge of instability when K·G(jω) = −1: gain 1 at phase −180°. Our phase never reaches −180°, so every K > 0 is stable. Judging loops from open-loop plots is the rest of this module.
What is happening
# step 1/11 · shake
# about: Sine generator, Plant G(s), Input on the time plot
plant G(s) = 1 / (s + 1)²
y'' + 2y' + y = u
input u(t) = sin(ω t)
ω = 1 rad/s (one cycle every 6.28 s)
ω is the angular frequency in radians per
second: 2π rad/s is one cycle per second.
The plant G(s) = 1/(s + 1)² is an illustrative example (two first-order lags, each with a 1 s time constant). Every curve is computed from it: the time plot from its exact response from rest, the Bode and Nyquist plots from G(jω). The Python is plain Python 3 with cmath and math: abs(z) is the length of a complex number and cmath.phase(z) its angle in radians. python-control's frequency_response and bode_plot give the same numbers.