I’m a little confused by the “docstring
”/documentation of dlqr
:
dlqr(A, B, Q, R), dlqr(sys, Q, R)
Calculate the optimal gain matrix K for the state-feedback law u[k] = K*x[k] that minimizes the cost function:
J = sum(x'Qx + u'Ru, 0, inf).
For the discrte time model x[k+1] = Ax[k] + Bu[k].
See also lqg
Usage example:
h = 0.1
A = [1 h; 0 1]
B = [0;1]
C = [1 0]
sys = ss(A,B,C,0, h)
Q = eye(2)
R = eye(1)
L = dlqr(A,B,Q,R) # lqr(sys,Q,R) can also be used
u(t,x) = -L*x # Form control law,
The introduction talks about computing matrix K
and positive feedback u=Kx while the example states that matrix L
is computed where presumably L=-K.
I assume this is just a question of typos/documentation in need of update?