Charts/Science charts
Root Locus
<RootLocus /> · 12 examples
The paths the closed-loop poles take across the complex plane as the feedback gain is turned up.
Overview
You close a feedback loop around a system, you turn the gain up to make it respond faster, and at some point it begins to ring, then to shake, then to leave the building. Every control engineer has seen it happen and wants to know where. The location is not mysterious: it is the point where a closed-loop pole crosses from the left half of the complex plane into the right. The root locus is a map of every place those poles go on the way.
Walter Evans introduced the method in 1948, in an era when the alternative was solving a polynomial by hand for each gain you cared about, and a graphical trick that let you sketch all the answers at once was a gift. It still is. A root locus shows you stability, speed and damping for every gain in one picture, and it tells you whether a gain knob can fix your problem at all or whether you need to change the plant.
Poles start at the open-loop poles when the gain is zero. As the gain grows they travel, and in the limit they end at the zeros, or run to infinity. The chart draws each path in its own colour, so you can watch the rise of an instability as one branch heading for the imaginary axis.
Props
API
<RootLocus numerator={vec![1., 2.]} denominator={vec![1., 3., 2., 0.]} gain={(0., 50.)} />| Prop | Type | Default |
|---|---|---|
numerator, denominator | Vec<f64>: the open-loop transfer function's coefficients, highest power first | required |
gain | (f64, f64): the range of K | (0., 100.) |
steps | usize: gains sampled across the range | 400 |
legend, tooltip, class |
For each K the closed-loop poles are the roots of denominator + K × numerator, found with the Durand–Kerner method. Each branch is tracked from one K to the next so its line stays continuous. Open-loop poles are marked with squares and zeros with open circles.
Run them
12 examples
Press Run to load an example into the live render at the top of the page. Open one to read its code.
How to read it
- 01Find the squares (poles) and circles (zeros). At the lowest gain, each branch begins at a square.
- 02Follow each branch. It ends at a circle or runs off the edge, and the colour tells you which branch you are following.
- 03Note where any branch crosses the vertical axis. That is the gain at which the loop becomes unstable. Hover near the crossing to read the coordinates.
- 04Look for branches that leave the real axis and curve: that is the gain where the response starts to oscillate, and the angle from the axis is the damping.
When to use it, and when not to
Reach for it when
- You are choosing a gain for a loop and want to know how far you can push it before it goes unstable.
- You want to see how adding a pole or zero, such as a lag or lead compensator, bends the paths and changes what gain can do.
- You want to read damping and settling speed off the geometry: how far the poles are from the imaginary axis and how far off the real axis.
- You are teaching: this is the one chart that explains why high gain is not free.
Skip it when
- Your loop has a large pure time delay. A delay is not a rational function, so it must be approximated before the locus is meaningful.
- You need to measure a real system's margins. A Nyquist plot or a Bode plot is based on measured frequency response, not on a model.
- You have several tunable parameters. A root locus is a one-parameter sweep. Two parameters need a family of them.
- The model is badly conditioned or very high order. Root finding on a polynomial of degree 20 or more loses accuracy quickly.
The math behind it
The closed-loop equation
Take an open-loop transfer function and unity negative feedback with gain . The closed-loop poles are the roots of the characteristic equation below. Pass numerator and denominator as coefficient lists, highest power first, so is vec![1., 3., 2.].
Sweeping the gain
The chart takes steps values of (400 by default) across the gain range, which is unless you say otherwise. The spacing depends on the lower end. If it is positive, the values are geometric, so each decade of gain gets equal room, if it is zero or negative, they follow a quadratic ramp that puts more samples at small gain, where the poles move fastest. With running from 0 to 1:
Finding the roots and keeping branches straight
At each the two polynomials are padded to the same length, combined coefficient by coefficient into , and the roots are found with the Durand-Kerner iteration: start from points on the powers of and repeatedly move each estimate by , for up to 500 sweeps or until no estimate moves more than .
Root finders return their answers in no particular order, so a naive plot would swap branches at random. The chart matches each new root to the nearest root of the previous gain, which keeps each colour attached to its own path. Poles are drawn as red squares at the open-loop roots, zeros as green hollow circles. The system is stable at a given if every root has a negative real part, which on the plot means every point is left of the vertical axis.
Real life usage
The antenna that learned to wobble
Hamid was a control engineer at a small company that built tracking antennas for weather satellites. The dish had to follow a pass across the sky within a tenth of a degree, and the motor loop was tuned by a person named Roy, who had retired and left a note that said, in full, gain of 12, do not touch.
Customers wanted faster tracking. A faster tracker meant a higher gain, and Hamid had a model of the dish, a motor with a slow mechanical pole and a faster electrical one, along with a deadline and a mild fear of Roy's note. He could try a higher gain on the real antenna and learn the limit the hard way, which is also how the previous generation of dishes had learned it, loudly, in the car park.
He wanted the limit on paper first. He also wanted to know whether the gain knob was even the right tool, or whether the dish needed a compensator before any amount of gain could give the speed the customers wanted.
In zopra-charts he passed the model's numerator and denominator to <RootLocus> with a gain range from 0.1 to 200. Two branches left the real axis near the origin, met in the middle, split into a complex pair and curved to the right. They crossed the imaginary axis at a gain of about 38. Roy's 12 was comfortably inside, with a pair of poles at a damping ratio of 0.6.
That gave him the answer and the problem. The dish could go to a gain of about 25 with acceptable damping, and no further. Past that, the arc curved too close to the axis. A faster loop needed the poles moved, not just pushed, so he added a lead compensator: a zero at minus 4 and a pole at minus 20. The new locus bent the branches away from the axis and gave him a gain of 70 before instability.
The new dish tracked a fast pass with a worst-case pointing error of 0.04 degrees, down from 0.11. Roy was invited to the demonstration and stood in front of the plot for a full minute. He said his gain of 12 had been the right answer, for the question he was asked.
Pitfalls
- Coefficient order. Highest power first. Reversing the list gives you the locus of a different system, usually one that looks plausible.
- Numerator longer than denominator. An improper transfer function has no valid locus. The chart will draw something, and it will mean nothing.
- A gain range that starts at zero. The quadratic ramp is good for seeing the poles leave their start, but gives few samples at large gain. If you care about the far end, start above zero to get geometric spacing.
- Branch swapping at a collision. Where two branches meet on the real axis, nearest-neighbour matching can exchange them for one step. The paths are right as a set. The colours at the junction are not guaranteed.
From around the web