1 ## Copyright (C) 2009, 2010 Lukas F. Reichlin
2 ## Copyright (C) 2009 Luca Favatella <slackydeb@gmail.com>
4 ## This file is part of LTI Syncope.
6 ## LTI Syncope is free software: you can redistribute it and/or modify
7 ## it under the terms of the GNU General Public License as published by
8 ## the Free Software Foundation, either version 3 of the License, or
9 ## (at your option) any later version.
11 ## LTI Syncope is distributed in the hope that it will be useful,
12 ## but WITHOUT ANY WARRANTY; without even the implied warranty of
13 ## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 ## GNU General Public License for more details.
16 ## You should have received a copy of the GNU General Public License
17 ## along with LTI Syncope. If not, see <http://www.gnu.org/licenses/>.
20 ## @deftypefn {Function File} {@var{ob} =} obsv (@var{sys})
21 ## @deftypefnx {Function File} {@var{ob} =} obsv (@var{a}, @var{c})
22 ## Return observability matrix.
29 ## State transition matrix (n-by-n).
31 ## Measurement matrix (p-by-n).
37 ## Observability matrix.
43 ## $$ O_b = \\left[ \\matrix{ C \\cr
47 ## CA^{n-1} } \\right ] $$
63 ## Author: Lukas Reichlin <lukas.reichlin@gmail.com>
64 ## Created: October 2009
67 function ob = obsv (a, c)
69 if (nargin == 1) # obsv (sys)
70 ob = ctrb (a.').'; # transpose is overloaded for lti models
71 elseif (nargin == 2) # obsv (a, c)
72 ob = ctrb (a.', c.').'; # size checked inside
80 %!assert (obsv ([1, 0; 0, -0.5], [8, 8]), [8, 8; 8, -4]);