File Exchange

## DPRE

version 1.0.0.0 (2.61 KB) by
Discrete-time periodic Riccati equation solver for periodic LQ state-feedback design

Updated 09 Sep 2008

The m-file "dpre" solves the discrete-time periodic optimal control problem by a cyclic QZ method. It is not the fastest method available, but works quite well. The m-file "dpre" computes 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.

### Cite As

Ivo Houtzager (2021). DPRE (https://www.mathworks.com/matlabcentral/fileexchange/21379-dpre), MATLAB Central File Exchange. Retrieved .

SALIC Tom

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

Ivo Houtzager

I 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.

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 Tom

I 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 Houtzager

What 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 Tom

Dear 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?