Frequency response: a sine in, a sine out
About this lesson
Shake a plant with a sine wave and, once the start-up wobble dies away, a sine comes out at the same frequency: smaller and later. Measure that gain and phase at ω = 0.1, 1 and 3 rad/s, check them against G(jω) in three lines of Python, then sweep every frequency to build the Bode and Nyquist plots the rest of this module reads.
Shake it with a sine
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.
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.Read the lesson step by step
Shake it with a sine
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.
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.A wobble, then a sine
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.
y(t) = steady sine + transient = M·sin(ωt + φ) + (A + B·t)·e^(−t) the transient comes from the plant's double pole at s = −1, so it decays like e^(−t) whatever the input. below 2 % of M after 5.8 s Frequency response is about the steady part only.Same frequency out
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.
input period 2π / ω = 6.28 s output period 6.28 s (the same) linear double the input, double the output time-invariant the plant behaves the same today as tomorrow For such a system a sine is changed in size and shifted in time, nothing else.Size: the gain
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.
input amplitude 1 output amplitude 0.50 gain |G(j1)| 0.50 / 1 = 0.50 in decibels 20·log10(0.50) = −6.0 dB 0 dB = passed unchanged, −20 dB = one tenth, +20 dB = ten times bigger.Timing: the phase
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.
delay between peaks 1.57 s period 6.28 s phase = −360° × 1.57 / 6.28 = −90° negative phase the output lags positive phase the output leadsPut s = jω
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.
import cmath, math def G(s): return 1 / (s + 1) ** 2 g = G(1j * 1.0) # s = jω, ω = 1 rad/s print(round(abs(g), 2), round(math.degrees(cmath.phase(g)), 1)) # 0.5 -90.0 The rule for any stable linear system: steady output = |G(jω)|·sin(ωt + ∠G(jω))Shake it slowly
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.
ω = 0.1 rad/s (one cycle every 62.8 s) G(j0.1) = 1 / (1 + 0.1j)² gain 1 / 1.01 = 0.990 (−0.09 dB) phase −2·atan(0.1) = −11.4°Shake it fast
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.
ω = 3 rad/s (one cycle every 2.09 s) G(j3) = 1 / (1 + 3j)² gain 1 / (1 + 9) = 0.100 (−20.0 dB) phase −2·atan(3) = −143.1° each lag 1/(s + 1) gives -71.6°Every ω: the Bode plot
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.
import cmath, math for w in [0.1, 1, 3, 10]: # rad/s g = 1 / (1j * w + 1) ** 2 db = 20 * math.log10(abs(g)) ph = math.degrees(cmath.phase(g)) print(w, round(db, 1), round(ph, 1)) # 0.1 -0.1 -11.4 # 1 -6.0 -90.0 # 3 -20.0 -143.1 # 10 -40.1 -168.6 Low ω: 0 dB, 0°. High ω: −40 dB per decade, phase heading for −180°.One curve: the Nyquist plot
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.
ω G(jω) gain phase 0 1 1 0° 0.1 0.970 − 0.196j 0.990 −11.4° 1 0 − 0.500j 0.50 −90° 3 −0.080 − 0.060j 0.100 −143.1° ∞ 0 0 −180° Same numbers as the Bode plot, drawn as one curve. (The full Nyquist plot adds the mirror image for negative ω.)Why control cares
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.
closed loop T = K·G / (1 + K·G) trouble when 1 + K·G(jω) = 0 ⇔ K·G(jω) = −1 here s² + 2s + 1 + K = 0 stable for every K > 0 Next: reading the open-loop Bode plot, then the Nyquist stability criterion.
5 quick questions
Choose one answer per question. You can change your choices before checking them.
01A stable linear time-invariant system is driven by sin(2t). After the transient has died away, what does the output look like?
A linear time-invariant system cannot create new frequencies. The steady-state output is |G(j2)|·sin(2t + ∠G(j2)): same frequency, scaled and shifted.
02For G(s) = 1/(s + 1)² at ω = 1 rad/s, the input swings ±1 and the output ±0.50. What is the gain in decibels?
Gain = 0.50, and 20·log10(0.50) = −6.0 dB. A negative dB value means the output is smaller than the input.
03The output peaks 1.57 s after the input peak, and one cycle takes 6.28 s. What is the phase?
1.57 / 6.28 is a quarter of a cycle, and a quarter of 360° is 90°. The output lags, so the phase is −90°.
04Which Python line gives the gain of G(s) = 1/(s + 1)² at ω = 3 rad/s?
Put s = jω = 3j into G(s) and take the length of the complex result: abs(1 / (3j + 1) ** 2) = 0.100. cmath.phase gives the angle instead (−143.1° in degrees). The last option forgets the square: it is one lag, not two.
05Why does a control engineer care where the open-loop frequency response K·G(jω) passes near −1?
The closed loop T = K·G / (1 + K·G) blows up when 1 + K·G = 0. Gain 1 at phase −180° is that point; the rest of this module reads its distance from the Bode and Nyquist plots.
Glossary
- Frequency response
- How a stable linear system scales and shifts a sine input, for every frequency ω. It is G(jω): the transfer function evaluated on the imaginary axis.
- Angular frequency ω
- How fast a sine turns, in radians per second. One full cycle is 2π radians, so the period is 2π/ω seconds.
- Transient and steady state
- The transient is the start-up part of the response that dies away (here roughly like e^(−t)). What is left, a sine at the input's frequency, is the sinusoidal steady state.
- Linear time-invariant (LTI)
- A system where doubling the input doubles the output, inputs add, and the rules do not change over time. Only for such systems is a sine in a same-frequency sine out.
- Gain |G(jω)|
- Output amplitude divided by input amplitude. In decibels: 20·log10 of it, so 0 dB means unchanged and −20 dB means one tenth.
- Phase ∠G(jω)
- How far the output sine is shifted, in degrees of one 360° cycle. Negative means the output lags behind the input.
- Bode plot
- Two plots against log ω: the gain in dB and the phase in degrees.
- Nyquist plot
- G(jω) drawn as a point in the complex plane as ω runs from 0 upwards: distance from the origin is the gain, the angle is the phase.
Notes and sources
- 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 animation is not to scale in time: every frequency plays at a comfortable pace, and the time plot measures time in input cycles so the three outputs can share one axis.
- The rule 'a sine in gives a sine out, scaled by |G(jω)| and shifted by ∠G(jω)' holds for a stable linear time-invariant system once the transient has died away. An unstable system's transient grows instead, so there is no steady state to measure.
- The full Nyquist plot also draws G(jω) for negative ω, the mirror image of this curve in the real axis; the lesson on the Nyquist stability criterion uses it.
- 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.
- N. S. Nise, Control Systems Engineering, 8th ed., Wiley (ch. 10, Frequency Response Techniques)
- K. Ogata, Modern Control Engineering, 5th ed., Pearson (ch. 7, analysis and design by the frequency-response method)
- G. F. Franklin, J. D. Powell, A. Emami-Naeini, Feedback Control of Dynamic Systems, 8th ed., Pearson (ch. 6)
- MIT OpenCourseWare 16.06 Principles of Automatic Control (S. Hall)
- MIT OpenCourseWare 6.302 Feedback Systems (Roberge, Dawson, Lundberg)
- python-control: control.frequency_response
- Python 3 documentation: cmath (abs and phase of complex numbers)
Quiz Unlocks after the last step.