% input the a and b matrices
a = [-0.05156 -0.05877;
   0.01503 -0.005887];
b = [0 -0.03384]';

% input the w matrix
w = [0.0125 0;
   0 0.0125];

% introduce the augmented matrices with the integrators

aa = [a(1,1) a(1,2) 0;
   a(2,1) a(2,2) 0;
   1 0 0];
bb = [b;0;]

% define the weighting matrices

qp = [1 0;
   0 0];
qi =1

q = [qp(1,1) qp(1,2) 0;
   qp(2,1) qp(2,2) 0;
   0 0 qi];

r = 1;

% compute the steady state feedback gains

co = ctrb(aa,bb);
rk = rank(co)
[k p] = lqr(aa,bb,q,r)
   
