diff --git a/control/stochsys.py b/control/stochsys.py index 003958f57..5ab3c464d 100644 --- a/control/stochsys.py +++ b/control/stochsys.py @@ -65,16 +65,17 @@ def lqe(*args, symmetric_kwargs=None, **kwargs): * ``L, P, E = lqe(A, G, C, QN, RN)`` * ``L, P, E = lqe(A, G, C, QN, RN, NN)`` - where `sys` is an `LTI` object, and `A`, `G`, `C`, `QN`, `RN`, and `NN` - are 2D arrays or matrices of appropriate dimension. + where `sys` is a `StateSpace` object, and `A`, `G`, `C`, `QN`, `RN`, and + `NN` are 2D arrays or matrices of appropriate dimension. Parameters ---------- A, G, C : 2D array_like Dynamics, process noise (disturbance), and output matrices. - sys : `StateSpace` or `TransferFunction` + sys : `StateSpace` Linear I/O system, with the process noise input taken as the system - input. + input (`G = sys.B`). Thus `QN` must be square with dimension + `sys.ninputs`, not necessarily `sys.nstates`. QN, RN : 2D array_like Process and sensor noise covariance matrices. NN : 2D array, optional @@ -219,6 +220,10 @@ def dlqe(*args, symmetric_kwargs=None, **kwargs): Process and sensor noise covariance matrices. NN : 2D array, optional Cross covariance matrix (not yet supported). + sys : `StateSpace` + If a state-space system is passed instead of `A`, `G`, and `C`, + its input matrix `sys.B` is used as `G`. Consequently `QN` + must have shape (`sys.ninputs`, `sys.ninputs`). method : str, optional Set the method used for computing the result. Current methods are 'slycot' and 'scipy'. If set to None (default), try 'slycot' diff --git a/doc/stochastic.rst b/doc/stochastic.rst index 881cf234a..e7193382a 100644 --- a/doc/stochastic.rst +++ b/doc/stochastic.rst @@ -180,12 +180,23 @@ called in several forms: * ``L, P, E = lqe(A, G, C, QN, RN)`` * ``L, P, E = lqe(A, G, C, QN, RN, NN)`` -where :code:`sys` is an :class:`LTI` object, and `A`, `G`, `C`, `QN`, `RN`, -and `NN` are 2D arrays of appropriate dimension. If :code:`sys` is a -discrete-time system, the first two forms will compute the discrete -time optimal controller. For the second two forms, the :func:`dlqr` -function can be used. Additional arguments and details are given on -the :func:`lqr` and :func:`dlqr` documentation pages. +where :code:`sys` is a :class:`StateSpace` object, and `A`, `G`, `C`, +`QN`, `RN`, and `NN` are 2D arrays of appropriate dimension. + +For the state-space system form ``lqe(sys, QN, RN)``, the process noise +matrix :math:`G` is taken to be :code:`sys.B`. This models disturbances +entering through the system's input channels: ``QN`` must have shape +``(sys.ninputs, sys.ninputs)``, which may differ from the number of states. +The same convention applies to ``dlqe(sys, QN, RN)`` for discrete-time +systems. To model noise entering through a different matrix, specify +:math:`G` explicitly using the ``lqe(A, G, C, QN, RN)`` form (or ``dlqe``). +For example, use ``G = np.eye(sys.nstates)`` if independent disturbances +are modelled as entering every state derivative. + +If :code:`sys` is a discrete-time system, the first two forms call +:func:`dlqe` to compute the discrete-time estimator. For the matrix +forms, call :func:`dlqe` directly. Additional arguments and details +are given on the :func:`lqe` and :func:`dlqe` documentation pages. .. testsetup:: kalman