S912 of 55
0 XP
  1. Hook
  2. Play
  3. Predict
  4. Name it
  5. Check
  6. Explain

S9 · Lesson 12 · Response lab

A Routh-array stability counter, step-response metrics measured from data, numerical linearization by central differences, and the residues that decide which poles dominate

Lessons 3 to 10 gave closed forms: overshoot from ζ, settling from σ, stability from the Routh array, the residues that make some poles dominate. Real work runs these as code: a stability check inside a design loop, a script that reads overshoot and settling time off a measured response, a linearization of a model too messy to differentiate by hand. In this lab you'll write those tools and test each against the formulas it replaces.

  • The curve is the step response of the standard second-order system with ωn = 10 rad/s, ζ set by the slider.
  • At ζ = 0.5 it peaks at 0.363 s with 16.3% overshoot and stays within 2% after 0.81 s, close to the estimate 4/ζωn = 0.8 s.
  • Your step_metrics function must recover those numbers from samples alone.

Predict

The Routh array of s3+3s2+(K−4)s+K is built for K = 5. How many sign changes appear in its first column?

Name it

What the lab computes

  • Routh array: rows from the polynomial's alternating coefficients, each new entry r1,0r2,j+1−r1,j+1r2,0r2,0 from the two rows above; the number of sign changes in the first column counts right-half-plane roots (assume no zero appears in the first column).
  • Step metrics from samples (tk,yk) with final value y∞ taken as the last sample: overshoot (max⁡y−y∞)/y∞, peak time where the maximum occurs, 2% settling time as the last time |y−y∞|>0.02y∞.
  • Linearization: Aij=∂fi/∂xj≈fi(x+hej)−fi(x−hej)2h, with error proportional to h2.
  • Residues: for T(s)=∏(−pi)/∏(s−pi) with distinct real poles, the step response is 1+∑krkepkt with
rk=∏j(−pj)pk∏j≠k(pk−pj)

Check

Write routh(c): given polynomial coefficients from the highest power down, return the first column of the Routh array (a list) and the number of sign changes in it.

Python 3.14 with numpy and matplotlib, running in your browser. Tab indents; press Esc and then Tab to move on.

Check

Write step_metrics(t, y): from sampled step-response data, return (overshoot as a fraction, peak time, 2% settling time), taking the final value as the last sample.

Python 3.14 with numpy and matplotlib, running in your browser. Tab indents; press Esc and then Tab to move on.

Check

Write jacobian(f, x0, h): the matrix of partial derivatives of a function f (taking and returning lists) at x0, by central differences with step h.

Python 3.14 with numpy and matplotlib, running in your browser. Tab indents; press Esc and then Tab to move on.

Check

Write step_residues(poles): for distinct real poles p (all negative) of T(s)=∏(−pi)/∏(s−pi), return the coefficients rk of epkt in its step response.

Python 3.14 with numpy and matplotlib, running in your browser. Tab indents; press Esc and then Tab to move on.

Explain why

Why is it worth computing step-response metrics from data rather than reading them from the ζ and ω_n formulas?