Line | |
---|
1 | |
---|
2 | echo on |
---|
3 | clc |
---|
4 | % This example shows how BMIs can be locally solved using |
---|
5 | % a simple alternating scheme. |
---|
6 | % |
---|
7 | % The problem is to find a feedback u = Lx so that the |
---|
8 | % L2 gain from w to y is minimized, for the system |
---|
9 | % |
---|
10 | % x' = Ax+Bu+Gw |
---|
11 | % y = Cx |
---|
12 | % |
---|
13 | % This can be formulated as the BMI |
---|
14 | % |
---|
15 | % min t |
---|
16 | % s.t P > 0 |
---|
17 | % [(A+BL)P+P(A+BL)+C'C PG; G'P -tI] < 0 |
---|
18 | % |
---|
19 | pause |
---|
20 | clc |
---|
21 | |
---|
22 | % Create system data |
---|
23 | A = [-1 -1 -1; |
---|
24 | 1 0 0; |
---|
25 | 0 1 0]; |
---|
26 | B = [1;0;0]; |
---|
27 | C = [0 0 1]; |
---|
28 | G = [-1;-1;-1]; |
---|
29 | |
---|
30 | % Define decision variables |
---|
31 | P = sdpvar(3,3); |
---|
32 | L = sdpvar(1,3); |
---|
33 | t = sdpvar(1,1); |
---|
34 | pause |
---|
35 | |
---|
36 | % A reasonble initial guess is valuable |
---|
37 | [L0,P0]=lqr(A,B,eye(3),1); |
---|
38 | setsdpvar(P,P0); |
---|
39 | setsdpvar(L,-L0); |
---|
40 | setsdpvar(t,100); |
---|
41 | pause |
---|
42 | clc |
---|
43 | |
---|
44 | % Fix L and optimize Lyapunov matrix P |
---|
45 | F = set([(A+B*double(L))'*P+P*(A+B*double(L))+C'*C P*G;G'*P -t]<0); |
---|
46 | F = F + set(P>0); |
---|
47 | pause |
---|
48 | solvesdp(F,t) |
---|
49 | double(t) |
---|
50 | pause |
---|
51 | |
---|
52 | % Fix Lyapunov matrix P and optimize L |
---|
53 | F = set([(A+B*L)'*double(P)+double(P)*(A+B*L)+C'*C double(P)*G;G'*double(P) -t]<0); |
---|
54 | pause |
---|
55 | solvesdp(F,t) |
---|
56 | double(t) |
---|
57 | pause |
---|
58 | |
---|
59 | % and again... |
---|
60 | F = set([(A+B*double(L))'*P+P*(A+B*double(L))+C'*C P*G;G'*P -t]<0); |
---|
61 | F = F + set(P>0); |
---|
62 | solvesdp(F,t) |
---|
63 | double(t) |
---|
64 | pause |
---|
65 | |
---|
66 | % and again... |
---|
67 | F = set([(A+B*L)'*double(P)+double(P)*(A+B*L)+C'*C double(P)*G;G'*double(P) -t]<0); |
---|
68 | solvesdp(F,t) |
---|
69 | double(t) |
---|
70 | pause |
---|
71 | echo off |
---|
Note: See
TracBrowser
for help on using the repository browser.