1num = [4, 10] # top2den = [2, 4, 10] # bottom1 N stepb = 4.01.00 Ns = −2.5−1 ± 2js = −2.5s = −1 ± 2j
−5−4−3−2−101−3−2−10123σ, real partjω, imaginary partS-PLANE← fadesgrowspole pathσ = −1ω = 20246800.511.52time (s)NWALL FORCE, 1 N PUSHwall forceno zero1 ± 1.12·e^(−t)
Lit wire with moving dashes: a signal is flowing along itBlocks: the push, the wall (output), the damper dial and the two root tiles; G(s) is the code cardPlots: the s-plane (× poles, ○ zero) and the wall force, computed from the modelThe pills travelling to the tiles are the roots found from each polynomialThe transfer function of a cart held by a spring and a damper, from the push to the force on the wall. Its zero (the root of the top polynomial) and its poles (the roots of the bottom) are marked on the s-plane. The step response is computed from the model: the real part of the poles sets how fast it fades, the imaginary part how fast it swings, and the zero changes the mix. A polynomial with real coefficients can only have complex roots in mirror (conjugate) pairs, so poles and zeros are always symmetric about the real axis of the s-plane.

The system

  1. Push a 2 kg cart, tied to a wall by a spring and a damper, with a steady 1 N. The wall feels the spring plus the damper. As a transfer function: G(s) = (4s + 10) / (2s² + 4s + 10).

Find the roots

Read the s-plane

Stable or not

The working

# step 1/10 · system
# about: Push F(s): 1 N step, Transfer function G(s), Wall force Y(s)

m = 2 kg   k = 10 N/m   b = 4 N·s/m

m·x'' + b·x' + k·x = F
wall force = k·x + b·x'

           b·s + k          4s + 10
G(s) = ------------- = --------------
       m·s² + b·s + k    2s² + 4s + 10

The cart is a textbook model with illustrative numbers (m = 2 kg, k = 10 N/m, b = 4 N·s/m). Every curve and number in the figure is computed from its exact solution. The Python uses only the standard cmath module. With the python-control package installed, ct.tf([4, 10], [2, 4, 10]).poles() and .zeros() give the same roots.