control.flatsys.SystemTrajectory
- class control.flatsys.SystemTrajectory(sys, basis, coeffs=[], flaglen=[], params=None)[source]
Bases:
object
Class representing a trajectory for a flat system.
The SystemTrajectory class is used to represent the trajectory of a (differentially flat) system. Used by the
point_to_point()
function to return a trajectory.- Parameters
sys (FlatSystem) – Flat system object associated with this trajectory.
basis (BasisFamily) – Family of basis vectors to use to represent the trajectory.
coeffs (list of 1D arrays, optional) – For each flat output, define the coefficients of the basis functions used to represent the trajectory. Defaults to an empty list.
flaglen (list of ints, optional) – For each flat output, the number of derivatives of the flat output used to define the trajectory. Defaults to an empty list.
Methods
Return the state and input for a trajectory at a list of times.
Return the trajectory of a system as a TimeResponseData object
- eval(tlist)[source]
Return the state and input for a trajectory at a list of times.
Evaluate the trajectory at a list of time points, returning the state and input vectors for the trajectory:
x, u = traj.eval(tlist)
- Parameters
tlist (1D array) – List of times to evaluate the trajectory.
- Returns
x (2D array) – For each state, the values of the state at the given times.
u (2D array) – For each input, the values of the input at the given times.
- response(tlist, transpose=False, return_x=False, squeeze=None)[source]
Return the trajectory of a system as a TimeResponseData object
Evaluate the trajectory at a list of time points, returning the state and input vectors for the trajectory:
response = traj.response(tlist) time, yd, ud = response.time, response.outputs, response.inputs
- Parameters
tlist (1D array) – List of times to evaluate the trajectory.
transpose (bool, optional) – If True, transpose all input and output arrays (for backward compatibility with MATLAB and
scipy.signal.lsim()
). Default value is False.return_x (bool, optional) – If True, return the state vector when assigning to a tuple (default = False). See
forced_response()
for more details.squeeze (bool, optional) – By default, if a system is single-input, single-output (SISO) then the output response is returned as a 1D array (indexed by time). If squeeze=True, remove single-dimensional entries from the shape of the output even if the system is not SISO. If squeeze=False, keep the output as a 3D array (indexed by the output, input, and time) even if the system is SISO. The default value can be set using config.defaults[‘control.squeeze_time_response’].
- Returns
results – Time response represented as a
TimeResponseData
object containing the following properties:time (array): Time values of the output.
outputs (array): Response of the system. If the system is SISO and squeeze is not True, the array is 1D (indexed by time). If the system is not SISO or
squeeze
is False, the array is 3D (indexed by the output, trace, and time).states (array): Time evolution of the state vector, represented as either a 2D array indexed by state and time (if SISO) or a 3D array indexed by state, trace, and time. Not affected by
squeeze
.inputs (array): Input(s) to the system, indexed in the same manner as
outputs
.
The return value of the system can also be accessed by assigning the function to a tuple of length 2 (time, output) or of length 3 (time, output, state) if
return_x
isTrue
.- Return type