TExcelTAD
Home › Differential Equations › Transfer Functions and Stability

Transfer Functions and Stability

Engineers rarely solve a linear ODE for one particular input. They describe the system once, by its transfer function, and read off everything important from it: stability, the response to a step, the response to every frequency. This lesson connects the Laplace transform to that viewpoint.

The transfer function

For a linear constant-coefficient system with input ff and output yy,

any(n)+⋯+a0y=bmf(m)+⋯+b0f,a_ny^{(n)} + \dots + a_0y = b_mf^{(m)} + \dots + b_0f,

zero initial conditions give Y(s)=H(s)F(s)Y(s) = H(s)F(s) with

H(s)=bmsm+⋯+b0ansn+⋯+a0.H(s) = \frac{b_ms^m + \dots + b_0}{a_ns^n + \dots + a_0}.

The roots of the denominator are the poles (they are the characteristic roots of the ODE), the roots of the numerator are the zeros.

Stability from the poles

The impulse response h(t)h(t) is a sum of terms tkeptt^ke^{pt}, one family per pole pp. So:

  • all poles with Re⁡p<0\operatorname{Re}p < 0: h(t)→0h(t) \to 0, every bounded input gives a bounded output. The system is stable.
  • any pole with Re⁡p>0\operatorname{Re}p > 0: unstable.
  • simple poles on the imaginary axis: marginally stable (undamped oscillation; a resonant input makes it blow up).
python · try it yourself
import numpy as np

systems = {"damped spring s^2 + 0.5s + 4": [1, 0.5, 4],
           "undamped spring s^2 + 4": [1, 0, 4],
           "third order s^3 + 2s^2 + 3s + 10": [1, 2, 3, 10],
           "third order s^3 + 3s^2 + 3s + 1": [1, 3, 3, 1]}
for name, den in systems.items():
    p = np.roots(den)
    status = "stable" if np.all(p.real < -1e-9) else ("marginal" if np.all(p.real < 1e-9) else "unstable")
    print(f"{name:34s} poles {np.round(p, 3)} -> {status}")
damped spring s^2 + 0.5s + 4       poles [-0.25+1.984j -0.25-1.984j] -> stable
undamped spring s^2 + 4            poles [-0.+2.j  0.-2.j] -> marginal
third order s^3 + 2s^2 + 3s + 10   poles [-2.445+0.j    0.223+2.01j  0.223-2.01j] -> unstable
third order s^3 + 3s^2 + 3s + 1    poles [-1.+0.j -1.+0.j -1.-0.j] -> stable

The polynomial s3+2s2+3s+10s^3 + 2s^2 + 3s + 10 looks harmless, all coefficients positive, but it has two poles in the right half-plane. (For cubics s3+a2s2+a1s+a0s^3 + a_2s^2 + a_1s + a_0 with positive coefficients, stability needs a2a1>a0a_2a_1 > a_0, a case of the Routh-Hurwitz criterion; here 6<106 < 10.)

Step response

The response to a unit step u(t)u(t) is L−1{H(s)s}\mathcal{L}^{-1}\left\{\frac{H(s)}{s}\right\}. Its final value, if the system is stable, is H(0)H(0) (the "DC gain"), a consequence of the final value theorem lim⁡t→∞y(t)=lim⁡s→0sY(s)\lim_{t\to\infty}y(t) = \lim_{s\to 0}sY(s).

python · try it yourself
import numpy as np
from scipy import signal

H = signal.lti([4], [1, 1.2, 4])                  # a spring with zeta = 0.3, DC gain 1
t = np.linspace(0, 15, 1501)
t, y = signal.step(H, T=t)
print(f"final value {y[-1]:.4f} (H(0) = 1)")
print(f"overshoot {100 * (y.max() - 1):.1f} %, peak at t = {t[np.argmax(y)]:.2f}")
zeta = 0.3
print(f"theory: overshoot {100 * np.exp(-zeta * np.pi / np.sqrt(1 - zeta**2)):.1f} %, peak at {np.pi / (2 * np.sqrt(1 - zeta**2)):.2f}")
final value 1.0001 (H(0) = 1)
overshoot 37.2 %, peak at t = 1.65
theory: overshoot 37.2 %, peak at 1.65

Frequency response

For a stable system, the steady-state response to cos⁡ωt\cos\omega t is ∣H(iω)∣cos⁡(ωt+arg⁡H(iω))\lvert H(i\omega)\rvert\cos(\omega t + \arg H(i\omega)). The amplitude ∣H(iω)∣\lvert H(i\omega)\rvert is exactly the resonance curve C(ω)C(\omega) of Forced Oscillations and Resonance, now computed by plugging s=iωs = i\omega into HH. Plotted on log scales it is the Bode plot.

python · try it yourself
import numpy as np

H = lambda s: 1 / (s**2 + 0.2 * s + 1)          # m = 1, c = 0.2, k = 1
for w in (0.5, 1.0, 2.0):
    v = H(1j * w)
    print(f"omega = {w}: gain {abs(v):.4f}, phase {np.degrees(np.angle(v)):7.2f} degrees")
omega = 0.5: gain 1.3216, phase   -7.59 degrees
omega = 1.0: gain 5.0000, phase  -90.00 degrees
omega = 2.0: gain 0.3304, phase -172.41 degrees

At resonance the gain is 10.2=5\frac{1}{0.2} = 5 and the output lags the input by exactly 90 degrees.

In software

  • scipy.signal (lti, step, impulse, bode, freqresp) and MATLAB's Control System Toolbox work directly with transfer functions.
  • PID controllers in drones, 3D printers and thermostats are tuned by placing the closed-loop poles in the left half-plane with enough damping; an unstable pole is a drone that oscillates itself out of the sky.
  • Audio equalizers are designed by their frequency response ∣H(iω)∣\lvert H(i\omega)\rvert.

Exercises

Exercise 1: Poles and stability

Find the poles of H(s)=s+1s2+2s+10H(s) = \frac{s + 1}{s^2 + 2s + 10}. Is the system stable?

Answer

−1±3i-1 \pm 3i; stable.

Solution

s2+2s+10=(s+1)2+9s^2 + 2s + 10 = (s + 1)^2 + 9. Both poles have real part −1<0-1 < 0.

Exercise 2: DC gain

What is the final value of the step response of H(s)=6s2+5s+3H(s) = \frac{6}{s^2 + 5s + 3}?

Answer
Solution

The system is stable (roots −5±132\frac{-5 \pm \sqrt{13}}{2}, both negative), so the final value is H(0)=63H(0) = \frac{6}{3}.

Exercise 3: Find the unstable range (code)

For which K>0K > 0 is s3+3s2+2s+Ks^3 + 3s^2 + 2s + K stable? Check K=5K = 5 and K=7K = 7 numerically.

Answer

0<K<60 < K < 6.

Solution

The cubic criterion a2a1>a0a_2a_1 > a_0 gives 3⋅2>K3 \cdot 2 > K.

python · try it yourself
import numpy as np
for K in (5, 7):
    print(K, np.round(np.roots([1, 3, 2, K]), 4))
5 [-2.9042+0.j     -0.0479+1.3112j -0.0479-1.3112j]
7 [-3.0867+0.j      0.0434+1.5053j  0.0434-1.5053j]

At K=7K = 7 a complex pair has crossed into the right half-plane.

Test yourself

A system is stable when all poles of H(s)H(s)…

  1. are real
  2. have negative real parts
  3. are zero
  4. lie on the imaginary axis

The steady-state gain at frequency ω\omega is…

  1. H(ω)H(\omega)
  2. ∣H(iω)∣\lvert H(i\omega)\rvert
  3. H(0)H(0)
  4. 1/ω1/\omega

The final value of a stable system's unit step response is…

  1. 0
  2. H(0)H(0)
  3. H(∞)H(\infty)
  4. 1 always