Control System Design

Control Systemsadvanced~15 min

Model a plant as a transfer function, analyse stability margins, use root locus, then tune a PID controller for a specified step response.

Step 1 — Define the plant model

A second-order plant G(s) = 10 / (s² + s + 10) is a common benchmark for control design. Plot the step response to see the uncontrolled behaviour.

G = tf([10], [1, 1, 10]);
stepResponse(G);
title('Open-loop step response')
▶ Run in SimLab

Expected output: Underdamped step response with significant overshoot

Step 2 — Bode plot and stability margins

The Bode diagram shows gain/phase margins. A robust design needs ≥ 6 dB gain margin and ≥ 45° phase margin. margin() returns an object with Gm, Pm, Wcg, Wcp fields.

G = tf([10], [1, 1, 10]);
bode(G);
m = margin(G);
disp(m)
▶ Run in SimLab

Expected output: Bode plot with margins annotated

Step 3 — Root locus for gain selection

The root locus shows how closed-loop poles move as gain K increases. Click a point on the locus to read off a good gain.

G = tf([10], [1, 1, 10]);
rlocus(G)
▶ Run in SimLab

Expected output: Root locus plot

Step 4 — Add a PID controller

A PID controller C(s) = Kp + Ki/s + Kd*s improves the step response. Tune Kp=2, Ki=5, Kd=0.5 and check the closed-loop result.

G = tf([10], [1, 1, 10]);
Kp = 2; Ki = 5; Kd = 0.5;
C = tf([Kd, Kp, Ki], [1, 0]);
T = feedback(C*G, 1);
stepResponse(T);
title('Closed-loop with PID')
▶ Run in SimLab

Expected output: Faster step response with reduced overshoot

Related Tutorials

Try SimLab — MATLAB®-compatible, free, in your browser

466 functions. Runs in your browser. No install.

Open SimLab

MATLAB® is a registered trademark of The MathWorks, Inc. SimLab is an independent project by Simulations4All and is not affiliated with, endorsed by, or sponsored by The MathWorks, Inc.

Stay Updated

Get notified about new simulations and tools. We send 1-2 emails per month.