]> Creatis software - CreaPhase.git/blob - octave_packages/control-2.3.52/isdetectable.m
Add a useful package (from Source forge) for octave
[CreaPhase.git] / octave_packages / control-2.3.52 / isdetectable.m
1 ## Copyright (C) 2009, 2010   Lukas F. Reichlin
2 ##
3 ## This file is part of LTI Syncope.
4 ##
5 ## LTI Syncope is free software: you can redistribute it and/or modify
6 ## it under the terms of the GNU General Public License as published by
7 ## the Free Software Foundation, either version 3 of the License, or
8 ## (at your option) any later version.
9 ##
10 ## LTI Syncope is distributed in the hope that it will be useful,
11 ## but WITHOUT ANY WARRANTY; without even the implied warranty of
12 ## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
13 ## GNU General Public License for more details.
14 ##
15 ## You should have received a copy of the GNU General Public License
16 ## along with LTI Syncope.  If not, see <http://www.gnu.org/licenses/>.
17
18 ## -*- texinfo -*-
19 ## @deftypefn {Function File} {@var{bool} =} isdetectable (@var{sys})
20 ## @deftypefnx {Function File} {@var{bool} =} isdetectable (@var{sys}, @var{tol})
21 ## @deftypefnx {Function File} {@var{bool} =} isdetectable (@var{a}, @var{c})
22 ## @deftypefnx {Function File} {@var{bool} =} isdetectable (@var{a}, @var{c}, @var{e})
23 ## @deftypefnx {Function File} {@var{bool} =} isdetectable (@var{a}, @var{c}, @var{[]}, @var{tol})
24 ## @deftypefnx {Function File} {@var{bool} =} isdetectable (@var{a}, @var{c}, @var{e}, @var{tol})
25 ## @deftypefnx {Function File} {@var{bool} =} isdetectable (@var{a}, @var{c}, @var{[]}, @var{[]}, @var{dflg})
26 ## @deftypefnx {Function File} {@var{bool} =} isdetectable (@var{a}, @var{c}, @var{e}, @var{[]}, @var{dflg})
27 ## @deftypefnx {Function File} {@var{bool} =} isdetectable (@var{a}, @var{c}, @var{[]}, @var{tol}, @var{dflg})
28 ## @deftypefnx {Function File} {@var{bool} =} isdetectable (@var{a}, @var{c}, @var{e}, @var{tol}, @var{dflg})
29 ## Logical test for system detectability.
30 ## All unstable modes must be observable or all unobservable states must be stable.
31 ##
32 ## @strong{Inputs}
33 ## @table @var
34 ## @item sys
35 ## LTI system.
36 ## @item a
37 ## State transition matrix.
38 ## @item c
39 ## Measurement matrix.
40 ## @item e
41 ## Descriptor matrix.
42 ## If @var{e} is empty @code{[]} or not specified, an identity matrix is assumed.
43 ## @item tol
44 ## Optional tolerance for stability.  Default value is 0.
45 ## @item dflg = 0
46 ## Matrices (@var{a}, @var{c}) are part of a continuous-time system.  Default Value.
47 ## @item dflg = 1
48 ## Matrices (@var{a}, @var{c}) are part of a discrete-time system.
49 ## @end table
50 ##
51 ## @strong{Outputs}
52 ## @table @var
53 ## @item bool = 0
54 ## System is not detectable.
55 ## @item bool = 1
56 ## System is detectable.
57 ## @end table
58 ##
59 ##
60 ## @strong{Algorithm}@*
61 ## Uses SLICOT AB01OD and TG01HD by courtesy of
62 ## @uref{http://www.slicot.org, NICONET e.V.}
63 ## See @command{isstabilizable} for description of computational method.
64 ## @seealso{isstabilizable, isstable, isctrb, isobsv}
65 ## @end deftypefn
66
67 ## Author: Lukas Reichlin <lukas.reichlin@gmail.com>
68 ## Created: October 2009
69 ## Version: 0.3
70
71 function bool = isdetectable (a, c = [], e = [], tol = [], dflg = 0)
72
73   if (nargin == 0)
74     print_usage ();
75   elseif (isa (a, "lti"))                              # isdetectable (sys), isdetectable (sys, tol)
76     if (nargin > 2)
77       print_usage ();
78     endif
79     bool = isstabilizable (a.', c);                    # transpose is overloaded
80   elseif (nargin < 2 || nargin > 5)
81     print_usage ();
82   else                                                 # isdetectable (a, c, ...)
83     bool = isstabilizable (a.', c.', e.', tol, dflg);  # arguments checked inside
84   endif
85
86 endfunction
87