我用来计算scipy.linalg.solve_discrete_lyapunov
矩阵P
M T PM - P = -Q其中M = A - BK且Q = I
(见下文,另见 李雅普诺夫方程)。然而,对于计算出的P ,我得到M T PM - P ≠ - Q。
这是代码:
import numpy as np
import scipy as sp
A = np.array([[-1.86194971, 3.49237959],[-2.34245904, 3.86194971]])
B = np.array([[ 3000., 2500.5], [ 2000.2, 3000.]])
K = np.array([[ 0.0001367, -0.00016844], [-0.00069637, 0.0009627]])
I = np.array([[1., 0.],[0., 1.]])
# Eigenvalues of A are (0.9, 1.1)
# Eigenvalues of A-BK are (0.29, 0.49) (i.e. A-BK is Schur)
P = sp.linalg.solve_discrete_lyapunov(A-np.dot(B,K), I)
# P= [[ 6.61311138 4.32497891]
# [ 4.32497891 4.36910499]]
# But after checking (A-BK)^TP(A-BK)-P, that is
J = np.dot((A.transpose()-np.dot(K.transpose(),B.transpose())),np.dot(P,A-np.dot(B,K)))-P
# I get the following
# J = (A-BK)^TP(A-BK)-P = [[ -1.11929701 -19.5567893 ]
# [-19.5567893 37.89911723]]
#
# Not equal to -I?