A = [-1 0 -1; -1 -1 0; 0 -1 -1]
B = [1; 0; 0]
C = [0 0 1]
D = [0]

%

sys = ss(A, B, C, D)

%

R = 10
Q = [4 0 0; 0 4 0; 0 0 0]

%

[K, S, e] = lqr(sys, Q, R, 0)

%

sys_opt = ss(A - B * K, B, C - D * K, D)

%

step(sys_opt)

%

stepinfo(sys_opt)