LQR {netcontrol} | R Documentation |
Linear Quadratic Regulator
Description
Creates a function that can be used to calculate the cumulative value of the LQR for any set of states and control inputs. By setting eval to True, the LQR is immediately calculated. See (Lewis et al. 2012)
NOTE: LQR functions, as they are calculated forward in time, go to 0 by the maximum time regardless of input. This is expected behavior, but that does make using the LQR value to evaluate control efficacy somewhat difficult.
Usage
LQR(X, U, S, Q_seq, R_seq, eval = TRUE)
Arguments
X |
A |
U |
A |
S |
A |
Q_seq |
A list of |
R_seq |
A list of |
eval |
Boolean, if |
Value
A function or a t
length numeric vector
References
Lewis FL, Vrabie DL, Syrmos VL (2012). Optimal Control, 3rd ed edition. Wiley, Hoboken. ISBN 978-0-470-63349-6.
Examples
X = matrix(1, 100, 3)
U = matrix(-1, 99, 3)
S = Q_seq = R_seq = diag(3)
print(LQR(X,U, S, Q_seq, R_seq)[1:5])