From a23ba49056a36aff221d0c23e228b981222c3576 Mon Sep 17 00:00:00 2001 From: Yuan Xu Date: Wed, 24 May 2023 17:35:46 +0200 Subject: add submission zip --- Submission files/compute_minRPI.m | 39 +++++++++++++++++++++++++++++++++++++++ 1 file changed, 39 insertions(+) create mode 100644 Submission files/compute_minRPI.m (limited to 'Submission files/compute_minRPI.m') diff --git a/Submission files/compute_minRPI.m b/Submission files/compute_minRPI.m new file mode 100644 index 0000000..19df517 --- /dev/null +++ b/Submission files/compute_minRPI.m @@ -0,0 +1,39 @@ +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% +% Copyright (c) 2023, Amon Lahr, Simon Muntwiler, Antoine Leeman & Fabian Flürenbrock Institute for Dynamic Systems and Control, ETH Zurich. +% +% All rights reserved. +% +% Please see the LICENSE file that has been included as part of this package. +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% + +function [H_tube,h_tube,n_iter] = compute_minRPI(K_tube,params) + % YOUR CODE HERE + A = params.model.A+params.model.B*K_tube; + % A = params.model.A; +% display(A) + nx = params.model.nx; + omega = Polyhedron('A',[eye(nx);-eye(nx)],'b',zeros(1,2*nx)'); + % display(omega.A) + % display(omega.b) + n_iter = 0; + Hw = params.constraints.DisturbanceMatrix; + hw = params.constraints.DisturbanceRHS; + W = Polyhedron('A',Hw,'b',hw); + while true + omega_last = copy(omega); + % display(n_iter) + % A_last = omega.A; + % b_last = omega.b; + display(n_iter); + display(omega.b) + omega = omega.plus(A^(n_iter)*W); + + if eq(omega.minHRep(),omega_last.minHRep()) + % if eq(omega,omega_last) + break + end + n_iter = n_iter+1; + end + H_tube = omega.A; + h_tube = omega.b; +end \ No newline at end of file -- cgit v1.2.1