# 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¶

 mag2db(mag) Convert a magnitude to decibels (dB) db2mag(db) Convert a gain in decibels (dB) to a magnitude c2d(sysc, Ts[, method, prewarp_frequency]) Return a discrete-time system 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, *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. negate(sys) 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¶

 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, 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 margin(sysdata) 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. 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]) 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