% finding the closed loop poles for the optimal infinte horizion % control law for the system of the form: % X(k+1) = AX(k) + Bu(k) % while minimizing a quadratic performance of the % form: % J = 1/2*sum(X(k)'QX(k) + Ru(k)^2) % using Riccati analytic solution % Ref.: Optimal Control by F. Leuis & V. Syrmous, 1995 % set the problem parameters A = [1 .5;0 1]; B = [0.125;.5]; R = 1; syms alfa betta Q = [alfa 0;0 betta]; %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% H = [A^-1 A^-1*B*R^-1*B'; Q*A^-1 A'+Q*A^-1*B*R^-1*B']; [W,D] = eig(H); W21 = W(3:4,1:2); W11 = W(1:2,1:2); S_inf = W21*inv(W11); K_inf = R^-1*B'*S_inf; closed_loop_poles = eig(A-B*K_inf)