LQR with augumented state design I am trying to design a LQR controller with Integral action (Linear-Quadratic-Integral control) for a below plant. The plant has 4 states, 2 inputs and 4 output. Is it possible to track 4 reference using LQI controller?
$$ A = \left(\begin{matrix}-1.340&0.672&-12.9669&9.775\\-2.070&-3.275&1.707&0\\4.405&0.2345&-4.3911&0\\0&1&0.0713&0\end{matrix}\right) $$
$$ B = \left(\begin{matrix}0&-3.0234\\18.624&24.110\\14.073&-7.060\\0&0\end{matrix}\right) $$
$$ C= \left(\begin{matrix}1&0&0&0\\0&1&0&0\\0&0&1&0\\0&0&0&1\end{matrix}\right) $$
Click here for Controller structure (source- https://bit.ly/2LUpU7X)
The system is Controllable and is open loop stable.
Below is the script which I tried to solve in MATLAB:
A_aug = [A, zeros(4,4); -C, zeros(4,4)];
B_aug = [B; zeros(4,2)];

Q = eye(8);
R = eye(2);

F_aug = -lqr(A_aug,B_aug,Q,R);

k = F_aug(:,1:n);
k_i = F_aug(:,end);

But I was getting this error.

Cannot compute the stabilizing Riccati solution S for the LQR design.
  This could be because:
  * R is singular,
  * [Q N;N' R] needs to be positive definite,
  * The E matrix in the state equation is singular.


For linear quadratic integral (LQI) control to work, the augmented system has to be stabilizible. This limitation can be also be found in the Matlab documentation of the LQI function.
A linear time invariant (LTI) system is stabilizible, if all its uncontrollable modes are stable. You can first check with the ctrb function if there are uncontrollable modes:
A = [-1.34, 0.672, -12.9669, 9.775; 
     -2.07, -3.275, 1.707, 0;
     4.405, 0.2345, -4.3911, 0; 
     0, 1, 0.0713, 0];
B = [0, -3.0234; 
     18.624, 24.11; 
     14.073, -7.06; 
     0, 0];
C = eye(4);

Aa = [A, zeros(4, 4); -C, zeros(4, 4)];
Ba = [B; zeros(4, 2)];
Ca = [C, zeros(4, 4)];

rank(ctrb(Aa, Ba))

This script gives the output
ans =

     6

so your augmented system has two uncontrollable modes. You can also use the ctrbf function to get a Kalman decomposition, which seperates controllable and uncontrollable portions: it finds a similarity transform $T$ such that
$$
\bar{A}_a = T A_a T^T = \begin{bmatrix}
A_{a,uc} & 0 \\
A_{a,21} & A_{a,c}
\end{bmatrix}
$$
where $A_{a,c}$ is the controllable and $A_{a,uc}$ the uncontrollable portion of your augmented system matrix $A_a$. In code:
[Aa_bar, Ba_bar, Ca_bar, T, k] = ctrbf(Aa, Ba, Ca);
n_uc = size(Aa, 1) - sum(k); % Number of uncontrollable modes is 8 - 6 = 2
Aa_uc = Aa_bar(1:n_uc, 1:n_uc)

which outputs
Aa_uc =

   1.0e-16 *

   0.330254728851448   0.215513706491097
   0.433511198605747   0.089609131250558

So $A_{a, uc}$ is (practically, up to numerics) a zero matrix, so the uncontrollable modes are not stable because $A_{a, uc}$ is not a Hurwitz matrix.
