How to manually find discrete-time LQR gains using Algebraic Riccati Equation / Hamiltonian?

103 Views Asked by At

For a continuous-time optimal feedback controller, I'm manually computing LQR gains using the Algebraic Riccati Equation, using the Hamiltonian method.

This seems to works fine, as I compare to gains that Matlab produces using lqr(sys, Q, R).

How would this Hamiltonian method be modified to find the discrete-time gains?

Here's what I use for the continuous-time computation, for a system with dynamic matrices A, B, and LQR's Q and R penalty matrices (from standard linear formulation x. = Ax + Bu):

1) H = [A, -B*inv(R)*B' ; -Q, -A']

where ' is the transpose.

2) Find eigenvalues of H with negative real parts -- stable eigs, say called lambda -- and use pole placement to find the gains:

K = acker(A, B, lambda)

These gains seem to match outputs from Matlab's lqr commands, for example lqr(sys, Q, R).

How do I modify this method to find gains for a discrete-time system? I tried a few modifications of the above, by using discrete-time matrices and only looking at eigs < 1 (unit circle), but the results that don't match Matlab's results.

Note 1: I did not modify Q, R when I tried the discrete-time version: i used the cont-time version, as that's what would be used in both continuous and discrete versions if using matlab's lqr() function.

Note 2: there are NO discrete eigs of the Hamiltonian that are strictly < 1, as for some reason they are marginally above 1, eg 1 + 1e-5. However the eigs of the discretized sys matrix A are indeed stable (<1). So, I believe I might not be building up the discrete H correctly.