Control systems

Model a system with tf or ss, plot its frequency response with bode and nyquist, and design a controller with rlocus and lqr.

  • Existing MATLAB control code runs as written
  • Bode, Nyquist, root locus and step plots from a transfer function
  • PID and LQR design in the same script as the model
  • Free to try, with nothing to install
Download RunMat

Explore the RunMat runtime

Bode plot of a second-order low-pass filter with its -3 dB point marked, drawn by RunMat from the saved analysis study
A second-order low-pass filter with a natural frequency of 10 rad/s and damping ratio 0.707, drawn by RunMat. The gain is 3 dB down at 9.99 rad/s, where the phase is near -90 degrees.

Why use RunMat for control systems

No toolbox to buy for bode and lqr

Loop design usually starts with paying for a control toolbox, or waiting for a shared license. tf, bode, rlocus, step and lqr are part of the RunMat runtime next to the core math functions, free for individuals, education, research and smaller companies.

Runtime

Retune a gain and every plot follows

Retuning a loop by hand means redrawing the Bode, step and root locus plots one at a time. Change a pole, a zero or a gain in the script and run it again, and every plot made from that transfer function is redrawn from the new model.

Desktop app

Simulate the loop you designed

Copying gains from a design tool into a separate simulation invites typos. Pass the gain from lqr to ode45 in the same script to simulate the closed loop, including a nonlinear model of the plant.

Differential equations

Catch a lost margin on every commit

A controller change that eats into the phase margin can go unnoticed until hardware test. runmat test runs the design script in CI with no license server to activate, so the pull request fails when a margin check fails.

CLI, CI and containers

Examples

A root locus reaching the imaginary axis at the marked points, where the gain equals its margin, rendered by RunMat

Check a gain margin by hand

The frequency response, the Routh array and rlocus all give a gain margin of 3.

Closed-loop step responses for three proportional gains, rendered by RunMat

Proportional gain and overshoot

Step responses for K = 0.5, 1 and 2, with rise time and overshoot from stepinfo.

Nyquist plots for two gains, one encircling the critical point at -1, rendered by RunMat

Stability from a Nyquist plot

At K = 4 the curve encircles -1 and the closed loop has two unstable poles.

Step responses of a thermal plant under P and PI control, rendered by RunMat

Add integral action

A PI controller removes the 29% steady-state error left by proportional control.

A ramp reference and the closed-loop output lagging it by a constant amount, rendered by RunMat

Ramp tracking error

A type-1 loop follows a ramp with a constant lag of 1/Kv = 0.5.

Continuous and sampled step responses of the same loop, rendered by RunMat

Discretize with a zero-order hold

Sampling at 0.5 s with a zero-order hold raises the overshoot from 25% to 40%.

Bode plot of a mass-spring-damper with a resonant peak near 10 rad/s, rendered by RunMat

Resonance on a Bode plot

A mass-spring-damper with damping ratio 0.1 peaks 14 dB above its static gain.

Pole-zero map of three second-order systems beside their step responses, rendered by RunMat

Damping ratio and overshoot

Pole locations and step responses for damping ratios of 0.2, 0.5 and 0.8.

Cart position, pendulum angle and control force as LQR balances an inverted pendulum, rendered by RunMat

LQR for an inverted pendulum

State feedback from lqr, simulated with ode45 from a 0.2 rad tilt.

Try it on your own data

Download RunMat
Read the docs