7017
|
1 ## Copyright (C) 1996, 1998, 2000, 2002, 2004, 2005, 2006, 2007 |
|
2 ## Auburn University. All rights reserved. |
3430
|
3 ## |
|
4 ## This file is part of Octave. |
|
5 ## |
|
6 ## Octave is free software; you can redistribute it and/or modify it |
7016
|
7 ## under the terms of the GNU General Public License as published by |
|
8 ## the Free Software Foundation; either version 3 of the License, or (at |
|
9 ## your option) any later version. |
3430
|
10 ## |
7016
|
11 ## Octave is distributed in the hope that it will be useful, but |
|
12 ## WITHOUT ANY WARRANTY; without even the implied warranty of |
|
13 ## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU |
|
14 ## General Public License for more details. |
3430
|
15 ## |
|
16 ## You should have received a copy of the GNU General Public License |
7016
|
17 ## along with Octave; see the file COPYING. If not, see |
|
18 ## <http://www.gnu.org/licenses/>. |
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 |
6919
|
52 if (nargin != 1) |
6046
|
53 print_usage (); |
6919
|
54 elseif (! isstruct (sys)) |
|
55 error ("Sys must be in system data structure"); |
7151
|
56 endif |
6919
|
57 dflg = is_digital (sys); |
3430
|
58 |
6919
|
59 if (! is_stable (sys)) |
|
60 warning ("h2norm: unstable input system; returning Inf"); |
3430
|
61 h2gain = Inf; |
|
62 else |
|
63 ## compute gain |
6919
|
64 [a, b, c, d] = sys2ss (sys); |
|
65 if (dflg) |
|
66 M = dlyap (a, b*b'); |
3430
|
67 else |
6919
|
68 M = lyap (a, b*b'); |
3430
|
69 endif |
6919
|
70 if (min (real (eig (M))) < 0) |
|
71 error ("h2norm: gramian not >= 0 (lightly damped modes?)") |
3430
|
72 endif |
|
73 |
6919
|
74 h2gain = sqrt (trace (d*d' + c*M*c')); |
3430
|
75 endif |
6919
|
76 |
3430
|
77 endfunction |