6
6
Library conventions
7
7
*******************
8
8
9
- The python-control library uses a set of standard conventions for the way
10
- that different types of standard information used by the library.
9
+ The python-control library uses a set of standard conventions for the
10
+ way that different types of standard information used by the library.
11
+ Throughout this manual, we assume the `control ` package has been
12
+ imported as `ct `.
13
+
11
14
12
15
LTI system representation
13
16
=========================
@@ -29,7 +32,7 @@ of linear time-invariant (LTI) systems:
29
32
30
33
where u is the input, y is the output, and x is the state.
31
34
32
- To create a state space system, use the :func: `ss ` function:
35
+ To create a state space system, use the :func: `ss ` function::
33
36
34
37
sys = ct.ss(A, B, C, D)
35
38
@@ -51,7 +54,7 @@ transfer functions
51
54
where n is generally greater than or equal to m (for a proper transfer
52
55
function).
53
56
54
- To create a transfer function, use the :func: `tf ` function:
57
+ To create a transfer function, use the :func: `tf ` function::
55
58
56
59
sys = ct.tf(num, den)
57
60
@@ -77,7 +80,7 @@ performed.
77
80
The FRD class is also used as the return type for the
78
81
:func: `frequency_response ` function (and the equivalent method for the
79
82
:class: `StateSpace ` and :class: `TransferFunction ` classes). This
80
- object can be assigned to a tuple using
83
+ object can be assigned to a tuple using::
81
84
82
85
mag, phase, omega = response
83
86
@@ -91,7 +94,7 @@ is not SISO or `squeeze` is False, the array is 3D, indexed by the
91
94
output, input, and frequency. If `squeeze ` is True then
92
95
single-dimensional axes are removed. The processing of the `squeeze `
93
96
keyword can be changed by calling the response function with a new
94
- argument:
97
+ argument::
95
98
96
99
mag, phase, omega = response(squeeze=False)
97
100
@@ -101,10 +104,10 @@ Discrete time systems
101
104
A discrete time system is created by specifying a nonzero 'timebase', dt.
102
105
The timebase argument can be given when a system is constructed:
103
106
104
- * dt = 0: continuous time system (default)
105
- * dt > 0: discrete time system with sampling period 'dt'
106
- * dt = True: discrete time with unspecified sampling period
107
- * dt = None: no timebase specified
107
+ * ` dt = 0 ` : continuous time system (default)
108
+ * ` dt > 0 ` : discrete time system with sampling period 'dt'
109
+ * ` dt = True ` : discrete time with unspecified sampling period
110
+ * ` dt = None ` : no timebase specified
108
111
109
112
Only the :class: `StateSpace `, :class: `TransferFunction `, and
110
113
:class: `InputOutputSystem ` classes allow explicit representation of
@@ -119,8 +122,8 @@ result will have the timebase of the latter system. For continuous time
119
122
systems, the :func: `sample_system ` function or the :meth: `StateSpace.sample `
120
123
and :meth: `TransferFunction.sample ` methods can be used to create a discrete
121
124
time system from a continuous time system. See
122
- :ref: `utility-and-conversions `. The default value of 'dt' can be changed by
123
- changing the value of `` control.config.defaults['control.default_dt'] ` `.
125
+ :ref: `utility-and-conversions `. The default value of ` dt ` can be changed by
126
+ changing the value of `control.config.defaults['control.default_dt'] `.
124
127
125
128
Conversion between representations
126
129
----------------------------------
@@ -165,10 +168,9 @@ points in time, rows are different components::
165
168
...
166
169
[ui(t1), ui(t2), ui(t3), ..., ui(tn)]]
167
170
168
- Same for X, Y
169
-
170
- So, U[:,2] is the system's input at the third point in time; and U[1] or U[1,:]
171
- is the sequence of values for the system's second input.
171
+ (and similarly for `X `, `Y `). So, `U[:, 2] ` is the system's input at the
172
+ third point in time; and `U[1] ` or `U[1, :] ` is the sequence of values for
173
+ the system's second input.
172
174
173
175
When there is only one row, a 1D object is accepted or returned, which adds
174
176
convenience for SISO systems:
@@ -185,8 +187,10 @@ Functions that return time responses (e.g., :func:`forced_response`,
185
187
:func: `impulse_response `, :func: `input_output_response `,
186
188
:func: `initial_response `, and :func: `step_response `) return a
187
189
:class: `TimeResponseData ` object that contains the data for the time
188
- response. These data can be accessed via the ``time ``, ``outputs ``,
189
- ``states `` and ``inputs `` properties::
190
+ response. These data can be accessed via the
191
+ :attr: `~TimeResponseData.time `, :attr: `~TimeResponseData.outputs `,
192
+ :attr: `~TimeResponseData.states ` and :attr: `~TimeResponseData.inputs `
193
+ properties::
190
194
191
195
sys = ct.rss(4, 1, 1)
192
196
response = ct.step_response(sys)
@@ -213,13 +217,13 @@ The output of a MIMO LTI system can be plotted like this::
213
217
plot(t, y[1], label='y_1')
214
218
215
219
The convention also works well with the state space form of linear
216
- systems. If `` D ` ` is the feedthrough matrix (2D array) of a linear system,
217
- and `` U ` ` is its input (array), then the feedthrough part of the system's
220
+ systems. If `D ` is the feedthrough matrix (2D array) of a linear system,
221
+ and `U ` is its input (array), then the feedthrough part of the system's
218
222
response, can be computed like this::
219
223
220
224
ft = D @ U
221
225
222
- Finally, the `to_pandas() ` function can be used to create a pandas dataframe:
226
+ Finally, the `to_pandas() ` function can be used to create a pandas dataframe::
223
227
224
228
df = response.to_pandas()
225
229
@@ -242,16 +246,12 @@ for various types of plots and establishing the underlying representation for
242
246
state space matrices.
243
247
244
248
To set the default value of a configuration variable, set the appropriate
245
- element of the `control.config.defaults ` dictionary:
246
-
247
- .. code-block :: python
249
+ element of the `control.config.defaults ` dictionary::
248
250
249
251
ct.config.defaults['module.parameter'] = value
250
252
251
253
The `~control.config.set_defaults ` function can also be used to set multiple
252
- configuration parameters at the same time:
253
-
254
- .. code-block :: python
254
+ configuration parameters at the same time::
255
255
256
256
ct.config.set_defaults('module', param1=val1, param2=val2, ...]
257
257
0 commit comments