I have the following sdp formulation in infinite time horizon
\begin{equation} \begin{split} \min_{P,Z} &\ trace(SXP)+trace(Z)\\ \text{sbj to } & \\ &\begin{bmatrix} XP-I & YP\\ P^T Y^T & XP \end{bmatrix} \succeq 0\\ &\begin{bmatrix} Z & R^{1/2}UP\\ P^T U^T R^{1/2} & XP \end{bmatrix}\succeq 0 \end{split} \end{equation}
that is in cvx:
cvx_begin sdp
variable Z(1,1)
variable P(T,n)
minimize( trace(S*X*P)+ trace(Z) )
subject to
[Z, R^{1/2}*U*P; P'*U'*R^{1/2}, X*P] >= 0
[X*P-eye(n), Y*P; P'*Y', X*P] >= 0
cvx_end
K_cvx = -U*P*inv(X*P)
Now, I want to re-write it in finite horizon. Assuming my formulation is correct, it is the following
\begin{equation} \begin{split} \min_{\substack{P_k,Z_k \\k\in \{ 0,\dots, N-1\} }} &\ trace(S_f X P(N)) + \sum_{k=0}^{N-1} \Big(trace(SXP(k))+trace(Z_k)\Big) \\ \text{sbj to } & \\ &\begin{bmatrix} X P(k+1) -I & Y P(k)\\ (Y P(k))^T & X P(k) \end{bmatrix} \succeq 0\\ &\begin{bmatrix} Z_k & R^{1/2}U P(k)\\ P(k)^T U^T R^{1/2} & X P(k) \end{bmatrix}\succeq 0\\ & X P(0) \succeq I_n \end{split} \end{equation}
which in cvx is
for j = 1:N-1
cvx_begin sdp
variable Z(1,1,N)
variable P(T,n,N)
minimize( trace(S*X*P(:,:,j))+ trace(Z(:,:,j)) + trace(Sf*X*P(:,:,N)) );
subject to
[Z(:,:,j), R^(0.5)*U*P(:,:,j); P(:,:,j)'*U' *R^(0.5), X*P(:,:,j)] >= 0;
[X*P(:,:,j+1)-eye(n), Y*P(:,:,j); P(:,:,j)' *Y' , X*P(:,:,j)] >= 0;
X*P(:,:,1) >= eye(n);
cvx_end
K_cvx_fh{j} = -U*P(:,:,j)*inv(X*P(:,:,j));
end
however, for {N \rightarrow \infty}, the solution is not converging to the infinite horizon solution. Do you have any tips to correct it?