Python Control Systems Library

0.10.2 · active · verified Wed Apr 15

The Python Control Systems Library (python-control) is an open-source Python package that implements basic operations for the analysis and design of feedback control systems. It provides functionalities for linear and nonlinear input/output systems, block diagram algebra, time and frequency response, control analysis, and design. The library is actively maintained, with version 0.10.2 being the current stable release, and follows a regular release cadence with ongoing improvements and bug fixes.

Warnings

Install

Imports

Quickstart

This quickstart defines a simple continuous-time state-space system, calculates its step response, and plots the output using Matplotlib. It demonstrates the basic workflow of defining a system and analyzing its time-domain behavior.

import control as ct
import numpy as np
import matplotlib.pyplot as plt

# Define a simple state-space system
A = np.array([[-0.5, -1], [1, 0]])
B = np.array([[1], [0]])
C = np.array([[0, 1]])
D = np.array([[0]])
sys = ct.ss(A, B, C, D)

# Simulate a step response
time, response = ct.step_response(sys)

# Plot the step response
plt.plot(time, response.outputs[0])
plt.xlabel('Time (s)')
plt.ylabel('Output')
plt.title('Step Response')
plt.grid()
plt.show()

view raw JSON →