From 1f12e47e6d1fe8b365806aa0b42de237970d53bf Mon Sep 17 00:00:00 2001 From: Nao Pross Date: Wed, 24 May 2023 16:50:06 +0200 Subject: Take deliverables for Robust MPC from yanzhen According to table 12 - generate_disturbances - simulate_uncertain - compute_tube_contorller - compute_minRPI - compute_tightening - MPC_TUBE - MPC_TUBE/eval (contained in MPC_TUBE.m) - MPC_TUBE_script (and its output MPC_TUBE_params.mat) --- templates/simulate_uncertain.m | 13 +++++++++++++ 1 file changed, 13 insertions(+) (limited to 'templates/simulate_uncertain.m') diff --git a/templates/simulate_uncertain.m b/templates/simulate_uncertain.m index dc9df26..f74f7af 100644 --- a/templates/simulate_uncertain.m +++ b/templates/simulate_uncertain.m @@ -8,4 +8,17 @@ function [Xt,Ut,ctrl_info] = simulate_uncertain(x0, ctrl, Wt, params) % YOUR CODE HERE + Xt = [x0]; + Ut = []; + x = x0 + ctrl_info = []; + % obj = LQR(); + for i = 1:params.model.HorizonLength + [u, ctrl_info_] = ctrl.eval(x); + Ut = [Ut u]; + ctrl_info = [ctrl_info ctrl_info_]; + x = params.model.A*x + params.model.B*u + Wt(:,i); + Xt = [Xt x]; + end + % plot_trajectory(Xt, Ut, ctrl_info, params); end \ No newline at end of file -- cgit v1.2.1