Reference topics: Caltech CDS 101 · independent study notes, not affiliated

Control Systems

Feedback control, transfer functions, stability, root locus, Bode plots, PID controllers, and state-space methods.

5Lectures
1Assignments
1Exams
42hDuration
1

Introduction to Feedback Control

What is a Control System? A control system is a system that regulates another system. Examples: Cruise control keeps a car at a set speed Thermostat keeps a room at a set temperature Autopilot keeps...

⏱ 50 min read

What is a Control System?

A control system is a system that regulates another system. Examples:

  • Cruise control keeps a car at a set speed
  • Thermostat keeps a room at a set temperature
  • Autopilot keeps a plane on course
  • Camera autofocus keeps a subject sharp

The core idea: measure the output, compare to the desired output, and adjust the input.

Open-Loop vs Closed-Loop

Open-loop: apply a preset input, hope the output is right. No feedback. Simple, but sensitive to disturbances and model errors.

Example: a toaster has a timer. If the bread is thicker, it burns.

Closed-loop: measure the output, feed it back, correct the error. Robust to disturbances.

Example: a thermostat with a temperature sensor. When the room is cold, it heats. When warm, it stops.

The Feedback Loop

┌─────────┐ ┌─────────┐ ┌────────┐
│ Setpoint├───▶│ Error ├───▶│Controller├──▶ u(t) ──▶ Plant ──▶ y(t)
└─────────┘ └─────────┘ └────────┘ │
▲ │
│ │
└──── r(t) ◀────── Sensor ◀─────────────────────┘

Where:

  • r(t) = setpoint (what we want)
  • y(t) = output (what we have)
  • e(t) = r(t) - y(t) = error
  • u(t) = control input

The Controller

Three classical controllers (PID):

Proportional (P): u = Kp × e. Simple, but leaves steady-state error.

Integral (I): u = Ki × ∫e dt. Removes steady-state error, but can cause oscillation.

Derivative (D): u = Kd × de/dt. Predicts the future, damps oscillation, but amplifies noise.

Combined:

u(t) = Kp×e + Ki×∫e + Kd×de/dt

This is the PID controller — the workhorse of industrial control.

Why Feedback Works

Feedback rejects disturbances:

If Plant = P, Controller = C, then:
y/r = PC / (1 + PC)

As long as PC >> 1 at the relevant frequencies, the closed-loop transfer function ≈ 1.

Feedback also reduces sensitivity to plant variations:

d(y/r)/(y/r) = (1/(1+PC)) × dP/P

So a 20% variation in plant becomes a 20%/(1+PC) variation in output.

Stability

Not all feedback is good. Too much gain causes oscillation. The closed-loop poles must be in the left half-plane.

Classical tests:

  • Nyquist criterion: plot PC in the complex plane, check encirclements of -1
  • Bode plots: gain margin (how much more gain before oscillation) and phase margin (how much more phase lag before oscillation)
  • Root locus: where closed-loop poles go as gain increases

Rule of thumb: phase margin > 45° for good damping, > 60° for excellent.

Applications

  • Robotics: joint control, trajectory tracking
  • Aerospace: autopilot, missile guidance, satellite attitude
  • Process control: temperature, pressure, flow
  • Automotive: cruise control, ABS, engine management
  • Power systems: grid frequency, voltage regulation

Key Takeaways

  • Feedback compares output to setpoint, adjusts input
  • Closed-loop is robust; open-loop is not
  • PID is the universal controller
  • Feedback reduces sensitivity and rejects disturbances
  • Stability is essential; tune for phase margin
  • Control is everywhere in engineering
2

System Modeling and Laplace Transforms

Why Model Systems? To design a controller, we need a mathematical model of the plant. The model doesn't have to be perfect — it just needs to capture the essential dynamics. Differential...

⏱ 50 min read

Why Model Systems?

To design a controller, we need a mathematical model of the plant. The model doesn't have to be perfect — it just needs to capture the essential dynamics.

Differential Equations

Most physical systems are described by ODEs:

RC circuit:
RC × dVout/dt + Vout = Vin

Mass-spring-damper:
m × x'' + c × x' + k × x = F(t)

DC motor:
J × ω' + b × ω = Kt × I
L × I' + R × I = V - Ke × ω

These couple the physical world (R, m, k) to the dynamics.

The Laplace Transform

The Laplace transform converts ODEs to algebraic equations:

L{f(t)} = F(s) = ∫₀^∞ f(t) × e^(-st) dt

Key properties:

  • Linearity: L{af + bg} = aF + bG
  • Derivative: L{f'} = sF(s) - f(0)
  • Integral: L{∫f dt} = F(s)/s
  • Time shift: L{f(t-T)} = e^(-sT) × F(s)
  • Final value theorem: lim(t→∞) f(t) = lim(s→0) sF(s)

Common Transforms

| f(t) | F(s) |
|------|------|
| δ(t) (impulse) | 1 |
| u(t) (step) | 1/s |
| t | 1/s² |
| e^(-at) | 1/(s+a) |
| sin(ωt) | ω/(s²+ω²) |
| 1 - e^(-t/τ) | 1/(s(sτ+1)) |

Transfer Functions

For a linear time-invariant (LTI) system with zero initial conditions:

H(s) = Y(s) / U(s)

This is the transfer function. It fully characterizes the system's input-output behavior.

For the RC circuit:

H(s) = 1 / (RCs + 1)

The pole at s = -1/(RC) determines the time constant τ = RC.

Poles and Zeros

The transfer function is a ratio of polynomials:

H(s) = N(s) / D(s)

Zeros: roots of N(s). Cause the output to be zero at certain frequencies.

Poles: roots of D(s). Determine the natural response.

For a first-order system with pole at s = -a:

h(t) = e^(-at)

Time constant τ = 1/a.

For a second-order system with poles at s = -σ ± jωd:

h(t) = e^(-σt) × sin(ωd × t + φ)

Damping ratio ζ = σ / √(σ² + ωd²).

  • ζ > 1: overdamped (no oscillation)
  • ζ = 1: critically damped (fastest without overshoot)
  • 0 < ζ < 1: underdamped (oscillates)
  • ζ = 0: undamped (pure oscillation)

Block Diagrams

Complex systems are built from simple blocks:

  • Series: H = H1 × H2
  • Parallel: H = H1 + H2
  • Feedback: H = H1 / (1 + H1 × H2)

Feedback is the key block that changes system behavior dramatically.

Example: DC Motor Position Control

θ(s) / V(s) = Kt / (s × (Js + b) × (Ls + R) + Kt × Ke)

For a small motor, L is negligible, so:

θ(s) / V(s) ≈ Kt / (s × (Js + b) × R + Kt × Ke)

This is a second-order system with one pole at origin (integrator) and one real pole.

Key Takeaways

  • Physical systems → ODEs → Laplace → transfer functions
  • Poles and zeros characterize system behavior
  • Second-order: ζ and ωn fully determine response
  • Block diagrams compose simple systems
  • Feedback changes the effective dynamics
  • Modeling is the first step of any control design
3

PID Controller Design

The PID Controller The most widely used controller in industry. Over 90% of control loops use PID. u(t) = Kp×e(t) + Ki×∫₀^t e(τ)dτ + Kd×de/dt In Laplace form: C(s) = Kp + Ki/s + Kd×s Or equiva...

⏱ 50 min read

The PID Controller

The most widely used controller in industry. Over 90% of control loops use PID.

u(t) = Kp×e(t) + Ki×∫₀^t e(τ)dτ + Kd×de/dt

In Laplace form:

C(s) = Kp + Ki/s + Kd×s

Or equivalently:

C(s) = Kp × (1 + 1/(Ti×s) + Td×s)

where Ti = Kp/Ki is the integral time and Td = Kd/Kp is the derivative time.

Proportional Term

u = Kp × e

Pros:

  • Fast response
  • Simple

Cons:

  • Steady-state error for step input to type-0 plant
  • Higher Kp = faster but more oscillatory

Integral Term

u = Ki × ∫e dt

Pros:

  • Eliminates steady-state error
  • Handles constant disturbances

Cons:

  • Adds phase lag → reduces stability
  • Can cause "integral windup" during saturation

Derivative Term

u = Kd × de/dt

Pros:

  • Adds phase lead → improves stability
  • Predicts future error → damps response

Cons:

  • Amplifies high-frequency noise
  • Difficult to implement in practice

Tuning Methods

Ziegler-Nichols (Closed-Loop)

1. Set Ki = Kd = 0
2. Increase Kp until system oscillates at constant amplitude. Call this Ku (ultimate gain), and the period Tu.
3. Set:
- Kp = 0.6 × Ku
- Ki = 2 × Kp / Tu
- Kd = Kp × Tu / 8

This gives a "quarter-wave decay" response — moderately aggressive.

Ziegler-Nichols (Open-Loop)

From the step response, find the inflection point. Draw a tangent. Read off the delay L and time constant T.

Then:

  • Kp = 1.2 × T / (K × L)
  • Ki = Kp / (2L)
  • Kd = Kp × 0.5 × L

where K is the plant DC gain.

Manual Tuning

  1. Start with Ki = Kd = 0
  2. Increase Kp until response is fast but stable (no sustained oscillation)
  3. Add Ki to eliminate steady-state error — small at first
  4. Add Kd to reduce overshoot and speed up response
  5. Iterate

Typical Issues

Integral windup: during saturation (e.g., actuator limit), the integrator keeps accumulating. When the error reverses, the integrator takes time to unwind → overshoot.

Solution: anti-windup — clamp the integrator or freeze it during saturation.

Noise amplification: the derivative term amplifies sensor noise. Solution: use a low-pass filter on the derivative, or use a "dirty derivative" (filtered derivative).

Setpoint kick: differentiating the setpoint causes a spike when the reference changes. Solution: differentiate only the measurement, not the error.

PID in Discrete Time

Real controllers run on microcontrollers with a fixed sample period Ts.

u[n] = u[n-1] + Kp×(e[n]-e[n-1]) + Ki×Ts×e[n] + (Kd/Ts)×(e[n]-2e[n-1]+e[n-2])

The sampling rate should be at least 10x the fastest dynamics.

Example: Temperature Control

A 3D printer hot end has a thermal time constant of ~30 seconds. Sample at 1 Hz.

Typical PID gains: Kp = 20, Ki = 0.5, Kd = 100.

At startup, the heater runs full power until the temperature nears the setpoint. Then PID takes over.

Key Takeaways

  • PID is the universal industrial controller
  • P = speed, I = eliminate steady-state error, D = damping
  • Ziegler-Nichols gives starting gains
  • Anti-windup is essential in practice
  • Filter the derivative to reduce noise
  • Discrete-time implementation is standard
4

Stability Analysis: Bode and Nyquist

Stability A system is stable if its output returns to equilibrium after a disturbance. Formally, all poles of the closed-loop transfer function must be in the left half of the complex plane. Feedback...

⏱ 50 min read

Stability

A system is stable if its output returns to equilibrium after a disturbance. Formally, all poles of the closed-loop transfer function must be in the left half of the complex plane.

Feedback can make a stable plant unstable if the gain is too high. Understanding stability margins is essential.

Gain and Phase Margin

Consider the loop transfer function L(s) = C(s) × P(s).

The crossover frequency ωc is where |L(jωc)| = 1 (0 dB).

The phase margin (PM) is the difference between the phase of L at crossover and -180°:

PM = 180° + ∠L(jωc)

Rule of thumb:

  • PM > 0: stable
  • PM = 45°: good, moderate overshoot
  • PM = 60°: excellent, minimal overshoot
  • PM = 90°: very conservative, slow

The gain margin (GM) is how much the gain can increase before instability:

GM = 1 / |L(jωpc)|

where ωpc is the phase crossover frequency (where ∠L = -180°).

Bode Plots

Two plots:

  1. Magnitude |L(jω)| in dB vs frequency (log scale)
  2. Phase ∠L(jω) in degrees vs frequency (log scale)

Read off:

  • Crossover frequency (where magnitude = 0 dB)
  • Phase margin (180 + phase at crossover)
  • Phase crossover (where phase = -180°)
  • Gain margin (negative of magnitude at phase crossover)

Rules of Thumb

Each pole contributes -20 dB/decade and -90° of phase.

Each zero contributes +20 dB/decade and +90° of phase.

For a typical system, if the slope at crossover is -20 dB/decade, phase margin is roughly 90°. If -40 dB/decade, phase margin is roughly 0°.

Rule: keep the slope at crossover at -20 dB/decade for good phase margin.

Nyquist Criterion

Plot L(jω) for ω from 0 to ∞ in the complex plane. This is the Nyquist plot.

The number of encirclements of the point -1 equals the number of unstable closed-loop poles minus the number of unstable open-loop poles.

For a stable open-loop system:

  • No encirclement of -1 → stable closed-loop
  • Encirclement → unstable closed-loop

Nyquist is more powerful than Bode for two reasons:

  1. It handles right-half-plane poles correctly
  2. It captures the behavior at all frequencies

Frequency Response Intuition

At low frequency, integrators give high gain — good for tracking.

At high frequency, the plant rolls off — good for noise rejection.

A well-designed controller has:

  • High gain at low frequency (tracking)
  • Crossover at a frequency where phase margin > 45°
  • Low gain at high frequency (noise rejection)

This is the "loop shaping" approach to control design.

Example: PI Control of First-Order Plant

Plant: P(s) = K / (τs + 1)

Controller: C(s) = Kp + Ki/s

Loop: L(s) = (Kp + Ki/s) × K / (τs + 1)

At low frequency, the integrator gives high gain. At high frequency, the plant rolls off.

Design Kp and Ki so crossover is at ωc with 60° phase margin.

Key Takeaways

  • Stability requires all closed-loop poles in the left half-plane
  • Phase margin > 45° for good response
  • Gain margin > 6 dB for robustness
  • Bode plots are the standard visualization
  • Nyquist is more rigorous
  • Loop shaping: high gain low freq, crossover with margin, low gain high freq
5

State-Space Control

Beyond Transfer Functions Transfer functions work for SISO systems with zero initial conditions. For MIMO systems, or systems with nonzero initial conditions, we use state-space. State-Space...

⏱ 50 min read

Beyond Transfer Functions

Transfer functions work for SISO systems with zero initial conditions. For MIMO systems, or systems with nonzero initial conditions, we use state-space.

State-Space Representation

Any linear system can be written as:

ẋ = A x + B u
y = C x + D u

where:

  • x ∈ R^n is the state vector
  • u ∈ R^m is the input
  • y ∈ R^p is the output
  • A, B, C, D are constant matrices

Example: Mass-Spring-Damper

m x'' + c x' + k x = F

Define state: x1 = x, x2 = x'

x1' = x2
x2' = -k/m × x1 - c/m × x2 + 1/m × F

So:
A = [0, 1; -k/m, -c/m]
B = [0; 1/m]
C = [1, 0]
D = [0]

Controllability

The system is controllable if we can drive the state from any initial value to any final value in finite time.

Controllability matrix:

C = [B AB A²B ... A^(n-1)B]

The system is controllable iff C has full rank (rank n).

Observability

The system is observable if the initial state can be determined from the output over time.

Observability matrix:

O = [C; CA; CA²; ...; CA^(n-1)]

Full rank (n) → observable.

Pole Placement

If the system is controllable, we can place the closed-loop poles anywhere via state feedback:

u = -K x

The closed-loop system becomes:

ẋ = (A - BK) x

Choose K so that the eigenvalues of (A - BK) are the desired poles.

This is like PID tuning but more powerful: we can shape the entire closed-loop response.

Linear Quadratic Regulator (LQR)

Instead of picking poles directly, we minimize a cost function:

J = ∫₀^∞ (x'Qx + u'Ru) dt

where Q and R are weighting matrices chosen by the designer.

The solution is:

K = R^(-1) B' P

where P solves the algebraic Riccati equation:

A'P + PA - PBR^(-1)B'P + Q = 0

LQR gives optimal trade-off between state regulation and control effort.

Observer Design

If we can't measure all states, we build an observer:

x̂' = A x̂ + B u + L(y - C x̂)

The observer error (x - x̂) evolves as:

(x - x̂)' = (A - LC)(x - x̂)

Choose L so that A - LC is stable (eigenvalues in left half-plane).

The combined controller-observer is called a "compensator" and has the same input-output behavior as a state-feedback controller on the true state (separation principle).

Applications

  • Aerospace: rocket guidance, satellite attitude
  • Robotics: multi-joint control, trajectory tracking
  • Power systems: wide-area control
  • Process control: distillation columns

Key Takeaways

  • State-space handles MIMO and nonzero ICs
  • Controllability: can we steer the state anywhere?
  • Observability: can we determine the state?
  • Pole placement: put closed-loop poles where we want
  • LQR: optimal state feedback via cost minimization
  • Observer: reconstruct unmeasured states
  • State-space is the modern approach to control

📝 Problem Set 1: Transfer Functions, PID, Bode

Q1. For a plant P(s) = 10/(s+2), design a P controller to achieve a steady-state error < 5% for a unit step, and calculate the closed-loop pole.

Show Solution

P(0) = 10/2 = 5. Need 1/(1+5Kp) < 0.05 → Kp > 3.8. Choose Kp = 4. Closed loop: T(s) = 40/(s+42). Pole at s=-42. Fast, well-damped.

Q2. Find the phase margin of L(s) = 10/(s(s+1)(s+5)) at crossover frequency ω_c ≈ 1.4 rad/s.

Show Solution

At ω=1.4: |L| = 10/(1.4 × √(1+1.96) × √(1+49)) = 10/(1.4×1.72×7.07) ≈ 0.59. Not unity. ω_c is at ~1.0: |L| = 10/(1×1.41×5.1) ≈ 1.39. ω_c ≈ 1.15. ∠L(j1.15) = -90° - atan(1.15) - atan(1.15/5) = -90 - 49 - 13 = -152°. PM = 28°. Marginal — increase gain margin or add lead compensator.

Q3. A PID controller has Kp=2, Ki=1, Kd=0.5. Write its transfer function and explain the effect of each term on the closed-loop response.

Show Solution

C(s) = 2 + 1/s + 0.5s = (0.5s² + 2s + 1)/s. P term (Kp=2): speed. I term (Ki=1): eliminates steady-state error. D term (Kd=0.5): damps oscillations, predicts future error.

🎯 Midterm 1: System Modeling, Stability, PID

Q1. Determine stability of a system with characteristic equation s³ + 4s² + 5s + 2 = 0 using Routh-Hurwitz.

Show Solution

Routh array: s³: 1, 5; s²: 4, 2; s¹: (20-2)/4 = 4.5, 0; s⁰: 2. All elements in first column are positive: 1, 4, 4.5, 2. System is stable.

Q2. Sketch the Bode magnitude plot of G(s) = 100/(s(s+10)). Find crossover frequency and phase margin.

Show Solution

L(s) = 100/(s(s+10)) = 10/(s(0.1s+1)). Magnitude: at low ω, -20 dB/dec; after ω=10, -40 dB/dec. Crossover at ω ≈ 9.5 rad/s. Phase: -90° - atan(0.1ω). At ω=9.5, phase = -90 - 43 = -133°. PM = 47°. Reasonably stable.

Q3. Design a PI controller for plant P(s) = 1/(s+1)(s+2) to eliminate steady-state error and achieve PM > 45°.

Show Solution

PI: C(s) = Kp(1 + 1/(Ti·s)). Choose Ti = 1 (integrator zero at s=-1 cancels plant pole at s=-1). Plant becomes 1/(s+2). Choose Kp so crossover is at ω_c = 1: |Kp/s × 1/(s+2)| = 1 at ω=1. Kp = |jω(jω+2)| = √(1)(2.24) = 2.24. PM = 180 - 90 - atan(1/2) = 63°. Good.