The LQR masked subsystem available from the File Exchange addresses the Algebraic Riccati Equation (ARE) within Simulink. This can be seen in the MATLAB Function block code shown below:
The LQR subsystem's output X evolves over time to provide the solution to the ARE. This variable X corresponds to the matrix S that is produced as output by the lqr function.
The mask input Xo serves as the initial guess for the ARE solution matrix X. The steady-state value of X is used to obtain the LQR gain. Within the LQR subsystem, it is possible to observe the derivative of X approaching zero as time progresses, indicating convergence to the steady-state solution.
To compute the LQR gain at each time step for an updated plant, the ARE must be solved at every step. Additional clarification on this process can be found in the following discussion: