control.phase_plot

control.phase_plot(odefun, X=None, Y=None, scale=1, X0=None, T=None, lingrid=None, lintime=None, logtime=None, timepts=None, parms=(), verbose=True)

Phase plot for 2D dynamical systems

Produces a vector field or stream line plot for a planar system.

Call signatures:
phase_plot(func, X, Y, ...) - display vector field on meshgrid phase_plot(func, X, Y, scale, ...) - scale arrows phase_plot(func. X0=(...), T=Tmax, ...) - display stream lines phase_plot(func, X, Y, X0=[...], T=Tmax, ...) - plot both phase_plot(func, X0=[...], T=Tmax, lingrid=N, ...) - plot both phase_plot(func, X0=[...], lintime=N, ...) - stream lines with arrows
Parameters:

func : callable(x, t, ...)

Computes the time derivative of y (compatible with odeint). The function should be the same for as used for scipy.integrate. Namely, it should be a function of the form dxdt = F(x, t) that accepts a state x of dimension 2 and returns a derivative dx/dt of dimension 2.

X, Y: ndarray, optional

Two 1-D arrays representing x and y coordinates of a grid. These arguments are passed to meshgrid and generate the lists of points at which the vector field is plotted. If absent (or None), the vector field is not plotted.

scale: float, optional

Scale size of arrows; default = 1

X0: ndarray of initial conditions, optional

List of initial conditions from which streamlines are plotted. Each initial condition should be a pair of numbers.

T: array-like or number, optional

Length of time to run simulations that generate streamlines. If a single number, the same simulation time is used for all initial conditions. Otherwise, should be a list of length len(X0) that gives the simulation time for each initial condition. Default value = 50.

lingrid = N or (N, M): integer or 2-tuple of integers, optional

If X0 is given and X, Y are missing, a grid of arrows is produced using the limits of the initial conditions, with N grid points in each dimension or N grid points in x and M grid points in y.

lintime = N: integer, optional

Draw N arrows using equally space time points

logtime = (N, lambda): (integer, float), optional

Draw N arrows using exponential time constant lambda

timepts = [t1, t2, ...]: array-like, optional

Draw arrows at the given list times

parms: tuple, optional

List of parameters to pass to vector field: func(x, t, *parms)

See also

box_grid, Y