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(num, den[, dt])

Create a transfer function system.

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

Create a state space system.

frd(d, w)

Construct a frequency response data model

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


Convert a magnitude to decibels (dB)


Convert a gain in decibels (dB) to a magnitude

c2d(sysc, Ts[, method, prewarp_frequency])

Return a discrete-time system


Transform a state space system to a transfer function.


Transform a transfer function to a state space system.


Return transfer function data objects for a system

System interconnections

series(sys1, *sysn)

Return the series connection (sysn * .

parallel(sys1, *sysn)

Return the parallel connection sys1 + sys2 (+ .

feedback(sys1[, sys2, sign])

Feedback interconnection between two I/O systems.


Return the negative of a system.

connect(sys, Q, inputv, outputv)

Index-based interconnection of an LTI system.

append(sys1, sys2, …, sysn)

Group models by appending their inputs and outputs

System gain and dynamics


Compute the gain of the system in steady state.


Compute system poles.


Compute system zeros.

damp(sys[, doprint])

Compute natural frequency, damping ratio, and poles of a system

pzmap(sys[, plot, grid, 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(syslist[, omega, dB, Hz, deg, …])

Bode plot of the frequency response

nyquist(syslist[, omega, plot, label_freq, …])

Nyquist plot for a system

nichols(sys_list[, omega, grid])

Nichols plot for a system


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

sisotool(sys[, kvect, xlim_rlocus, …])

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

place(A, B, p)

Place closed loop eigenvalues

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

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.


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, transpose])

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, stabilizing])

(X, L, G) = care(A, B, Q, R=None) solves the continuous-time algebraic Riccati equation

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

(X, L, G) = dare(A, B, Q, R) solves the discrete-time algebraic Riccati equation

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(start, stop[, num, endpoint, …])

Return evenly spaced numbers over a specified interval.

logspace(start, stop[, num, endpoint, base, …])

Return numbers spaced evenly on a log scale.

ss2zpk(A, B, C, D[, input])

State-space representation to zero-pole-gain representation.

tf2zpk(b, a)

Return zero, pole, gain (z, p, k) representation from a numerator, denominator representation of a linear filter.

zpk2ss(z, p, k)

Zero-pole-gain representation to state-space representation

zpk2tf(z, p, k)

Return polynomial transfer function representation from zeros and poles