Skip to content

Commit 81d9c1e

Browse files
committed
updated documentation for phaseplot module
1 parent 1282ec0 commit 81d9c1e

1 file changed

Lines changed: 20 additions & 20 deletions

File tree

doc/phaseplot.rst

Lines changed: 20 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ functionality is supported by a set of mapping functions that are part of
1212
the `phaseplot` module.
1313

1414
The default method for generating a phase plane plot is to provide a
15-
2D dynamical system along with a range of coordinates and time limit:
15+
2D dynamical system along with a range of coordinates in phase space:
1616

1717
.. testsetup:: phaseplot
1818

@@ -27,8 +27,7 @@ The default method for generating a phase plane plot is to provide a
2727
sys_update, states=['position', 'velocity'],
2828
inputs=0, name='damped oscillator')
2929
axis_limits = [-1, 1, -1, 1]
30-
T = 8
31-
ct.phase_plane_plot(sys, axis_limits, T)
30+
ct.phase_plane_plot(sys, axis_limits)
3231

3332
.. testcode:: phaseplot
3433
:hide:
@@ -39,12 +38,12 @@ The default method for generating a phase plane plot is to provide a
3938
.. image:: figures/phaseplot-dampedosc-default.png
4039
:align: center
4140

42-
By default, the plot includes streamlines generated from starting
43-
points on limits of the plot, with arrows showing the flow of the
44-
system, as well as any equilibrium points for the system. A variety
41+
By default the plot includes streamlines infered from function values
42+
on a grid, equilibrium points and separatrices if they exist. A variety
4543
of options are available to modify the information that is plotted,
46-
including plotting a grid of vectors instead of streamlines and
47-
turning on and off various features of the plot.
44+
including plotting a grid of vectors instead of streamlines, plotting
45+
streamlines from arbitrary starting points and turning on and off
46+
various features of the plot.
4847

4948
To illustrate some of these possibilities, consider a phase plane plot for
5049
an inverted pendulum system, which is created using a mesh grid:
@@ -62,9 +61,7 @@ an inverted pendulum system, which is created using a mesh grid:
6261
invpend = ct.nlsys(invpend_update, states=2, inputs=1, name='invpend')
6362

6463
ct.phase_plane_plot(
65-
invpend, [-2 * np.pi, 2 * np.pi, -2, 2], 5,
66-
gridtype='meshgrid', gridspec=[5, 8], arrows=3,
67-
plot_equilpoints={'gridspec': [12, 9]},
64+
invpend, [-2 * np.pi, 2 * np.pi, -2, 2],
6865
params={'m': 1, 'l': 1, 'b': 0.2, 'g': 1})
6966
plt.xlabel(r"$\theta$ [rad]")
7067
plt.ylabel(r"$\dot\theta$ [rad/sec]")
@@ -79,16 +76,17 @@ an inverted pendulum system, which is created using a mesh grid:
7976

8077
This figure shows several features of more complex phase plane plots:
8178
multiple equilibrium points are shown, with saddle points showing
82-
separatrices, and streamlines generated along a 5x8 mesh of initial
83-
conditions. At each mesh point, a streamline is created that goes 5 time
84-
units forward and backward in time. A separate grid specification is used
85-
to find equilibrium points and separatrices (since the course grid spacing
86-
of 5x8 does not find all possible equilibrium points). Together, the
87-
multiple features in the phase plane plot give a good global picture of the
88-
topological structure of solutions of the dynamical system.
79+
separatrices, and streamlines generated generated from a rectangular 25x25
80+
grid (default) of function evaluations. Together, the multiple features in
81+
the phase plane plot give a good global picture of the topological structure
82+
of solutions of the dynamical system.
8983

9084
Phase plots can be built up by hand using a variety of helper functions that
91-
are part of the :mod:`phaseplot` (pp) module:
85+
are part of the :mod:`phaseplot` (pp) module. For more precise control, the
86+
streamlines can also generated by integrating the system forwads or backwards
87+
in time from a set of initial conditions. The initial conditions can be chosen
88+
on a rectangular grid, rectangual boundary, circle or from an arbitrary set of
89+
points.
9290

9391
.. testcode:: phaseplot
9492
:hide:
@@ -105,7 +103,8 @@ are part of the :mod:`phaseplot` (pp) module:
105103
oscillator = ct.nlsys(
106104
oscillator_update, states=2, inputs=0, name='nonlinear oscillator')
107105

108-
ct.phase_plane_plot(oscillator, [-1.5, 1.5, -1.5, 1.5], 0.9)
106+
ct.phase_plane_plot(oscillator, [-1.5, 1.5, -1.5, 1.5], 0.9,
107+
plot_streamlines=True)
109108
pp.streamlines(
110109
oscillator, np.array([[0, 0]]), 1.5,
111110
gridtype='circlegrid', gridspec=[0.5, 6], dir='both')
@@ -129,6 +128,7 @@ The following helper functions are available:
129128
phaseplot.separatrices
130129
phaseplot.streamlines
131130
phaseplot.vectorfield
131+
phaseplot.streamplot
132132

133133
The :func:`phase_plane_plot` function calls these helper functions
134134
based on the options it is passed.

0 commit comments

Comments
 (0)