From 11b97828943cb90349bf00774ccca017b48dfa35 Mon Sep 17 00:00:00 2001 From: huxiaoyi-ovo Date: Mon, 12 Oct 2026 20:02:02 +0800 Subject: [PATCH 1/5] docs(stochsys): state LQE noise-input dimensions explicitly --- control/stochsys.py | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/control/stochsys.py b/control/stochsys.py index 003958f57..5cd4447de 100644 --- a/control/stochsys.py +++ b/control/stochsys.py @@ -74,7 +74,8 @@ def lqe(*args, symmetric_kwargs=None, **kwargs): Dynamics, process noise (disturbance), and output matrices. sys : `StateSpace` or `TransferFunction` 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' From c369c46fb1099f51a02d002035a15a270e9fe340 Mon Sep 17 00:00:00 2001 From: huxiaoyi-ovo Date: Mon, 12 Oct 2026 20:02:15 +0800 Subject: [PATCH 2/5] docs(stochastic): explain G=B and QN input-channel covariance --- doc/stochastic.rst | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/doc/stochastic.rst b/doc/stochastic.rst index 881cf234a..ea26ba8b6 100644 --- a/doc/stochastic.rst +++ b/doc/stochastic.rst @@ -181,7 +181,17 @@ called in several forms: * ``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 +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 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 From 283f4425d0990e787e2cb4ce05ba458b86fae54b Mon Sep 17 00:00:00 2001 From: huxiaoyi-ovo Date: Mon, 12 Oct 2026 20:03:11 +0800 Subject: [PATCH 3/5] docs(stochastic): separate estimator guidance paragraphs --- doc/stochastic.rst | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/doc/stochastic.rst b/doc/stochastic.rst index ea26ba8b6..4f3529c19 100644 --- a/doc/stochastic.rst +++ b/doc/stochastic.rst @@ -191,7 +191,9 @@ 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 +are modelled as entering every state derivative. + +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 From e3636cff82a21d0340cb7d3e2148dfa6198508a3 Mon Sep 17 00:00:00 2001 From: huxiaoyi-ovo Date: Tue, 13 Oct 2026 10:57:54 +0800 Subject: [PATCH 4/5] docs(stochsys): specify supported state-space LQE input --- control/stochsys.py | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/control/stochsys.py b/control/stochsys.py index 5cd4447de..5ab3c464d 100644 --- a/control/stochsys.py +++ b/control/stochsys.py @@ -65,14 +65,14 @@ 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 (`G = sys.B`). Thus `QN` must be square with dimension `sys.ninputs`, not necessarily `sys.nstates`. From a91905ab623f0f10d0b7eeeaf41708b3b45cc584 Mon Sep 17 00:00:00 2001 From: huxiaoyi-ovo Date: Tue, 13 Oct 2026 10:58:03 +0800 Subject: [PATCH 5/5] docs(stochastic): correct discrete-time estimator references --- doc/stochastic.rst | 13 ++++++------- 1 file changed, 6 insertions(+), 7 deletions(-) diff --git a/doc/stochastic.rst b/doc/stochastic.rst index 4f3529c19..e7193382a 100644 --- a/doc/stochastic.rst +++ b/doc/stochastic.rst @@ -180,8 +180,8 @@ 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. +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 @@ -193,11 +193,10 @@ systems. To model noise entering through a different matrix, specify 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 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. +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