From: <par...@us...> - 2011-12-30 13:42:35
|
Revision: 9487 http://octave.svn.sourceforge.net/octave/?rev=9487&view=rev Author: paramaniac Date: 2011-12-30 13:42:29 +0000 (Fri, 30 Dec 2011) Log Message: ----------- control: finish ctrbf and obsvf Modified Paths: -------------- trunk/octave-forge/main/control/devel/ctrbf/makefile_ctrbf.m trunk/octave-forge/main/control/devel/ctrbf.m trunk/octave-forge/main/control/devel/makefile_staircase.m trunk/octave-forge/main/control/devel/obsvf.m Modified: trunk/octave-forge/main/control/devel/ctrbf/makefile_ctrbf.m =================================================================== --- trunk/octave-forge/main/control/devel/ctrbf/makefile_ctrbf.m 2011-12-29 23:37:26 UTC (rev 9486) +++ trunk/octave-forge/main/control/devel/ctrbf/makefile_ctrbf.m 2011-12-30 13:42:29 UTC (rev 9487) @@ -1,2 +1,4 @@ mkoctfile sltb01ud.cc \ - TB01UD.f MB01PD.f MB03OY.f MB01QD.f \ No newline at end of file + TB01UD.f MB01PD.f MB03OY.f MB01QD.f \ + "$(mkoctfile -p LAPACK_LIBS)" \ + "$(mkoctfile -p BLAS_LIBS)" Modified: trunk/octave-forge/main/control/devel/ctrbf.m =================================================================== --- trunk/octave-forge/main/control/devel/ctrbf.m 2011-12-29 23:37:26 UTC (rev 9486) +++ trunk/octave-forge/main/control/devel/ctrbf.m 2011-12-30 13:42:29 UTC (rev 9487) @@ -17,7 +17,9 @@ ## along with LTI Syncope. If not, see <http://www.gnu.org/licenses/>. ## -*- texinfo -*- -## @deftypefn{Function File} {[@var{Abar}, @var{Bbar}, @var{Cbar}, @var{T}, @var{K}] =} ctrbf (@var{A}, @var{B}, @var{C}) +## @deftypefn{Function File} {[@var{sysbar}, @var{T}, @var{K}] =} ctrbf (@var{sys}) +## @deftypefnx{Function File} {[@var{sysbar}, @var{T}, @var{K}] =} ctrbf (@var{sys}, @var{tol}) +## @deftypefnx{Function File} {[@var{Abar}, @var{Bbar}, @var{Cbar}, @var{T}, @var{K}] =} ctrbf (@var{A}, @var{B}, @var{C}) ## @deftypefnx{Function File} {[@var{Abar}, @var{Bbar}, @var{Cbar}, @var{T}, @var{K}] =} ctrbf (@var{A}, @var{B}, @var{C}, @var{TOL}) ## If Co=ctrb(A,B) has rank r <= n = SIZE(A,1), then there is a ## similarity transformation Tc such that Tc = [t1 t2] where t1 @@ -49,11 +51,28 @@ ## Created: 2010-04-30 ## Version: 0.1 -function [ac, bc, cc, z, ncont] = ctrbf (a, b, c, tol = []) +function [ac, bc, cc, z, ncont] = ctrbf (a, b = [], c, tol = []) - if (nargin < 3 || nargin > 4) + if (nargin < 1 || nargin > 4) print_usage (); endif + + islti = isa (a, "lti"); + + if (islti) + if (nargin > 2) + print_usage (); + endif + sys = a; + tol = b; + [a, b, c] = ssdata (sys); + else + if (nargin < 3) + print_usage (); + endif + sys = ss (a, b, c); + [a, b, c] = ssdata (sys); + endif if (isempty (tol)) tol = 0; # default tolerance @@ -63,6 +82,12 @@ [ac, bc, cc, z, ncont] = sltb01ud (a, b, c, tol); + if (islti) + ac = set (sys, "a", ac, "b", bc, "c", cc, "scaled", false); + bc = z; + cc = ncont; + endif + endfunction %!shared Ao, Bo, Co, Zo, Ae, Be, Ce, Ze, NCONT Modified: trunk/octave-forge/main/control/devel/makefile_staircase.m =================================================================== --- trunk/octave-forge/main/control/devel/makefile_staircase.m 2011-12-29 23:37:26 UTC (rev 9486) +++ trunk/octave-forge/main/control/devel/makefile_staircase.m 2011-12-30 13:42:29 UTC (rev 9487) @@ -30,5 +30,11 @@ "$(mkoctfile -p LAPACK_LIBS)" \ "$(mkoctfile -p BLAS_LIBS)" +## controllable block Hessenberg realization +mkoctfile sltb01ud.cc \ + TB01UD.f MB01PD.f MB03OY.f MB01QD.f \ + "$(mkoctfile -p LAPACK_LIBS)" \ + "$(mkoctfile -p BLAS_LIBS)" + system ("rm *.o"); cd (homedir); \ No newline at end of file Modified: trunk/octave-forge/main/control/devel/obsvf.m =================================================================== --- trunk/octave-forge/main/control/devel/obsvf.m 2011-12-29 23:37:26 UTC (rev 9486) +++ trunk/octave-forge/main/control/devel/obsvf.m 2011-12-30 13:42:29 UTC (rev 9487) @@ -1,21 +1,25 @@ -## Copyright (C) 2010 Benjamin Fernandez +## Copyright (C) 2010 Benjamin Fernandez +## Copyright (C) 2011 Lukas F. Reichlin ## -## This program is free software; you can redistribute it and/or modify +## 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 2 of the License, or +## the Free Software Foundation, either version 3 of the License, or ## (at your option) any later version. -## -## This program is distributed in the hope that it will be useful, +## +## 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 Octave; see the file COPYING. If not, see -## <http://www.gnu.org/licenses/>. +## along with LTI Syncope. If not, see <http://www.gnu.org/licenses/>. ## -*- texinfo -*- -## @deftypefn{Function File} {[@var{Abar}, @var{Bbar}, @var{Cbar}, @var{T}, @var{K}] =} obsvf (@var{A}, @var{B}, @var{C}) +## @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 @@ -45,26 +49,29 @@ ## Author: Benjamin Fernandez <benjas@benjas-laptop> ## Created: 2010-05-02 +## Version: 0.1 -function [Abar, Bbar, Cbar, T, K] = obsvf (A, B, C, TOL) +function [ac, bc, cc, z, ncont] = obsvf (a, b = [], c, tol = []) - if (nargin < 3 || nargin > 4) + if (nargin < 1 || nargin > 4) print_usage (); endif - - if (nargin == 3) - TOL = length (A) * norm (A, 1) * eps; + + 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 - Ob = obsv (A, C); - [nro, nco] = size (Ob); - rob = rank (Ob); - lr = nco - rob; - [U, S, V] = svd (Ob); - K = V(:, 1:rob); # Basis raw space - T = V; # [c; orth(c)]; - Abar = T \ A * T; - Bbar = T \ B; - Cbar = C * T; - -endfunction \ No newline at end of file +endfunction This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |