This page contains information for downloading and installing python-control. This package is designed for use in the IPython environment, with SciPy extensions for scientific computing plus the matplotlib extensions (which enables MATLAB-like plotting).
In order to run control-python, you must first install some standard python packages:
If you have everything installed correctly, you should be able to run the following code
from scipy import *
from pylab import * # Not needed if you use ipython -pylab
a = zeros(1000)
a[:100]=1
b = fft(a)
plot(abs(b))
show() # Not needed if you use ipython -pylab
Some of the underlying functions in python-control are carried out using the SLICOT software library. The python-control library uses the slycot python wrapper developed by Enrico Avventi at KTH and currently maintained by Rene van Paassen. * Slycot is only required for functions that make use of SLICOT routines (eg, linear quadratic regulators, Kalman filtering, control) * The slycot library is currently under development and the API is not yet fixed. Some errors may occur if the version of slycot and python-control are incompatible
The python-control package can be downloaded from SourceForge:
The files are distributed as compressed tar files. To unpack and installed, run the following from the command line
tar xzf control-N.mx.tar.gz
cd control-N.mx
python setup.py install
where N-mx is the latest release (eg, 0.3c).
To see if things are working, you can run the script secord-matlab.py (using either python or ipython -pylab). It should generate a step response, Bode plot and Nyquist plot for a simple second order linear system.
To compile for 64 bit architecture on OS X, edit setup.py to include the lines
extra_link_args=['-arch x86_64']
and then run setup.py as
python setup.py config_fc --arch="-arch x86_64" build