From 3a554b5070661d6b9b1554ee0b716afa30f9b390 Mon Sep 17 00:00:00 2001 From: Sawyer Fuller Date: Wed, 30 Nov 2022 12:09:42 -0800 Subject: [PATCH 1/6] docstring fixes: standardize description for lyap and care to be consistent with other functions, fix formatting in a few other functions. add references to NonlinearIOSystem and __call__ and remove evalfr --- control/dtime.py | 13 +++++-------- control/iosys.py | 19 ++++++++----------- control/mateqn.py | 17 ++++++++++++----- control/sisotool.py | 8 ++++---- control/statesp.py | 2 +- doc/control.rst | 11 ++++++----- 6 files changed, 36 insertions(+), 34 deletions(-) diff --git a/control/dtime.py b/control/dtime.py index 9dddd86a3..18584fc6d 100644 --- a/control/dtime.py +++ b/control/dtime.py @@ -84,14 +84,6 @@ def sample_system(sysc, Ts, method='zoh', alpha=None, prewarp_frequency=None, copy_names : bool, Optional If True, copy the names of the input signals, output signals, and states to the sampled system. - - Returns - ------- - sysd : linsys - Discrete time system, with sampling rate Ts - - Additional Parameters - --------------------- inputs : int, list of str or None, optional Description of the system inputs. If not specified, the origional system inputs are used. See :class:`NamedIOSystem` for more @@ -102,6 +94,11 @@ def sample_system(sysc, Ts, method='zoh', alpha=None, prewarp_frequency=None, Description of the system states. Same format as `inputs`. Only available if the system is :class:`StateSpace`. + Returns + ------- + sysd : linsys + Discrete time system, with sampling rate Ts + Notes ----- See :meth:`StateSpace.sample` or :meth:`TransferFunction.sample` for diff --git a/control/iosys.py b/control/iosys.py index cbbd4cecc..132c074d3 100644 --- a/control/iosys.py +++ b/control/iosys.py @@ -2203,15 +2203,6 @@ def linearize(sys, xeq, ueq=None, t=0, params=None, **kw): copy_names : bool, Optional If True, Copy the names of the input signals, output signals, and states to the linearized system. - - Returns - ------- - ss_sys : LinearIOSystem - The linearization of the system, as a :class:`~control.LinearIOSystem` - object (which is also a :class:`~control.StateSpace` object. - - Additional Parameters - --------------------- inputs : int, list of str or None, optional Description of the system inputs. If not specified, the origional system inputs are used. See :class:`NamedIOSystem` for more @@ -2221,6 +2212,12 @@ def linearize(sys, xeq, ueq=None, t=0, params=None, **kw): states : int, list of str, or None, optional Description of the system states. Same format as `inputs`. + Returns + ------- + ss_sys : LinearIOSystem + The linearization of the system, as a :class:`~control.LinearIOSystem` + object (which is also a :class:`~control.StateSpace` object. + """ if not isinstance(sys, InputOutputSystem): raise TypeError("Can only linearize InputOutputSystem types") @@ -2716,8 +2713,8 @@ def interconnect(syslist, connections=None, inplist=None, outlist=None, :func:`~control.summing_block` function and the ability to automatically interconnect signals with the same names: - >>> P = control.tf2io(control.tf(1, [1, 0]), inputs='u', outputs='y') - >>> C = control.tf2io(control.tf(10, [1, 1]), inputs='e', outputs='u') + >>> P = control.tf(1, [1, 0], inputs='u', outputs='y') + >>> C = control.tf(10, [1, 1], inputs='e', outputs='u') >>> sumblk = control.summing_junction(inputs=['r', '-y'], output='e') >>> T = control.interconnect([P, C, sumblk], inputs='r', outputs='y') diff --git a/control/mateqn.py b/control/mateqn.py index 23ae1e64e..1cf2e65d9 100644 --- a/control/mateqn.py +++ b/control/mateqn.py @@ -88,7 +88,9 @@ def sb03md(n, C, A, U, dico, job='X', fact='N', trana='N', ldwork=None): def lyap(A, Q, C=None, E=None, method=None): - """X = lyap(A, Q) solves the continuous-time Lyapunov equation + """Solves the continuous-time Lyapunov equation + + X = lyap(A, Q) solves :math:`A X + X A^T + Q = 0` @@ -217,7 +219,9 @@ def lyap(A, Q, C=None, E=None, method=None): def dlyap(A, Q, C=None, E=None, method=None): - """dlyap(A, Q) solves the discrete-time Lyapunov equation + """Solves the discrete-time Lyapunov equation + + X = dlyap(A, Q) solves :math:`A X A^T - X + Q = 0` @@ -348,8 +352,9 @@ def dlyap(A, Q, C=None, E=None, method=None): def care(A, B, Q, R=None, S=None, E=None, stabilizing=True, method=None, A_s="A", B_s="B", Q_s="Q", R_s="R", S_s="S", E_s="E"): - """X, L, G = care(A, B, Q, R=None) solves the continuous-time - algebraic Riccati equation + """Solves the continuous-time algebraic Riccati equation + + X, L, G = care(A, B, Q, R=None) solves :math:`A^T X + X A - X B R^{-1} B^T X + Q = 0` @@ -505,9 +510,11 @@ def care(A, B, Q, R=None, S=None, E=None, stabilizing=True, method=None, def dare(A, B, Q, R, S=None, E=None, stabilizing=True, method=None, A_s="A", B_s="B", Q_s="Q", R_s="R", S_s="S", E_s="E"): - """X, L, G = dare(A, B, Q, R) solves the discrete-time algebraic Riccati + """Solves the discrete-time algebraic Riccati equation + X, L, G = dare(A, B, Q, R) solves + :math:`A^T X A - X - A^T X B (B^T X B + R)^{-1} B^T X A + Q = 0` where A and Q are square matrices of the same dimension. Further, Q diff --git a/control/sisotool.py b/control/sisotool.py index 781fabf40..598bdcf09 100644 --- a/control/sisotool.py +++ b/control/sisotool.py @@ -209,10 +209,6 @@ def rootlocus_pid_designer(plant, gain='P', sign=+1, input_signal='r', C_f = Kp + Ki/s + Kd*s/(tau*s + 1). - If `plant` is a discrete-time system, then the proportional, integral, and - derivative terms are given instead by Kp, Ki*dt/2*(z+1)/(z-1), and - Kd/dt*(z-1)/z, respectively. - :: ------> C_ff ------ d @@ -224,6 +220,10 @@ def rootlocus_pid_designer(plant, gain='P', sign=+1, input_signal='r', | ----- C_b <-------| --------------------------------- + If `plant` is a discrete-time system, then the proportional, integral, and + derivative terms are given instead by Kp, Ki*dt/2*(z+1)/(z-1), and + Kd/dt*(z-1)/z, respectively. + It is also possible to move the derivative term into the feedback path `C_b` using `derivative_in_feedback_path=True`. This may be desired to avoid that the plant is subject to an impulse function when the reference diff --git a/control/statesp.py b/control/statesp.py index 7843cb33f..47885ae3d 100644 --- a/control/statesp.py +++ b/control/statesp.py @@ -807,7 +807,7 @@ def __rdiv__(self, other): "StateSpace.__rdiv__ is not implemented yet.") def __call__(self, x, squeeze=None, warn_infinite=True): - """Evaluate system's transfer function at complex frequency. + """Evaluate system's frequency response at complex frequencies. Returns the complex frequency response `sys(x)` where `x` is `s` for continuous-time systems and `z` for discrete-time systems. diff --git a/doc/control.rst b/doc/control.rst index 172790f83..14d47af58 100644 --- a/doc/control.rst +++ b/doc/control.rst @@ -20,6 +20,8 @@ System creation frd rss drss + NonlinearIOSystem + System interconnections ======================= @@ -32,9 +34,8 @@ System interconnections negate parallel series + interconnect -See also the :ref:`iosys-module` module, which can be used to create and -interconnect nonlinear input/output systems. Frequency domain plotting ========================= @@ -78,8 +79,9 @@ Control system analysis dcgain describing_function - evalfr - freqresp + frequency_response + TransferFunction.__call__ + StateSpace.__call__ get_input_ff_index get_output_fb_index ispassive @@ -141,7 +143,6 @@ Nonlinear system support describing_function find_eqpt - interconnect linearize input_output_response ss2io From 11d935048c71560dc91a0b4eac33aca7e175b203 Mon Sep 17 00:00:00 2001 From: Sawyer Fuller Date: Wed, 30 Nov 2022 15:01:32 -0800 Subject: [PATCH 2/6] a few more fixes to sys.sample --- control/dtime.py | 2 +- control/iosys.py | 2 +- control/statesp.py | 14 ++++++-------- control/xferfcn.py | 15 ++++++--------- 4 files changed, 14 insertions(+), 19 deletions(-) diff --git a/control/dtime.py b/control/dtime.py index 18584fc6d..e242923fb 100644 --- a/control/dtime.py +++ b/control/dtime.py @@ -86,7 +86,7 @@ def sample_system(sysc, Ts, method='zoh', alpha=None, prewarp_frequency=None, signals, and states to the sampled system. inputs : int, list of str or None, optional Description of the system inputs. If not specified, the origional - system inputs are used. See :class:`NamedIOSystem` for more + system inputs are used. See :class:`InputOutputSystem` for more information. outputs : int, list of str or None, optional Description of the system outputs. Same format as `inputs`. diff --git a/control/iosys.py b/control/iosys.py index 132c074d3..4f9c674c0 100644 --- a/control/iosys.py +++ b/control/iosys.py @@ -2205,7 +2205,7 @@ def linearize(sys, xeq, ueq=None, t=0, params=None, **kw): states to the linearized system. inputs : int, list of str or None, optional Description of the system inputs. If not specified, the origional - system inputs are used. See :class:`NamedIOSystem` for more + system inputs are used. See :class:`InputOutputSystem` for more information. outputs : int, list of str or None, optional Description of the system outputs. Same format as `inputs`. diff --git a/control/statesp.py b/control/statesp.py index 47885ae3d..80b4601f2 100644 --- a/control/statesp.py +++ b/control/statesp.py @@ -1338,14 +1338,6 @@ def sample(self, Ts, method='zoh', alpha=None, prewarp_frequency=None, copy_names : bool, Optional If True, copy the names of the input signals, output signals, and states to the sampled system. - - Returns - ------- - sysd : StateSpace - Discrete-time system, with sampling rate Ts - - Additional Parameters - --------------------- inputs : int, list of str or None, optional Description of the system inputs. If not specified, the origional system inputs are used. See :class:`InputOutputSystem` for more @@ -1355,6 +1347,11 @@ def sample(self, Ts, method='zoh', alpha=None, prewarp_frequency=None, states : int, list of str, or None, optional Description of the system states. Same format as `inputs`. + Returns + ------- + sysd : StateSpace + Discrete-time system, with sampling rate Ts + Notes ----- Uses :func:`scipy.signal.cont2discrete` @@ -1520,6 +1517,7 @@ def output(self, t, x, u=None, params=None): # TODO: add discrete time check +# TODO: copy signal names def _convert_to_statespace(sys): """Convert a system to state space form (if needed). diff --git a/control/xferfcn.py b/control/xferfcn.py index 84188a63f..d7de8fedd 100644 --- a/control/xferfcn.py +++ b/control/xferfcn.py @@ -1130,21 +1130,18 @@ def sample(self, Ts, method='zoh', alpha=None, prewarp_frequency=None, copy_names : bool, Optional If True, copy the names of the input signals, output signals, and states to the sampled system. - - Returns - ------- - sysd : TransferFunction system - Discrete-time system, with sample period Ts - - Additional Parameters - --------------------- inputs : int, list of str or None, optional Description of the system inputs. If not specified, the origional - system inputs are used. See :class:`NamedIOSystem` for more + system inputs are used. See :class:`InputOutputSystem` for more information. outputs : int, list of str or None, optional Description of the system outputs. Same format as `inputs`. + Returns + ------- + sysd : TransferFunction system + Discrete-time system, with sample period Ts + Notes ----- 1. Available only for SISO systems From bf50ded659ec285a69d95699aa9c4bfba482acc0 Mon Sep 17 00:00:00 2001 From: Sawyer Fuller Date: Fri, 2 Dec 2022 09:28:34 -0800 Subject: [PATCH 3/6] mention lqe and dlqe in matlab module, reorder so that eg lqr and dlqr appear sequentially --- doc/control.rst | 6 ++++-- doc/matlab.rst | 3 +++ 2 files changed, 7 insertions(+), 2 deletions(-) diff --git a/doc/control.rst b/doc/control.rst index 14d47af58..5ac5102f7 100644 --- a/doc/control.rst +++ b/doc/control.rst @@ -116,10 +116,10 @@ Control system synthesis acker create_statefbk_iosystem - dlqr h2syn hinfsyn lqr + dlqr mixsyn place rootlocus_pid_designer @@ -157,8 +157,8 @@ Stochastic system support correlation create_estimator_iosystem - dlqe lqe + dlqe white_noise .. _utility-and-conversions: @@ -194,3 +194,5 @@ Utility functions and conversions use_fbs_defaults use_matlab_defaults use_numpy_matrix + + diff --git a/doc/matlab.rst b/doc/matlab.rst index c14a67e1f..eac1d157a 100644 --- a/doc/matlab.rst +++ b/doc/matlab.rst @@ -86,6 +86,9 @@ Compensator design sisotool place lqr + dlqr + lqe + dlqe State-space (SS) models ======================= From 2311a4d62280675d88291566d3b164f124d2b595 Mon Sep 17 00:00:00 2001 From: Sawyer Fuller Date: Mon, 12 Dec 2022 11:49:06 -0800 Subject: [PATCH 4/6] bring back 'Other parameters' in docstrings, alphabetize TOC --- control/dtime.py | 13 ++++++++----- control/iosys.py | 16 +++++++++------- control/statesp.py | 13 ++++++++----- control/xferfcn.py | 15 +++++++++------ doc/control.rst | 14 +++++++------- 5 files changed, 41 insertions(+), 30 deletions(-) diff --git a/control/dtime.py b/control/dtime.py index e242923fb..724eafb76 100644 --- a/control/dtime.py +++ b/control/dtime.py @@ -84,6 +84,14 @@ def sample_system(sysc, Ts, method='zoh', alpha=None, prewarp_frequency=None, copy_names : bool, Optional If True, copy the names of the input signals, output signals, and states to the sampled system. + + Returns + ------- + sysd : linsys + Discrete time system, with sampling rate Ts + + Other Parameters + ---------------- inputs : int, list of str or None, optional Description of the system inputs. If not specified, the origional system inputs are used. See :class:`InputOutputSystem` for more @@ -94,11 +102,6 @@ def sample_system(sysc, Ts, method='zoh', alpha=None, prewarp_frequency=None, Description of the system states. Same format as `inputs`. Only available if the system is :class:`StateSpace`. - Returns - ------- - sysd : linsys - Discrete time system, with sampling rate Ts - Notes ----- See :meth:`StateSpace.sample` or :meth:`TransferFunction.sample` for diff --git a/control/iosys.py b/control/iosys.py index 4f9c674c0..665c60e4d 100644 --- a/control/iosys.py +++ b/control/iosys.py @@ -2203,6 +2203,15 @@ def linearize(sys, xeq, ueq=None, t=0, params=None, **kw): copy_names : bool, Optional If True, Copy the names of the input signals, output signals, and states to the linearized system. + + Returns + ------- + ss_sys : LinearIOSystem + The linearization of the system, as a :class:`~control.LinearIOSystem` + object (which is also a :class:`~control.StateSpace` object. + + Other Parameters + ---------------- inputs : int, list of str or None, optional Description of the system inputs. If not specified, the origional system inputs are used. See :class:`InputOutputSystem` for more @@ -2211,13 +2220,6 @@ def linearize(sys, xeq, ueq=None, t=0, params=None, **kw): Description of the system outputs. Same format as `inputs`. states : int, list of str, or None, optional Description of the system states. Same format as `inputs`. - - Returns - ------- - ss_sys : LinearIOSystem - The linearization of the system, as a :class:`~control.LinearIOSystem` - object (which is also a :class:`~control.StateSpace` object. - """ if not isinstance(sys, InputOutputSystem): raise TypeError("Can only linearize InputOutputSystem types") diff --git a/control/statesp.py b/control/statesp.py index 80b4601f2..0303ff70a 100644 --- a/control/statesp.py +++ b/control/statesp.py @@ -1338,6 +1338,14 @@ def sample(self, Ts, method='zoh', alpha=None, prewarp_frequency=None, copy_names : bool, Optional If True, copy the names of the input signals, output signals, and states to the sampled system. + + Returns + ------- + sysd : StateSpace + Discrete-time system, with sampling rate Ts + + Other Parameters + ---------------- inputs : int, list of str or None, optional Description of the system inputs. If not specified, the origional system inputs are used. See :class:`InputOutputSystem` for more @@ -1347,11 +1355,6 @@ def sample(self, Ts, method='zoh', alpha=None, prewarp_frequency=None, states : int, list of str, or None, optional Description of the system states. Same format as `inputs`. - Returns - ------- - sysd : StateSpace - Discrete-time system, with sampling rate Ts - Notes ----- Uses :func:`scipy.signal.cont2discrete` diff --git a/control/xferfcn.py b/control/xferfcn.py index d7de8fedd..490132952 100644 --- a/control/xferfcn.py +++ b/control/xferfcn.py @@ -1130,6 +1130,14 @@ def sample(self, Ts, method='zoh', alpha=None, prewarp_frequency=None, copy_names : bool, Optional If True, copy the names of the input signals, output signals, and states to the sampled system. + + Returns + ------- + sysd : TransferFunction system + Discrete-time system, with sample period Ts + + Other Parameters + ---------------- inputs : int, list of str or None, optional Description of the system inputs. If not specified, the origional system inputs are used. See :class:`InputOutputSystem` for more @@ -1137,11 +1145,6 @@ def sample(self, Ts, method='zoh', alpha=None, prewarp_frequency=None, outputs : int, list of str or None, optional Description of the system outputs. Same format as `inputs`. - Returns - ------- - sysd : TransferFunction system - Discrete-time system, with sample period Ts - Notes ----- 1. Available only for SISO systems @@ -1582,7 +1585,7 @@ def tf(*args, **kwargs): else: raise ValueError("Needs 1 or 2 arguments; received %i." % len(args)) - +# TODO: copy signal names def ss2tf(*args, **kwargs): """ss2tf(sys) diff --git a/doc/control.rst b/doc/control.rst index 5ac5102f7..54e233746 100644 --- a/doc/control.rst +++ b/doc/control.rst @@ -31,10 +31,10 @@ System interconnections append connect feedback + interconnect negate parallel series - interconnect Frequency domain plotting @@ -80,8 +80,6 @@ Control system analysis dcgain describing_function frequency_response - TransferFunction.__call__ - StateSpace.__call__ get_input_ff_index get_output_fb_index ispassive @@ -93,6 +91,8 @@ Control system analysis pzmap root_locus sisotool + StateSpace.__call__ + TransferFunction.__call__ @@ -102,10 +102,10 @@ Matrix computations :toctree: generated/ care + ctrb dare - lyap dlyap - ctrb + lyap obsv gram @@ -116,10 +116,10 @@ Control system synthesis acker create_statefbk_iosystem + dlqr h2syn hinfsyn lqr - dlqr mixsyn place rootlocus_pid_designer @@ -157,8 +157,8 @@ Stochastic system support correlation create_estimator_iosystem - lqe dlqe + lqe white_noise .. _utility-and-conversions: From 7acd3fc650a3d3074c17dcdea7ee768a31fbf290 Mon Sep 17 00:00:00 2001 From: Sawyer Fuller Date: Mon, 12 Dec 2022 12:11:19 -0800 Subject: [PATCH 5/6] added signature for drss, import missing stochsys for matlab module, docstring typos --- control/iosys.py | 7 +++++-- control/matlab/__init__.py | 1 + control/matlab/timeresp.py | 38 +++++--------------------------------- control/matlab/wrappers.py | 3 +-- 4 files changed, 12 insertions(+), 37 deletions(-) diff --git a/control/iosys.py b/control/iosys.py index 665c60e4d..e3af5d9f7 100644 --- a/control/iosys.py +++ b/control/iosys.py @@ -2428,7 +2428,10 @@ def rss(states=1, outputs=1, inputs=1, strictly_proper=False, **kwargs): def drss(*args, **kwargs): - """Create a stable, discrete-time, random state space system + """ + drss([states, outputs, inputs, strictly_proper]) + + Create a stable, discrete-time, random state space system Create a stable *discrete time* random state space object. This function calls :func:`rss` using either the `dt` keyword provided by @@ -2466,7 +2469,7 @@ def ss2io(*args, **kwargs): # Convert a transfer function into an input/output system (wrapper) def tf2io(*args, **kwargs): - """tf2io(sys) + """tf2io(sys[, ...]) Convert a transfer function into an I/O system diff --git a/control/matlab/__init__.py b/control/matlab/__init__.py index 80f2a0a65..4dd34c41b 100644 --- a/control/matlab/__init__.py +++ b/control/matlab/__init__.py @@ -84,6 +84,7 @@ from ..rlocus import rlocus from ..dtime import c2d from ..sisotool import sisotool +from ..stochsys import * # Functions that are renamed in MATLAB pole, zero = poles, zeros diff --git a/control/matlab/timeresp.py b/control/matlab/timeresp.py index b1fa24bb0..58b5e589d 100644 --- a/control/matlab/timeresp.py +++ b/control/matlab/timeresp.py @@ -7,8 +7,7 @@ __all__ = ['step', 'stepinfo', 'impulse', 'initial', 'lsim'] def step(sys, T=None, X0=0., input=0, output=None, return_x=False): - ''' - Step response of a linear system + '''Step response of a linear system If the system has multiple inputs or outputs (MIMO), one input has to be selected for the simulation. Optionally, one output may be @@ -20,19 +19,14 @@ def step(sys, T=None, X0=0., input=0, output=None, return_x=False): ---------- sys: StateSpace, or TransferFunction LTI system to simulate - T: array-like or number, optional Time vector, or simulation time duration if a number (time vector is autocomputed if not given) - X0: array-like or number, optional Initial condition (default = 0) - Numbers are converted to constant arrays with the correct shape. - input: int Index of the input that will be used in this simulation. - output: int If given, index of the output that is returned by this simulation. @@ -40,15 +34,12 @@ def step(sys, T=None, X0=0., input=0, output=None, return_x=False): ------- yout: array Response of the system - T: array Time values of the output - xout: array (if selected) Individual response of each x variable - See Also -------- lsim, initial, impulse @@ -67,8 +58,7 @@ def step(sys, T=None, X0=0., input=0, output=None, return_x=False): def stepinfo(sysdata, T=None, yfinal=None, SettlingTimeThreshold=0.02, RiseTimeLimits=(0.1, 0.9)): - """ - Step response characteristics (Rise time, Settling Time, Peak and others). + """Step response characteristics (Rise time, Settling Time, Peak and others) Parameters ---------- @@ -137,8 +127,7 @@ def stepinfo(sysdata, T=None, yfinal=None, SettlingTimeThreshold=0.02, return S def impulse(sys, T=None, X0=0., input=0, output=None, return_x=False): - ''' - Impulse response of a linear system + '''Impulse response of a linear system If the system has multiple inputs or outputs (MIMO), one input has to be selected for the simulation. Optionally, one output may be @@ -150,19 +139,15 @@ def impulse(sys, T=None, X0=0., input=0, output=None, return_x=False): ---------- sys: StateSpace, TransferFunction LTI system to simulate - T: array-like or number, optional Time vector, or simulation time duration if a number (time vector is autocomputed if not given) - X0: array-like or number, optional Initial condition (default = 0) Numbers are converted to constant arrays with the correct shape. - input: int Index of the input that will be used in this simulation. - output: int Index of the output that will be used in this simulation. @@ -170,10 +155,8 @@ def impulse(sys, T=None, X0=0., input=0, output=None, return_x=False): ------- yout: array Response of the system - T: array Time values of the output - xout: array (if selected) Individual response of each x variable @@ -193,8 +176,7 @@ def impulse(sys, T=None, X0=0., input=0, output=None, return_x=False): return (out[1], out[0], out[2]) if return_x else (out[1], out[0]) def initial(sys, T=None, X0=0., input=None, output=None, return_x=False): - ''' - Initial condition response of a linear system + '''Initial condition response of a linear system If the system has multiple outputs (?IMO), optionally, one output may be selected. If no selection is made for the output, all @@ -204,20 +186,16 @@ def initial(sys, T=None, X0=0., input=None, output=None, return_x=False): ---------- sys: StateSpace, or TransferFunction LTI system to simulate - T: array-like or number, optional Time vector, or simulation time duration if a number (time vector is autocomputed if not given) - X0: array-like object or number, optional Initial condition (default = 0) Numbers are converted to constant arrays with the correct shape. - input: int This input is ignored, but present for compatibility with step and impulse. - output: int If given, index of the output that is returned by this simulation. @@ -225,10 +203,8 @@ def initial(sys, T=None, X0=0., input=None, output=None, return_x=False): ------- yout: array Response of the system - T: array Time values of the output - xout: array (if selected) Individual response of each x variable @@ -250,8 +226,7 @@ def initial(sys, T=None, X0=0., input=None, output=None, return_x=False): def lsim(sys, U=0., T=None, X0=0.): - ''' - Simulate the output of a linear system. + '''Simulate the output of a linear system As a convenience for parameters `U`, `X0`: Numbers (scalars) are converted to constant arrays with the correct shape. @@ -261,16 +236,13 @@ def lsim(sys, U=0., T=None, X0=0.): ---------- sys: LTI (StateSpace, or TransferFunction) LTI system to simulate - U: array-like or number, optional Input array giving input at each time `T` (default = 0). If `U` is ``None`` or ``0``, a special algorithm is used. This special algorithm is faster than the general algorithm, which is used otherwise. - T: array-like, optional for discrete LTI `sys` Time steps at which the input is defined; values must be evenly spaced. - X0: array-like or number, optional Initial condition (default = 0). diff --git a/control/matlab/wrappers.py b/control/matlab/wrappers.py index 8eafdaad2..6a6c4ad35 100644 --- a/control/matlab/wrappers.py +++ b/control/matlab/wrappers.py @@ -178,8 +178,7 @@ def ngrid(): def dcgain(*args): - ''' - Compute the gain of the system in steady state. + '''Compute the gain of the system in steady state The function takes either 1, 2, 3, or 4 parameters: From 16457d7a0d7aaaca6fbaf3d596ea599e76e336d4 Mon Sep 17 00:00:00 2001 From: Richard Murray Date: Fri, 16 Dec 2022 21:18:40 -0800 Subject: [PATCH 6/6] explicit import of stochsys in matlab, per @bnavigator --- control/matlab/__init__.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/control/matlab/__init__.py b/control/matlab/__init__.py index 4dd34c41b..fc0cd445b 100644 --- a/control/matlab/__init__.py +++ b/control/matlab/__init__.py @@ -84,7 +84,7 @@ from ..rlocus import rlocus from ..dtime import c2d from ..sisotool import sisotool -from ..stochsys import * +from ..stochsys import lqe, dlqe # Functions that are renamed in MATLAB pole, zero = poles, zeros