Bug #10562 fixed - The CACSD/Robust Control demo failed.
[scilab.git] / scilab / modules / cacsd / demos / robust / rob.dem
1 //
2 // Scilab ( http://www.scilab.org/ ) - This file is part of Scilab
3 // Copyright (C) ????-2008 - INRIA
4 //
5 // This file is distributed under the same license as the Scilab package.
6 //
7
8 mode(1);
9 lines(0);
10 s=poly(0,'s');
11
12 //MAC-FARLANE PROBLEM for G=1/s^3;
13 G=syslin("c",1/s^3);
14
15 [P,r]=macglov(G);clean(P)
16
17 //Optimal controller K:
18
19 halt()
20 //K Optimal controller , ro = gamaopt^-2;
21 [K,ro]=h_inf(P,r,0,1,30);
22 K,gamaopt=1/sqrt(ro)
23
24 // Check internal stability:
25
26 halt()
27
28 Tzw=lft(tf2ss(P),tf2ss(K));
29
30 [Acl,Bcl,Ccl,Dcl]=abcd(Tzw); spec(Acl)
31
32 //Optimal gain:
33
34 halt()
35
36 ga=h_norm(Tzw)
37
38 //Compare with gamaopt
39
40 ga-gamaopt
41
42 //Compare with theory
43
44 halt()
45
46 [N,M]=lcf(tf2ss(G)); //Left coprime factorization of G.
47
48 nk=hankelsv([N,M]);
49
50 ro-( 1-nk(1) )
51