I added a simple example to show you. If you like this example, consider voting 👍 the Answer. Thanks!
Say, the reference state is 1.
K1 = lqr(A, B, eye(2), 1)
sys1 = ss(A-B*K1, B, [1 0], 0)
sys1 =
A =
x1 x2
x1 0 1
x2 -2.236 -4.298
B =
u1
x1 0
x2 1
C =
x1 x2
y1 1 0
D =
u1
y1 0
Continuous-time state-space model.
The step response shows that the output won't reach 1. Thus, a pre-compensator is needed:
sys2 = ss(A-B*K1, N*B, [1 0], 0)
sys2 =
A =
x1 x2
x1 0 1
x2 -2.236 -4.298
B =
u1
x1 0
x2 2.236
C =
x1 x2
y1 1 0
D =
u1
y1 0
Continuous-time state-space model.