From d0bfec769cf66b9f0ec52858bf30308b6e72ec32 Mon Sep 17 00:00:00 2001 From: Rory Yorke Date: Sun, 15 Feb 2015 15:43:04 +0200 Subject: [PATCH 1/2] Documentation fix: document R is None behaviour For both standard and generalized case, the behaviour of care() w.r.t. R is the same. Without this change, it's not clear that the care(A,B,Q,R) is a valid call form. --- control/mateqn.py | 22 ++++++++++++---------- 1 file changed, 12 insertions(+), 10 deletions(-) diff --git a/control/mateqn.py b/control/mateqn.py index 8c616a8ec..3f6844a89 100644 --- a/control/mateqn.py +++ b/control/mateqn.py @@ -411,25 +411,27 @@ def dlyap(A,Q,C=None,E=None): #### Riccati equation solvers care and dare def care(A,B,Q,R=None,S=None,E=None): - """ (X,L,G) = care(A,B,Q) solves the continuous-time algebraic Riccati + """ (X,L,G) = care(A,B,Q,R=None) solves the continuous-time algebraic Riccati equation - A^T X + X A - X B B^T X + Q = 0 + A^T X + X A - X B R^-1 B^T X + Q = 0 - where A and Q are square matrices of the same dimension. Further, Q - is a symmetric matrix. The function returns the solution X, the gain - matrix G = B^T X and the closed loop eigenvalues L, i.e., the eigenvalues - of A - B G. + where A and Q are square matrices of the same dimension. Further, + Q and R are a symmetric matrices. If R is None, it is set to the + identity matrix. The function returns the solution X, the gain + matrix G = B^T X and the closed loop eigenvalues L, i.e., the + eigenvalues of A - B G. (X,L,G) = care(A,B,Q,R,S,E) solves the generalized continuous-time algebraic Riccati equation A^T X E + E^T X A - (E^T X B + S) R^-1 (B^T X E + S^T) + Q = 0 - where A, Q and E are square matrices of the same dimension. Further, Q and - R are symmetric matrices. The function returns the solution X, the gain - matrix G = R^-1 (B^T X E + S^T) and the closed loop eigenvalues L, i.e., - the eigenvalues of A - B G , E. """ + where A, Q and E are square matrices of the same + dimension. Further, Q and R are symmetric matrices. If R is None, + it is set to the identity matrix. The function returns the + solution X, the gain matrix G = R^-1 (B^T X E + S^T) and the + closed loop eigenvalues L, i.e., the eigenvalues of A - B G , E.""" # Make sure we can import required slycot routine try: From 065b2cf9cd55db2c7ed7a1c656c7ed20706fd695 Mon Sep 17 00:00:00 2001 From: Rory Yorke Date: Sun, 15 Feb 2015 15:43:47 +0200 Subject: [PATCH 2/2] Exception description fix: continuous-time, not discrete-time. --- control/mateqn.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/control/mateqn.py b/control/mateqn.py index 3f6844a89..839eb8686 100644 --- a/control/mateqn.py +++ b/control/mateqn.py @@ -533,7 +533,7 @@ def care(A,B,Q,R=None,S=None,E=None): e.info = ve.info elif ve.info == 1: e = ValueError("The matrix A is (numerically) singular in \ - discrete-time case.") + continuous-time case.") e.info = ve.info elif ve.info == 2: e = ValueError("The Hamiltonian or symplectic matrix H cannot \