ENع
←A sine in, a sine out
Lesson 30 · Frequency response

Frequency response: a sine in, a sine out

15 min11 steps5 questionsAdvanced
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.

You'll learn to

Tick what you feel confident about. These self-checks do not affect your lesson score.

Fig 30 · Interactive
01 / 11

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.
Loading figure…
or ← →
Read the lesson step by step
  1. 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.
  2. 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.
  3. 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.
  4. 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.
  5. 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 leads
  6. Put 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ω))
  7. 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°
  8. 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°
  9. 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°.
  10. 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 ω.)
  11. 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.

Quiz Unlocks after the last step.