# control.matlab.rlocus¶

control.matlab.rlocus(sys, kvect=None, xlim=None, ylim=None, plotstr=None, plot=True, print_gain=None, grid=None, ax=None, initial_gain=None, **kwargs)[source]

Root locus plot

Calculate the root locus by finding the roots of 1+k*TF(s) where TF is self.num(s)/self.den(s) and each k is an element of kvect.

Parameters
• sys (LTI object) – Linear input/output systems (SISO only, for now).

• kvect (array_like, optional) – Gains to use in computing plot of closed-loop poles.

• xlim (tuple or list, optional) – Set limits of x axis, normally with tuple (see matplotlib.axes).

• ylim (tuple or list, optional) – Set limits of y axis, normally with tuple (see matplotlib.axes).

• plotstr (`matplotlib.pyplot.plot()` format string, optional) – plotting style specification

• plot (boolean, optional) – If True (default), plot root locus diagram.

• print_gain (bool) – If True (default), report mouse clicks when close to the root locus branches, calculate gain, damping and print.

• grid (bool) – If True plot omega-damping grid. Default is False.

• ax (`matplotlib.axes.Axes`) – Axes on which to create root locus plot

• initial_gain (float, optional) – Used by `sisotool()` to indicate initial gain.

Returns

• roots (ndarray) – Closed-loop root locations, arranged in which each row corresponds to a gain in gains

• gains (ndarray) – Gains used. Same as kvect keyword argument if provided.

Notes

The root_locus function calls matplotlib.pyplot.axis(‘equal’), which means that trying to reset the axis limits may not behave as expected. To change the axis limits, use matplotlib.pyplot.gca().axis(‘auto’) and then set the axis limits to the desired values.