X-Git-Url: https://git.creatis.insa-lyon.fr/pubgit/?p=CreaPhase.git;a=blobdiff_plain;f=octave_packages%2Fcontrol-2.3.52%2Fobsvf.m;fp=octave_packages%2Fcontrol-2.3.52%2Fobsvf.m;h=fdcec71091a47bf0416597dd5cc5237ef87acc6e;hp=0000000000000000000000000000000000000000;hb=c880e8788dfc484bf23ce13fa2787f2c6bca4863;hpb=1705066eceaaea976f010f669ce8e972f3734b05 diff --git a/octave_packages/control-2.3.52/obsvf.m b/octave_packages/control-2.3.52/obsvf.m new file mode 100644 index 0000000..fdcec71 --- /dev/null +++ b/octave_packages/control-2.3.52/obsvf.m @@ -0,0 +1,77 @@ +## Copyright (C) 2010 Benjamin Fernandez +## Copyright (C) 2011 Lukas F. Reichlin +## +## This file is part of LTI Syncope. +## +## LTI Syncope is free software: you can redistribute it and/or modify +## it under the terms of the GNU General Public License as published by +## the Free Software Foundation, either version 3 of the License, or +## (at your option) any later version. +## +## LTI Syncope is distributed in the hope that it will be useful, +## but WITHOUT ANY WARRANTY; without even the implied warranty of +## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +## GNU General Public License for more details. +## +## You should have received a copy of the GNU General Public License +## along with LTI Syncope. If not, see . + +## -*- texinfo -*- +## @deftypefn{Function File} {[@var{sysbar}, @var{T}, @var{K}] =} obsvf (@var{sys}) +## @deftypefnx{Function File} {[@var{sysbar}, @var{T}, @var{K}] =} obsvf (@var{sys}, @var{tol}) +## @deftypefnx{Function File} {[@var{Abar}, @var{Bbar}, @var{Cbar}, @var{T}, @var{K}] =} obsvf (@var{A}, @var{B}, @var{C}) +## @deftypefnx{Function File} {[@var{Abar}, @var{Bbar}, @var{Cbar}, @var{T}, @var{K}] =} obsvf (@var{A}, @var{B}, @var{C}, @var{TOL}) +## If Ob=obsv(A,C) has rank r <= n = SIZE(A,1), then there is a +## similarity transformation Tc such that To = [t1;t2] where t1 is c +## and t2 is orthogonal to t1 +## +## @example +## @group +## Abar = To \ A * To , Bbar = To \ B , Cbar = C * To +## @end group +## @end example +## +## and the transformed system has the form +## +## @example +## @group +## | Ao 0 | | Bo | +## Abar = |----------|, Bbar = | --- |, Cbar = [Co | 0 ]. +## | A21 Ano| | Bno | +## @end group +## @end example +## +## where (Ao,Bo) is observable, and Co(sI-Ao)^(-1)Bo = C(sI-A)^(-1)B. And +## system is detectable if Ano has no eigenvalues in the right +## half plane. The last output K is a vector of length n containing the +## number of observable states. +## @end deftypefn + +## Author: Benjamin Fernandez +## Created: 2010-05-02 +## Version: 0.1 + +function [ac, bc, cc, z, ncont] = obsvf (a, b = [], c, tol = []) + + if (nargin < 1 || nargin > 4) + print_usage (); + endif + + if (isa (a, "lti")) + if (nargin > 2) + print_usage (); + endif + [ac, bc, cc] = ctrbf (a.', b); # [sysbar, z, ncont] = ctrbf (sys.', tol); + ac = ac.'; + z = ncont = []; + else + if (nargin < 3) + print_usage (); + endif + [ac, tmp, cc, z, ncont] = ctrbf (a.', c.', b.', tol); + ac = ac.'; + bc = cc.'; + cc = tmp.'; + endif + +endfunction