X = Matrices.Utilities.discreteRiccatiIterative(A, B, R, Q, X0); (X, r) = Matrices.Utilities.discreteRiccatiIterative(A, B, R, Q, X0, maxSteps, eps);
This function provides a Newton-like method for solving
discrete-time algebraic Riccati equations. It uses Exact Line
Search to improve the sometimes erratic convergence of Newton's
method. Exact line search in this case means, that at each
iteration i
a Newton step
delta_i
X_i+1 = X_i + delta_i
is taken in the direction to minimize the Frobenius norm of the residual
r = || A'X_i+1*A - X_i+1 - A'X_i+1*G_i*X_i+1*A + Q ||
with
-1 G_i = B*(R + B'*X_i*B) *B'
Output r
is the norm of the residual of the last
iteration.
The inputs "maxSteps" and "eps" specify the termination of the iteration. The iteration is terminated if either maxSteps iteration steps have been performed or the relative change delta_i/X_i became smaller than eps.
With an appropriate initial value X0 a
sufficiently accurate solution might be reach with a few iteration
steps. Although a Lyapunov equation of order n
(n is
the order of the Riccati equation) is to be solved at each
iteration step, the algorithm might be faster than a direct method
like Matrices.discreteRiccati,
since direct methods have to solve the 2*n-order Hamiltonian system
equation. The algorithm is taken from [1] and [2].
[1] Benner, P., Byers, R. An Exact Line Search Method for Solving Generalized Continuous-Time Algebraic Riccati Equations IEEE Transactions On Automatic Control, Vol. 43, No. 1, pp. 101-107, 1998. [2] Datta, B.N. Numerical Methods for Linear Control Systems Elsevier Academic Press, 2004.
A = [0.9970, 0.0000, 0.0000, 0.0000; 1.0000, 0.0000, 0.0000, 0.0000; 0.0000, 1.0000, 0.0000, 0.0000; 0.0000, 0.0000, 1.0000, 0.0000]; B = [0.0150; 0.0000; 0.0000; 0.0000]; R = [0.2500]; Q = [0, 0, 0, 0; 0, 0, 0, 0; 0, 0, 0, 0; 0, 0, 0, 1]; X0=identity(4); (X,r) = Matrices.Utilities.discreteRiccatiIterative(A, B, R, Q, X0); // X = [30.625, 0.0, 0.0, 0.0; 0.0, 1.0, 0.0, 0.0; 0.0, 0.0, 1.0, 0.0; 0.0, 0.0, 0.0, 1.0]; // r = 3.10862446895044E-015
function discreteRiccatiIterative extends Modelica.Icons.Function; import Modelica.Math.Matrices; input Real A[:, size(A, 1)] "Matrix A of discrete Riccati equation"; input Real B[size(A, 1), :] "Matrix B of discrete Riccati equation"; input Real R[size(B, 2), size(B, 2)] = identity(size(B, 2)) "Matrix R of discrete Riccati equation"; input Real Q[size(A, 1), size(A, 2)] = identity(size(A, 1)) "Matrix Q of discrete Riccati equation"; input Real X0[size(A, 1), size(A, 2)] = identity(size(A, 1)) "Initial approximate solution discrete Riccati equation"; input Integer maxSteps = 10 "Maximal number of iteration steps"; input Real eps = Matrices.frobeniusNorm(A) * 1e-9 "Tolerance for stop criterion"; output Real X[size(X0, 1), size(X0, 2)]; output Real r; end discreteRiccatiIterative;