MATLAB Compatibility Module

MATLAB compatibility subpackage.

This subpackage 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).

Warning

This module is not closely maintained and some functionality in the main python-control package may not be be available via the MATLAB compatibility module.

Creating Linear Models

tf(num, den[, dt])

Create a transfer function system.

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

Create a state space system.

frd(frdata, omega[, dt])

Construct a frequency response data (FRD) model.

zpk(zeros, poles, gain[, dt])

Create a transfer function from zeros, poles, gain.

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

Series connection of I/O systems.

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

Parallel connection of I/O systems.

feedback(sys1[, sys2, sign])

Feedback interconnection between two I/O systems.

negate(sys, **kwargs)

Return the negative of a system.

connect(sys, Q, inputv, outputv)

Index-based interconnection of an LTI system.

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

Group LTI models by appending their inputs and outputs.

System Gain and Dynamics

dcgain(...)

Compute the gain of the system in steady state.

pole(sys)

Compute system poles.

zero(sys)

Compute system zeros.

damp(sys[, doprint])

Compute system's natural frequencies, damping ratios, and poles.

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.

stepinfo(sysdata[, T, yfinal, ...])

Step response characteristics (rise time, settling time, etc).

Frequency-Domain Analysis

bode(sys[, omega, dB, Hz, deg, ...])

Bode plot of the frequency response.

nyquist(syslist[, omega])

Nyquist plot of the frequency response.

margin(sys)     margin(mag, phase, omega)

Gain and phase margins and associated crossover frequencies.

nichols(data[, omega, grid, title, ax, label])

Nichols plot for a system.

ngrid()

Plot Nichols chart grid.

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

Frequency response of an LTI system.

evalfr(sys, x[, squeeze])

Evaluate transfer function of LTI system at complex frequency.

Compensator Design

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

Root locus diagram.

sisotool(sys[, initial_gain, xlim_rlocus, ...])

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

Continuous-time linear quadratic estimator (Kalman filter).

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

Discrete-time linear quadratic estimator (Kalman filter).

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

Controllability matrix.

obsv(A, C[, t])

Observability matrix.

gram(sys, type)

Gramian (controllability or observability).

Model Simplification

minreal(sys[, tol, verbose])

Eliminate uncontrollable or unobservable states.

hsvd(sys)

Calculate the Hankel singular values.

balred(sys, orders[, method, alpha])

Balanced reduced order model of system of a given order.

modred(sys[, elim_states, method, ...])

Model reduction by input, output, or state elimination.

era(YY, r)

Calculate ERA model based on impulse-response data.

markov(Y, U, [, m])

Calculate Markov parameters [D CB CAB ...] from data.

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(response)     gangof4_plot(P, C, omega)

Plot response of "Gang of 4" transfer functions.

unwrap(angle[, period])

Unwrap a phase angle to give a continuous curve.

Functions Imported from Other Packages

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