3430
|
1 ## Copyright (C) 1996, 1998 Auburn University. All rights reserved. |
|
2 ## |
|
3 ## This file is part of Octave. |
|
4 ## |
|
5 ## Octave is free software; you can redistribute it and/or modify it |
|
6 ## under the terms of the GNU General Public License as published by the |
|
7 ## Free Software Foundation; either version 2, or (at your option) any |
|
8 ## later version. |
|
9 ## |
|
10 ## Octave is distributed in the hope that it will be useful, but WITHOUT |
|
11 ## ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or |
|
12 ## FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License |
|
13 ## for more details. |
|
14 ## |
|
15 ## You should have received a copy of the GNU General Public License |
|
16 ## along with Octave; see the file COPYING. If not, write to the Free |
5307
|
17 ## Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA |
|
18 ## 02110-1301 USA. |
3430
|
19 |
|
20 ## -*- texinfo -*- |
5016
|
21 ## @deftypefn {Function File} {} h2norm (@var{sys}) |
|
22 ## Computes the |
|
23 ## @iftex |
|
24 ## @tex |
|
25 ## $ { \cal H }_2 $ |
|
26 ## @end tex |
|
27 ## @end iftex |
|
28 ## @ifinfo |
|
29 ## H-2 |
|
30 ## @end ifinfo |
|
31 ## norm of a system data structure (continuous time only). |
3430
|
32 ## |
|
33 ## Reference: |
5016
|
34 ## Doyle, Glover, Khargonekar, Francis, @cite{State-Space Solutions to Standard} |
|
35 ## @iftex |
|
36 ## @tex |
|
37 ## $ { \cal H }_2 $ @cite{and} $ { \cal H }_\infty $ |
|
38 ## @end tex |
|
39 ## @end iftex |
|
40 ## @ifinfo |
|
41 ## @cite{H-2 and H-infinity} |
|
42 ## @end ifinfo |
|
43 ## @cite{Control Problems}, @acronym{IEEE} @acronym{TAC} August 1989. |
3430
|
44 ## @end deftypefn |
|
45 |
|
46 ## Author: A. S. Hodel <a.s.hodel@eng.auburn.edu> |
|
47 ## Created: August 1995 |
|
48 ## updated for system data structure by John Ingram November 1996 |
|
49 |
|
50 function h2gain = h2norm (sys) |
|
51 |
|
52 if((nargin != 1)) |
|
53 usage("h2gain = h2norm(sys)"); |
4030
|
54 elseif(!isstruct(sys)) |
3430
|
55 error("Sys must be in system data structure"); |
|
56 end |
|
57 dflg = is_digital(sys); |
|
58 |
|
59 if(!is_stable(sys)) |
|
60 warning("h2norm: unstable input system; returning Inf"); |
|
61 h2gain = Inf; |
|
62 else |
|
63 ## compute gain |
|
64 [a,b,c,d] = sys2ss(sys); |
|
65 if(dflg) |
|
66 M = dlyap(a,b*b'); |
|
67 else |
|
68 M = lyap (a,b*b'); |
|
69 endif |
|
70 if( min(real(eig(M))) < 0) |
5016
|
71 error("h2norm: gramian not >= 0 (lightly damped modes?)") |
3430
|
72 endif |
|
73 |
|
74 h2gain = sqrt(trace(d'*d + c*M*c')); |
|
75 endif |
|
76 endfunction |