diff options
author | Nao Pross <np@0hm.ch> | 2023-05-03 15:52:38 +0200 |
---|---|---|
committer | Nao Pross <np@0hm.ch> | 2023-05-03 15:52:38 +0200 |
commit | 3fe784b2ceb5c3632a52671dcb84ae21c65f4ab0 (patch) | |
tree | 171761f23cadfa73420c83c0ed22cefd6b4ac6e2 /templates | |
parent | ADD: code for task 10 (diff) | |
download | mpc_pe-3fe784b2ceb5c3632a52671dcb84ae21c65f4ab0.tar.gz mpc_pe-3fe784b2ceb5c3632a52671dcb84ae21c65f4ab0.zip |
FIX: pass LQR.m
Uups, lately I have been programming more in python
Diffstat (limited to 'templates')
-rw-r--r-- | templates/LQR.m | 9 |
1 files changed, 5 insertions, 4 deletions
diff --git a/templates/LQR.m b/templates/LQR.m index a213bd7..873546a 100644 --- a/templates/LQR.m +++ b/templates/LQR.m @@ -15,10 +15,11 @@ classdef LQR %constructor function obj = LQR(Q,R,params) % YOUR CODE HERE - E = np.zeros(params.model.nx); - S = np.zeros(params.model.nx); - Pinf = idare(params.model.A, params.model.B, Q, R, S, E, 'noscaling') - obj.K = -inv(R + B' * Pinf * B) * B' * Pinf * A; + E = zeros(params.model.nx); + S = zeros(params.model.nx, params.model.nu); + Pinf = idare(params.model.A, params.model.B, Q, R); + obj.K = -inv(R + params.model.B' * Pinf * params.model.B) ... + * params.model.B' * Pinf * params.model.A; end function [u, ctrl_info] = eval(obj,x) |