]> Creatis software - CreaPhase.git/blob - octave_packages/control-2.3.52/isobsv.m
Add a useful package (from Source forge) for octave
[CreaPhase.git] / octave_packages / control-2.3.52 / isobsv.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}, @var{nobs}] =} isobsv (@var{sys})
20 ## @deftypefnx {Function File} {[@var{bool}, @var{nobs}] =} isobsv (@var{sys}, @var{tol})
21 ## @deftypefnx {Function File} {[@var{bool}, @var{nobs}] =} isobsv (@var{a}, @var{c})
22 ## @deftypefnx {Function File} {[@var{bool}, @var{nobs}] =} isobsv (@var{a}, @var{c}, @var{e})
23 ## @deftypefnx {Function File} {[@var{bool}, @var{nobs}] =} isobsv (@var{a}, @var{c}, @var{[]}, @var{tol})
24 ## @deftypefnx {Function File} {[@var{bool}, @var{nobs}] =} isobsv (@var{a}, @var{c}, @var{e}, @var{tol})
25 ## Logical check for system observability.
26 ## For numerical reasons, @code{isobsv (sys)}
27 ## should be used instead of @code{rank (obsv (sys))}.
28 ##
29 ## @strong{Inputs}
30 ## @table @var
31 ## @item sys
32 ## LTI model.  Descriptor state-space models are possible.
33 ## @item a
34 ## State transition matrix.
35 ## @item c
36 ## Measurement matrix.
37 ## @item e
38 ## Descriptor matrix.
39 ## If @var{e} is empty @code{[]} or not specified, an identity matrix is assumed.
40 ## @item tol
41 ## Optional roundoff parameter.  Default value is 0.
42 ## @end table
43 ##
44 ## @strong{Outputs}
45 ## @table @var
46 ## @item bool = 0
47 ## System is not observable.
48 ## @item bool = 1
49 ## System is observable.
50 ## @item nobs
51 ## Number of observable states.
52 ## @end table
53 ##
54 ## @strong{Algorithm}@*
55 ## Uses SLICOT AB01OD and TG01HD by courtesy of
56 ## @uref{http://www.slicot.org, NICONET e.V.}
57 ##
58 ## @seealso{isctrb}
59 ## @end deftypefn
60
61 ## Author: Lukas Reichlin <lukas.reichlin@gmail.com>
62 ## Created: October 2009
63 ## Version: 0.4
64
65 function [bool, nobs] = isobsv (a, c = [], e = [], tol = [])
66
67   if (nargin == 0)
68     print_usage ();
69   elseif (isa (a, "lti"))            # isobsv (sys), isobsv (sys, tol)
70     if (nargin > 2)
71       print_usage ();
72     endif
73     [bool, nobs] = isctrb (a.', c);  # transpose is overloaded
74   elseif (nargin < 2 || nargin > 4)
75     print_usage ();
76   else                               # isobsv (a, c), isobsv (a, c, e), ...
77     [bool, nobs] = isctrb (a.', c.', e.', tol);
78   endif
79
80 endfunction
81