MATLAB compatibility module

The control.matlab module contains a number of functions that emulate some of the functionality of MATLAB. The intent of these functions is to provide a simple interface to the python control systems library (python-control) for people who are familiar with the MATLAB Control Systems Toolbox (tm).

Creating linear models

tf(*args) Create a transfer function system.
ss(*args) Create a state space system.
frd(*args) Construct a Frequency Response Data model, or convert a system
rss([states, outputs, inputs]) Create a stable continuous random state space object.
drss([states, outputs, inputs]) Create a stable discrete random state space object.

Utility functions and conversions

mag2db(mag) Convert a magnitude to decibels (dB)
db2mag(db) Convert a gain in decibels (dB) to a magnitude
c2d(sysc, Ts[, method]) Return a discrete-time system
ss2tf(*args) Transform a state space system to a transfer function.
tf2ss(*args) Transform a transfer function to a state space system.
tfdata(sys) Return transfer function data objects for a system

System interconnections

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

System gain and dynamics

dcgain(*args) Compute the gain of the system in steady state.
pole(sys) Compute system poles.
zero(sys) Compute system zeros.
damp(sys[, doprint]) Compute natural frequency, damping ratio, and poles of a system
pzmap(sys[, Plot, title]) Plot a pole/zero map for a linear system.

Time-domain analysis

step(sys[, T, X0, input, output, return_x]) Step response of a linear system
impulse(sys[, T, X0, input, output, return_x]) Impulse response of a linear system
initial(sys[, T, X0, input, output, return_x]) Initial condition response of a linear system
lsim(sys[, U, T, X0]) Simulate the output of a linear system.

Frequency-domain analysis

bode(*args, **keywords) Bode plot of the frequency response
nyquist(syslist[, omega, Plot, color, labelFreq]) Nyquist plot for a system
nichols(syslist[, omega, grid]) Nichols plot for a system
margin(*args) Calculate gain and phase margins and associated crossover frequencies
freqresp(sys, omega) Frequency response of an LTI system at multiple angular frequencies.
evalfr(sys, x) Evaluate the transfer function of an LTI system for a single complex number x.

Compensator design

rlocus(sys[, kvect, xlim, ylim, plotstr, …]) Root locus plot
place(A, B, p) Place closed loop eigenvalues
lqr(*args, **keywords) Linear quadratic regulator design

State-space (SS) models

rss([states, outputs, inputs]) Create a stable continuous random state space object.
drss([states, outputs, inputs]) Create a stable discrete random state space object.
ctrb(A, B) Controllabilty matrix
obsv(A, C) Observability matrix
gram(sys, type) Gramian (controllability or observability)

Model simplification

minreal(sys[, tol, verbose]) Eliminates uncontrollable or unobservable states in state-space models or cancelling pole-zero pairs in transfer functions.
hsvd(sys) Calculate the Hankel singular values.
balred(sys, orders[, method, alpha]) Balanced reduced order model of sys of a given order.
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.

Time delays

pade(T[, n, numdeg]) Create a linear system that approximates a delay.

Matrix equation solvers and linear algebra

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
care(A, B, Q[, R, S, E]) (X,L,G) = care(A,B,Q,R=None) solves the continuous-time algebraic Riccati
dare(A, B, Q, R[, S, E]) (X,L,G) = dare(A,B,Q,R) solves the discrete-time algebraic Riccati

Additional functions

gangof4(P, C[, omega]) Plot the “Gang of 4” transfer functions for a system
unwrap(angle[, period]) Unwrap a phase angle to give a continuous curve

Functions imported from other modules

linspace
logspace
ss2zpk
tf2zpk
zpk2ss
zpk2tf