Function reference

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

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) A class for models defined by frequency response data (FRD)
rss([states, outputs, inputs]) Create a stable continuous random state space object.
drss([states, outputs, inputs]) Create a stable discrete random state space object.

System interconnections

append(sys1, sys2, …, sysn) Group models by appending their inputs and outputs
connect(sys, Q, inputv, outputv) Index-base interconnection of system
feedback(sys1[, sys2, sign]) Feedback interconnection between two I/O systems.
negate(sys) Return the negative of a system.
parallel(sys1, *sysn) Return the parallel connection sys1 + sys2 (+ sys3 + …)
series(sys1, *sysn) Return the series connection (…

Frequency domain plotting

bode_plot(syslist[, omega, dB, Hz, deg, …]) Bode plot for a system
nyquist_plot(syslist[, omega, Plot, color, …]) Nyquist plot for a system
gangof4_plot(P, C[, omega]) Plot the “Gang of 4” transfer functions for a system
nichols_plot(syslist[, omega, grid]) Nichols plot for a system

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]) Simulate the output of a linear system.
impulse_response(sys[, T, X0, input, …]) Impulse response of a linear system
initial_response(sys[, T, X0, input, …]) Initial condition response of a linear system
step_response(sys[, T, X0, input, output, …]) Step response of a linear system
phase_plot(odefun[, X, Y, scale, X0, T, …]) Phase plot for 2D dynamical systems

Block diagram algebra

series(sys1, *sysn) Return the series connection (…
parallel(sys1, *sysn) Return the parallel connection sys1 + sys2 (+ sys3 + …)
feedback(sys1[, sys2, sign]) Feedback interconnection between two I/O systems.
negate(sys) Return the negative of a system.

Control system analysis

dcgain(sys) Return the zero-frequency (or DC) gain of the given system
evalfr(sys, x) Evaluate the transfer function of an LTI system for a single complex number x.
freqresp(sys, omega) Frequency response of an LTI system at multiple angular frequencies.
margin(sysdata) Calculate gain and phase margins and associated crossover frequencies
stability_margins(sysdata[, returnall, epsw]) Calculate stability margins and associated crossover frequencies.
phase_crossover_frequencies(sys) Compute frequencies and gains at intersections with real axis in Nyquist plot.
pole(sys) Compute system poles.
zero(sys) Compute system zeros.
pzmap(sys[, Plot, title]) Plot a pole/zero map for a linear system.
root_locus(sys[, kvect, xlim, ylim, …]) Root locus plot

Matrix computations

care(A, B, Q[, R, S, E]) (X,L,G) = care(A,B,Q,R=None) solves the continuous-time algebraic Riccati equation
dare(A, B, Q, R[, S, E]) (X,L,G) = dare(A,B,Q,R) solves the discrete-time algebraic Riccati equation
lyap(A, Q[, C, E]) X = lyap(A,Q) solves the continuous-time Lyapunov equation
dlyap(A, Q[, C, E]) dlyap(A,Q) solves the discrete-time Lyapunov equation
ctrb(A, B) Controllabilty matrix
obsv(A, C) Observability matrix
gram(sys, type) Gramian (controllability or observability)

Control system synthesis

acker(A, B, poles) Pole placement using Ackermann method
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 K = place(A, B, p)

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) Calculate the first M Markov parameters [D CB CAB …] from input U, output Y.

Utility functions and conversions

augw(g[, w1, w2, w3]) Augment plant for mixed sensitivity problem.
canonical_form(xsys[, form]) Convert a system into canonical form
damp(sys[, doprint]) Compute natural frequency, damping ratio, and poles of a system
db2mag(db) Convert a gain in decibels (dB) to a magnitude
isctime(sys[, strict]) Check to see if a system is a continuous-time system
isdtime(sys[, strict]) 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) Return True if an object is a system, otherwise False
mag2db(mag) Convert a magnitude to decibels (dB)
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
sample_system(sysc, Ts[, method, alpha]) Convert a continuous time system to discrete time
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 an LTI system
timebaseEqual(sys1, sys2) Check to see if two systems have the same timebase
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