version 2.0.0.1 (146 KB) by
Ivo Houtzager

Discrete-time periodic Riccati equation solver for periodic LQ state-feedback design

These functions solve the Discrete-time Periodic Riccati Equation (DPRE) for periodic LQ state-feedback design. The functions compute the unique stabilizing solution X{k} of the discrete-time periodic Riccati equation and also returns the gain matrix K{k} in the state-feedback u{k} = -K{k}x{k}, where k = 1:P.

The m-file "dpre" solves the discrete-time periodic optimal control problem by a cyclic QZ or a Newton backward iteration method. These are not the fastest methods available, but work quite well.

The mex-file "dprex" solves the discrete-time periodic optimal control problem by a periodic QR (using functions from matlab's internal slicot library) or a complex periodic QC method (using converted fortran to c code from the pqzschur library). The mex-file implementation is much faster, but requires compilation of the mex file which can be done by running make_dprex.m.

Ivo Houtzager (2021). Discrete-time Periodic Riccati Equation (DPRE) (https://github.com/iwoodsawyer/dpre/releases/tag/v2.0.0.1), GitHub. Retrieved .

Created with
R2020b

Compatible with any release

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!Create scripts with code, output, and formatted text in a single executable document.

SALIC TomThank you very much after some corrections I got the right results. I think I was wrong about the size of the matrix L.

Ivo HoutzagerI don't fully understand your response about an L matrix of the size (11,11,36), probably you mean L matrix (4,11,36) for periodic state observer design. From your matrix sizes, I think you have periodic discrete state-space model of 4 states, 3 inputs, 11 outputs and period of 36. I tested the function with random generated discrete state-space models of this size and it runs without any problems for both periodic state feedback design (resulting in K matrix (3,4,36)) and periodic state observer design (resulting in L matrix (4,11,36)), see code below.

sys = drss(4,11,3,36);

for i=1:36

A(:,:,i) = sys.a(:,:,i);

B(:,:,i) = sys.b(:,:,i);

Q(:,:,i) = sys.c(:,:,i)'*sys.c(:,:,i);

end

[X,K] = dpre(A,B,Q); % periodic state feedback

for i=1:36

At(:,:,i) = sys.a(:,:,i)';

Bt(:,:,i) = sys.c(:,:,i)';

R(:,:,i) = sys.b(:,:,i)*sys.b(:,:,i)';

end

[X,Lt] = dpre(At,Bt,R); % periodic state observer

for i=1:36

L(:,:,i) = Lt(:,:,i)';

end

SALIC TomI checked precisely the matrices of these lines. Normally I should get an L matrix (11,11,36). My matrix Q is (4,4,36). I use the default values for the matrices E and S being E = I and S = 0.

Ivo HoutzagerWhat are the size of your Q, E and S matrices? Based on the error description it seems related to these matrices and not A and B.

SALIC TomDear Dr Houtzager,

Your code helps me a lot in my research. Thanks for sharing this algorithm. However I have an error in when I read your function with my data. The error is as follows for the matrix L: "Dimensions of matrices being concatenated are not consistent. -Q (:,:, i) E (:,:, i) -S (:,:, i);"

I checked long and wide for the concatenation of the matrix. The sizes of the matrix are as follows :

A (4,4,36)

B (4,3,36)

Have you already encountered this kind of problem?

Thank you in advance for your answer.