-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathCircle.m
94 lines (73 loc) · 1.97 KB
/
Circle.m
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
function [alpha,data,dec]=Circle(syst)
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% Authors:
% MC Turner and CR Richardson
% ECS
% University of Southampton
% UK
%
% Date: 15/05/23
%
% Purpose:
% Compute the maximum series gain (alpha) when using the Circle criterion
% as defined by Theorem 1 and Remark 3.
%
% Parameters:
% syst: Structure containing the system matrices of an example.
%
% Returns:
% alpha: Maximum series gain (float)
% data: Structure containing solutions of the LMI parametrised by alpha
% dec: # of decision variables
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%% Parameters
A = syst.a;
B = syst.b;
C = syst.c;
D = syst.d;
[n,m] = size(B); % n = dimension of state, m = dimension of output
%% Initialising alpha
if m == 1
Gm = margin(ss(A,B,-C,-D));
if Gm > 10000
Gm = 10000;
end
else
Gm = 1000;
end
% Determine initial upper/lower bound and initial test value
alpha_up = Gm*0.999;
alpha_low = 0; % We know alpha = 0 is always feasible as system's are stable
alpha = alpha_up;
%%
% Determine alpha by repeatedly solving LMI until the largest alpha is
% found where LMI is feasible
while ((alpha_up-alpha_low)/alpha_up) > 0.0001
setlmis([]);
P = lmivar(1,[n,1]);
V = lmivar(1,kron([1,0],ones(m,1)));
% First LMI
lmiterm([1,1,1,P],A',1,'s');
lmiterm([1,1,2,P],1*alpha,B);
lmiterm([1,1,2,-V],C',1);
lmiterm([1,2,2,V],-1,eye(m)-alpha*D,'s');
% P > 0
lmiterm([2,1,1,P],-1,1);
% V > 0
lmiterm([3,1,1,V],-1,1);
LMISYS = getlmis;
[tmin,xfeas] = feasp(LMISYS,[1e-20 5000 -0.1 1000 1]);
% Update alpha upper/lower bound plus new test value
if tmin < 0 % if LMIs are feasible
alpha_low = alpha;
else
alpha_up = alpha; % if LMIs are infeasible
end
alpha = (alpha_up + alpha_low)/2;
end
%%
% Return solution
dec = decnbr(LMISYS); % returns number of decision varibles
data.P = dec2mat(LMISYS,xfeas,P);
data.V = dec2mat(LMISYS,xfeas,V);
end