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

Create a stable random state space object.

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

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

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, alpha, ...])

Convert a continuous time system to discrete time by sampling.

ss2tf(sys)

Transform a state space system to a transfer function.

tf2ss(sys)

Transform a transfer function to a state space system.

tfdata(sys)

Return transfer function data objects for a system.

System interconnections

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

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

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

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

feedback(sys1[, sys2, sign])

Feedback interconnection between two I/O systems.

negate(sys)

Return the negative of a system.

connect(*args)

Index-based interconnection of an LTI system.

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

Group LTI state space 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 frequencies, damping ratios, and poles of a system.

pzmap(sys[, grid, plot])

Plot a pole/zero map for a linear system.

Time-domain analysis

step(sys[, T, input, output, return_x])

Step response of a linear system.

impulse(sys[, T, 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])

Nyquist plot of the frequency response.

nichols(data[, omega, grid, title, legend_loc])

Nichols plot for a system.

margin(sysdata)

Calculate gain and phase margins and associated crossover frequencies.

freqresp(sysdata[, omega, omega_limits, ...])

Frequency response of an LTI system at multiple angular frequencies.

evalfr(sys, x[, squeeze])

Evaluate the transfer function of an LTI system for complex frequency x.

Compensator design

rlocus(sys[, klist, xlim, ylim, ...])

Root locus diagram.

sisotool(sys[, initial_gain, 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.

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

Discrete-time linear quadratic regulator design.

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

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

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

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

State-space (SS) models

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.

ctrb(A, B[, t])

Controllabilty matrix.

obsv(A, C[, t])

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

Solves the continuous-time Lyapunov equation.

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

Solves the discrete-time Lyapunov equation.

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

Solves the continuous-time algebraic Riccati equation.

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

Solves the discrete-time algebraic Riccati equation.

Additional functions

gangof4(P, C[, omega])

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

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