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)[source]¶
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 (3-element sequences, optional, as [start, stop, npts]) – Two 3-element sequences specifying x and y coordinates of a grid. These arguments are passed to linspace and meshgrid to generate the points at which the vector field is plotted. If absent (or None), the vector field is not plotted.
Y (3-element sequences, optional, as [start, stop, npts]) – Two 3-element sequences specifying x and y coordinates of a grid. These arguments are passed to linspace and meshgrid to generate the 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 (integer or 2-tuple of integers, optional) – Argument is either N or (N, M). 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 (integer or tuple (integer, float), optional) – If a single integer N is given, draw N arrows using equally space time points. If a tuple (N, lambda) is given, draw N arrows using exponential time constant lambda
timepts (array-like, optional) – Draw arrows at the given list times [t1, t2, …]
parms (tuple, optional) – List of parameters to pass to vector field: func(x, t, *parms)
See also
box_grid
construct box-shaped grid of initial conditions
Examples