Rev | Line | |
---|
[37] | 1 | clc |
---|
| 2 | echo on |
---|
| 3 | yalmip('clear') |
---|
| 4 | %********************************************************* |
---|
| 5 | % |
---|
| 6 | % Modeling and solving KYP problems |
---|
| 7 | % |
---|
| 8 | %********************************************************* |
---|
| 9 | % |
---|
| 10 | % This example requires the KYPD-solver. |
---|
| 11 | % |
---|
| 12 | % We will show how we can use the dedicated |
---|
| 13 | % KYPD solver to solve a L2-gain analysis problem. |
---|
| 14 | % |
---|
| 15 | % minimize t |
---|
| 16 | % s.t [A'P+PA+C'C PB;B'P -t] < 0 |
---|
| 17 | % P > 0 |
---|
| 18 | % |
---|
| 19 | pause |
---|
| 20 | |
---|
| 21 | % Define a random stable system |
---|
| 22 | n = 30; |
---|
| 23 | A = randn(n);A = A - max(real(eig(A)))*eye(n)*1.5; |
---|
| 24 | B = randn(n,1); |
---|
| 25 | C = randn(1,n); |
---|
| 26 | pause |
---|
| 27 | |
---|
| 28 | % YALMIP variables |
---|
| 29 | t = sdpvar(1,1); |
---|
| 30 | P = sdpvar(n,n); |
---|
| 31 | pause |
---|
| 32 | |
---|
| 33 | % KYP constraint |
---|
| 34 | % NOTE : Do not add the constraint P>0 |
---|
| 35 | % if you want to use the KYPD solver) |
---|
| 36 | F = set(kyp(A,B,P,blkdiag(C'*C,-t)) < 0) |
---|
| 37 | pause |
---|
| 38 | |
---|
| 39 | % Solve using dedicated solver |
---|
| 40 | sol1 = solvesdp(F,t,sdpsettings('solver','kypd')); |
---|
| 41 | pause |
---|
| 42 | |
---|
| 43 | % Solve using SeDuMi (or any other standard SDP solver) |
---|
| 44 | sol2 = solvesdp(F,t,sdpsettings('solver','sedumi')); |
---|
| 45 | pause |
---|
| 46 | |
---|
| 47 | % Compare solution time (this can be a bit mis-leadinhg due to memory caching etc...) |
---|
| 48 | % KYPD should typically be a lot faster than the straight-forward solution |
---|
| 49 | sol1.solvertime/sol2.solvertime |
---|
| 50 | |
---|
| 51 | pause |
---|
| 52 | echo off |
---|
Note: See
TracBrowser
for help on using the repository browser.