diff options
-rw-r--r-- | templates/LQR.m | 5 |
1 files changed, 3 insertions, 2 deletions
diff --git a/templates/LQR.m b/templates/LQR.m index c84a670..c05237d 100644 --- a/templates/LQR.m +++ b/templates/LQR.m @@ -18,9 +18,10 @@ classdef LQR % obj.K = ... (save feedback matrix for use in eval function) A = params.model.A; B = params.model.B; - [X, L, G] = dare(A,B,Q,R); + % [X, L, G] = dare(A,B,Q,R); + [K,S,e] = dlqr(A,B,Q,R) % obj.K = -inv(B'*P_inf*B+R)*B'*P_inf*A; - obj.K = -G; + obj.K = -K; end function [u, ctrl_info] = eval(obj,x) |