Function reference

The Python Control Systems Library control provides common functions for analyzing and designing feedback control systems.

Documentation is available in two forms: docstrings provided with the code, and the python-control users guide, available from the python-control homepage.

The docstring examples assume that the following import commands:

>>> import numpy as np
>>> import control as ct

Available subpackages

The main control package includes the most common functions used in analysis, design, and simulation of feedback control systems. Several additional subpackages are available that provide more specialized functionality:

  • flatsys: Differentially flat systems

  • matlab: MATLAB compatibility module

  • optimal: Optimization-based control

  • phaseplot: 2D phase plane diagrams

System creation

ss(A, B, C, D[, dt])

Create a state space system.

tf(num, den[, dt])

Create a transfer function system.

frd(d, w)

Construct a frequency response data model.

zpk(zeros, poles, gain[, dt])

Create a transfer function from zeros, poles, gain.

rss([states, outputs, inputs, strictly_proper])

Create a stable random state space object.

drss([states, outputs, inputs, strictly_proper])

Create a stable, discrete-time, random state space system.

nlsys(updfcn[, outfcn, inputs, outputs, states])

Create a nonlinear input/output system.

System interconnections

append(sys1, sys2, [..., sysn])

Group LTI state space models by appending their inputs and outputs.

connect(sys, Q, inputv, outputv)

Index-based interconnection of an LTI system.

feedback(sys1[, sys2, sign])

Feedback interconnection between two I/O systems.

interconnect(syslist[, connections, ...])

Interconnect a set of input/output systems.

negate(sys)

Return the negative of a system.

parallel(sys1, sys2, [..., sysn])

Return the parallel connection sys1 + sys2 (+ ... + sysn).

series(sys1, sys2, [..., sysn])

Return the series connection (sysn * ... *) sys2 * sys1.

connection_table(sys[, show_names, column_width])

Print table of connections inside an interconnected system model.

Frequency domain plotting

bode_plot(data[, omega, ax, omega_limits, ...])

Bode plot for a system.

describing_function_plot(data, *args, **kwargs)

Plot a Nyquist plot with a describing function for a nonlinear system.

nyquist_plot(data[, omega, plot, ...])

Nyquist plot for a system.

gangof4_plot(P, C[, omega])

Legacy Gang of 4 plot; use gangof4_response().plot() instead.

nichols_plot(data[, omega, grid, title, ...])

Nichols plot for a system.

nichols_grid([cl_mags, cl_phases, ...])

Nichols chart grid.

Note: For plotting commands that create multiple axes on the same plot, the individual axes can be retrieved using the axes label (retrieved using the get_label method for the matplotliib axes object). The following labels are currently defined:

  • Bode plots: control-bode-magnitude, control-bode-phase

  • Gang of 4 plots: control-gangof4-s, control-gangof4-cs, control-gangof4-ps, control-gangof4-t

Time domain simulation

forced_response(sys[, T, U, X0, transpose, ...])

Compute the output of a linear system given the input.

impulse_response(sys[, T, input, output, ...])

Compute the impulse response for a linear system.

initial_response(sys[, T, X0, output, ...])

Compute the initial condition response for a linear system.

input_output_response(sys, T[, U, X0, ...])

Compute the output response of a system to a given input.

phase_plot(odefun[, X, Y, scale, X0, T, ...])

(legacy) Phase plot for 2D dynamical systems.

step_response(sys[, T, X0, input, output, ...])

Compute the step response for a linear system.

TimeResponseData(time, outputs[, states, ...])

A class for returning time responses.

Control system analysis

dcgain(sys)

Return the zero-frequency (or DC) gain of the given system.

describing_function(F, A[, num_points, ...])

Numerically compute the describing function of a nonlinear function.

frequency_response(sysdata[, omega, ...])

Frequency response of an LTI system at multiple angular frequencies.

get_input_ff_index(sys)

Return the input feedforward passivity (IFP) index for the system.

get_output_fb_index(sys)

Return the output feedback passivity (OFP) index for the system.

ispassive(sys[, ofp_index, ifp_index])

Indicate if a linear time invariant (LTI) system is passive.

margin(sysdata)

Calculate gain and phase margins and associated crossover frequencies.

stability_margins(sysdata[, returnall, ...])

Calculate stability margins and associated crossover frequencies.

step_info(sysdata[, T, T_num, yfinal, ...])

Step response characteristics (Rise time, Settling Time, Peak and others).

phase_crossover_frequencies(sys)

Compute frequencies and gains at intersections with real axis in Nyquist plot.

poles(sys)

Compute system poles.

zeros(sys)

Compute system zeros.

pzmap(data[, plot, grid, title, ...])

Plot a pole/zero map for a linear system.

root_locus(sysdata[, gains, grid, plot])

Root locus plot.

sisotool(sys[, initial_gain, xlim_rlocus, ...])

Sisotool style collection of plots inspired by MATLAB's sisotool.

StateSpace.__call__(x[, squeeze, warn_infinite])

Evaluate system's frequency response at complex frequencies.

TransferFunction.__call__(x[, squeeze, ...])

Evaluate system's transfer function at complex frequencies.

Matrix computations

care(A, B, Q[, R, S, E, stabilizing, ...])

Solves the continuous-time algebraic Riccati equation.

ctrb(A, B[, t])

Controllabilty matrix.

dare(A, B, Q, R[, S, E, stabilizing, ...])

Solves the discrete-time algebraic Riccati equation.

dlyap(A, Q[, C, E, method])

Solves the discrete-time Lyapunov equation.

lyap(A, Q[, C, E, method])

Solves the continuous-time Lyapunov equation.

obsv(A, C[, t])

Observability matrix.

gram(sys, type)

Gramian (controllability or observability).

Control system synthesis

acker(A, B, poles)

Pole placement using Ackermann method.

create_statefbk_iosystem(sys, gain[, ...])

Create an I/O system using a (full) state feedback controller.

dlqr(A, B, Q, R[, N])

Discrete-time linear quadratic regulator design.

h2syn(P, nmeas, ncon)

H_2 control synthesis for plant P.

hinfsyn(P, nmeas, ncon)

H_{inf} control synthesis for plant P.

lqr(A, B, Q, R[, N])

Linear quadratic regulator design.

mixsyn(g[, w1, w2, w3])

Mixed-sensitivity H-infinity synthesis.

place(A, B, p)

Place closed loop eigenvalues.

rootlocus_pid_designer(plant[, gain, sign, ...])

Manual PID controller design based on root locus using Sisotool.

Model simplification tools

minreal(sys[, tol, verbose])

Eliminates uncontrollable or unobservable states in state-space models or cancelling pole-zero pairs in transfer functions.

balred(sys, orders[, method, alpha])

Balanced reduced order model of sys of a given order.

hsvd(sys)

Calculate the Hankel singular values.

modred(sys, ELIM[, method])

Model reduction of sys by eliminating the states in ELIM using a given method.

era(YY, m, n, nin, nout, r)

Calculate an ERA model of order r based on the impulse-response data YY.

markov(Y, U[, m, transpose])

Calculate the first m Markov parameters [D CB CAB ...] from input U, output Y.

Nonlinear system support

describing_function(F, A[, num_points, ...])

Numerically compute the describing function of a nonlinear function.

find_eqpt(sys, x0[, u0, y0, t, params, iu, ...])

Find the equilibrium point for an input/output system.

linearize(sys, xeq[, ueq, t, params])

Linearize an input/output system at a given state and input.

input_output_response(sys, T[, U, X0, ...])

Compute the output response of a system to a given input.

summing_junction([inputs, output, ...])

Create a summing junction as an input/output system.

flatsys.point_to_point(sys, timepts[, x0, ...])

Compute trajectory between an initial and final conditions.

Stochastic system support

correlation(T, X[, Y, squeeze])

Compute the correlation of time signals.

create_estimator_iosystem(sys, QN, RN[, P0, ...])

Create an I/O system implementing a linear quadratic estimator.

dlqe(A, G, C, QN, RN, [, N])

Linear quadratic estimator design (Kalman filter) for discrete-time systems.

lqe(A, G, C, QN, RN, [, NN])

Linear quadratic estimator design (Kalman filter) for continuous-time systems.

white_noise(T, Q[, dt])

Generate a white noise signal with specified intensity.

Utility functions and conversions

augw(g[, w1, w2, w3])

Augment plant for mixed sensitivity problem.

bdschur(a[, condmax, sort])

Block-diagonal Schur decomposition.

canonical_form(xsys[, form])

Convert a system into canonical form.

damp(sys[, doprint])

Compute natural frequencies, damping ratios, and poles of a system.

db2mag(db)

Convert a gain in decibels (dB) to a magnitude.

isctime([sys, dt, strict])

Check to see if a system is a continuous-time system.

isdtime([sys, strict, dt])

Check to see if a system is a discrete time system.

issiso(sys[, strict])

Check to see if a system is single input, single output.

issys(obj)

Deprecated function to check if an object is an LTI system.

mag2db(mag)

Convert a magnitude to decibels (dB).

modal_form(xsys[, condmax, sort])

Convert a system into modal canonical form.

norm(system[, p, tol, print_warning, method])

Computes norm of system.

observable_form(xsys)

Convert a system into observable canonical form.

pade(T[, n, numdeg])

Create a linear system that approximates a delay.

reachable_form(xsys)

Convert a system into reachable canonical form.

reset_defaults()

Reset configuration values to their default (initial) values.

sample_system(sysc, Ts[, method, alpha, ...])

Convert a continuous time system to discrete time by sampling.

set_defaults(module, **keywords)

Set default values of parameters for a module.

similarity_transform(xsys, T[, timescale, ...])

Perform a similarity transformation, with option time rescaling.

ss2tf(sys)

Transform a state space system to a transfer function.

ssdata(sys)

Return state space data objects for a system.

tf2ss(sys)

Transform a transfer function to a state space system.

tfdata(sys)

Return transfer function data objects for a system.

timebase(sys[, strict])

Return the timebase for a system.

unwrap(angle[, period])

Unwrap a phase angle to give a continuous curve.

use_fbs_defaults()

Use Feedback Systems (FBS) compatible settings.

use_matlab_defaults()

Use MATLAB compatible configuration settings.