1. The ARE can be solved by some methods .These are iterative and numerical ways. Iterative is the best but numerical is also work well. Some numerical example : Schur decomposition of Hamiltonian matrix , Spectral Factorization Some Iterative example : Matrix sign function 2. For real time application of solving algebraic ricatti equation for SDRE controller there are some ways one of that is using S-function (write codes in C programming and use it in the simulink block). There is a really good thesis about that, also there is C codes in thesis : "ANALYSIS AND REAL-TIME IMPLEMENTATION OF STATE-DEPENDENT RICCATI EQUATION CONTROLLED SYSTEMS-EVRIN BILGE ERDEM " another way is using matlab function in Simulink environment . Some functions does not work but i found one of that which is working but some calculation problems which about re ordering schur decomposition (all eigenvalues have to be in the upper triangle of the schur matrix). I post it in here because "[U_ordered,S_ordered] = ordschur(U,S,'lhp')" code does not work in script.So if anybody have an idea pls post it in here These matlab codes are about schur decomposition of hamiltonian matrix . A and B can easily convertible to SDC matrices which shows the system dynamics
function y = fcn(x1,x2)
A = [x1 x2; x1 x2];
B = [2; 1];
C = eye(2);
D = [0; 0];
Q = [1 1; 3 0];
R = [3];
H = [A -(B*inv(R)*B'); -Q -A'];
[U, S] = schur(H);
[m,n] = size(U);
U11 = U(1:(m/2), 1:(n/2));
U21 = U((m/2+1):m, 1:(n/2));
P = U21*inv(U11) ;
y = P;