File: lmi.dem

package info (click to toggle)
scilab 2.4-1
  • links: PTS
  • area: non-free
  • in suites: potato, slink
  • size: 55,196 kB
  • ctags: 38,019
  • sloc: ansic: 231,970; fortran: 148,976; tcl: 7,099; makefile: 4,585; sh: 2,978; csh: 154; cpp: 101; asm: 39; sed: 5
file content (78 lines) | stat: -rw-r--r-- 2,902 bytes parent folder | download | duplicates (2)
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
getf(SCI+'/demos/lmitool/lmidem.sci');
// Copyright INRIA
mode(-1);
x_message(['      ';
'LMITOOL is a Scilab package for LMI optimization';
      '           ';
'It can solve the following problem';
      '                 ';
      '   minimize  f(X1,...,XM)  ';
      'subject to the LME constraints: ';
      '   Gi(X1,...,XM)=0,  i=1,2,...,p,';
      'and the LMI constraints:  ';
      '   Hj(X1,...,XM)>=0,  j=1,2,...,q.';
      '              ';
      'where';
'X1,...,XM are unknown real matrices';
'f is the objective function, a linear scalar function of the entries of the X''s,';
'Gi''s are affine matrix functions of the entries of the X''s,';
'Hj''s are affine symmetric matrix functions of the entries of the X''s.';
      '            ';
'For a detailed description and examples consult: ';
      '          ''LMITOOL: a Package for LMI Optimization in Scilab, User''s Guide'' ';
      '          ';
      '          ';
'LMITOOL uses Semidefinite Programming package SP developed by L. Vandenberghe and S. Boyd.']);

while %t
  %demo_=x_choose(['H-infinity gain';'Output Feedback';'Sylvester equation'],...
      ['This is a sample of LMI problems that LMITOOL can solve';
      'Select a problem (other examples are given in demos/lmitool directory)']);
  select %demo_
  case 0
    break;
  case 1
    mode(1)
    lmidem(SCI+'/demos/lmitool/normopt.sci');
    getf(SCI+'/demos/lmitool/normopt.sci');
    x_message(['Let''s try a simple example with 3 states';...
	    'Edit below A,B,C,D matrices']);
    [ok,A,B,C,D]=getvalue('Enter A, B, C, D matrices',['A';'B';'C';'D'],...
	list('mat',[3,3],'mat',[3,2],'mat',[2,3],'mat',[2,2]),...
	['[0,1,0;2,3,1;-1,-2,0]','[1,0;-2,1;0,1]','[1,2,0;0,1,-2]','[0,0;0,0]']);
    if ok then
      [X,gopt]=normopt(A,B,C,D);
      disp(gopt, 'optimal gama found is:')
      disp(gopt-h_norm(syslin('c',A,B,C,D)),...
	  'check: gopt-h_norm(syslin(''c'',A,B,C,D)=')
    end
    mode(-1)
  case 2
    mode(1)
    lmidem(SCI+'/demos/lmitool/of.sci');
    getf(SCI+'/demos/lmitool/of.sci');
    x_message(['Let''s try a simple example with 3 states';...
	    'Enter A,B,C matrices']);
    [ok,A,B,C]=getvalue('Edit below A, B, C matrices',['A';'B';'C'],...
	list('mat',[3,3],'mat',[3,2],'mat',[2,3]),...
	['[0,1,0;2,3,1;-1,-2,0]','[1,0;-2,1;0,1]','[1,2,0;0,1,-2]']);
    if ok then
      [P,Q]=of(A,B,C);
      disp(P,Q);
    end
    mode(-1)
  case 3
    mode(1)
    lmidem(SCI+'/demos/lmitool/sylvester.sci');
    getf(SCI+'/demos/lmitool/sylvester.sci');
    x_message(['Let''s try a simple example with 3 states';...
	    'Enter A,B,C matrices']);
    [ok,A,B,C]=getvalue('Edit below A, B, C matrices',['A';'B';'C'],...
	list('mat',[3,3],'mat',[2,2],'mat',[3,2]),...
	['[0,1,0;2,3,1;-1,-2,0]','[1,0;-2,1]','[1,2;0,1;1,-2]']);
    [X]=sylvester(A,B,C,'c');
    disp(X, 'X found is:')
    disp(A*X+X*B-C ,'Check: A*X+X*B-C =')
    mode(-1)
  end   
end