From: <par...@us...> - 2010-09-15 23:43:09
|
Revision: 7735 http://octave.svn.sourceforge.net/octave/?rev=7735&view=rev Author: paramaniac Date: 2010-09-15 23:43:02 +0000 (Wed, 15 Sep 2010) Log Message: ----------- control: extend support for descriptor models Modified Paths: -------------- trunk/octave-forge/main/control/inst/@lti/dssdata.m trunk/octave-forge/main/control/inst/@lti/ssdata.m trunk/octave-forge/main/control/inst/@ss/__minreal__.m trunk/octave-forge/main/control/inst/@ss/__sys_data__.m trunk/octave-forge/main/control/inst/@ss/__sys_inverse__.m trunk/octave-forge/main/control/inst/@ss/__zero__.m trunk/octave-forge/main/control/inst/ltimodels.m Modified: trunk/octave-forge/main/control/inst/@lti/dssdata.m =================================================================== --- trunk/octave-forge/main/control/inst/@lti/dssdata.m 2010-09-15 22:34:50 UTC (rev 7734) +++ trunk/octave-forge/main/control/inst/@lti/dssdata.m 2010-09-15 23:43:02 UTC (rev 7735) @@ -32,7 +32,7 @@ sys = ss (sys); endif - [a, b, c, d] = __sys_data__ (sys); + [a, b, c, d, e] = __sys_data__ (sys); if (isempty (flg)) # dssdata (sys, []) e = []; # don't return eye for ss models Modified: trunk/octave-forge/main/control/inst/@lti/ssdata.m =================================================================== --- trunk/octave-forge/main/control/inst/@lti/ssdata.m 2010-09-15 22:34:50 UTC (rev 7734) +++ trunk/octave-forge/main/control/inst/@lti/ssdata.m 2010-09-15 23:43:02 UTC (rev 7735) @@ -1,4 +1,4 @@ -## Copyright (C) 2009 Lukas F. Reichlin +## Copyright (C) 2009 - 2010 Lukas F. Reichlin ## ## This file is part of LTI Syncope. ## @@ -22,7 +22,7 @@ ## Author: Lukas Reichlin <luk...@gm...> ## Created: September 2009 -## Version: 0.1 +## Version: 0.2 function [a, b, c, d, tsam] = ssdata (sys) @@ -30,8 +30,17 @@ sys = ss (sys); endif - [a, b, c, d] = __sys_data__ (sys); + [a, b, c, d, e] = __sys_data__ (sys); + if (! isempty (e)) + if (rcond (e) < eps) # check for singularity + error ("ss: ssdata: descriptor matrice ""e"" singular"); + endif + + a = e \ a; + b = e \ b; + endif + tsam = sys.tsam; endfunction \ No newline at end of file Modified: trunk/octave-forge/main/control/inst/@ss/__minreal__.m =================================================================== --- trunk/octave-forge/main/control/inst/@ss/__minreal__.m 2010-09-15 22:34:50 UTC (rev 7734) +++ trunk/octave-forge/main/control/inst/@ss/__minreal__.m 2010-09-15 23:43:02 UTC (rev 7735) @@ -25,6 +25,10 @@ function retsys = __minreal__ (sys, tol) + if (! isempty (sys.e)) + error ("ss: zero: dss models not supported yet"); + endif + if (tol == "def") tol = 0; elseif (tol > 1) Modified: trunk/octave-forge/main/control/inst/@ss/__sys_data__.m =================================================================== --- trunk/octave-forge/main/control/inst/@ss/__sys_data__.m 2010-09-15 22:34:50 UTC (rev 7734) +++ trunk/octave-forge/main/control/inst/@ss/__sys_data__.m 2010-09-15 23:43:02 UTC (rev 7735) @@ -1,4 +1,4 @@ -## Copyright (C) 2009 Lukas F. Reichlin +## Copyright (C) 2009 - 2010 Lukas F. Reichlin ## ## This file is part of LTI Syncope. ## @@ -20,14 +20,15 @@ ## Author: Lukas Reichlin <luk...@gm...> ## Created: September 2009 -## Version: 0.1 +## Version: 0.2 -function [a, b, c, d, stname] = __sys_data__ (sys) +function [a, b, c, d, e, stname] = __sys_data__ (sys) a = sys.a; b = sys.b; c = sys.c; d = sys.d; + e = sys.e; stname = sys.stname; endfunction \ No newline at end of file Modified: trunk/octave-forge/main/control/inst/@ss/__sys_inverse__.m =================================================================== --- trunk/octave-forge/main/control/inst/@ss/__sys_inverse__.m 2010-09-15 22:34:50 UTC (rev 7734) +++ trunk/octave-forge/main/control/inst/@ss/__sys_inverse__.m 2010-09-15 23:43:02 UTC (rev 7735) @@ -1,4 +1,4 @@ -## Copyright (C) 2009 Lukas F. Reichlin +## Copyright (C) 2009 - 2010 Lukas F. Reichlin ## ## This file is part of LTI Syncope. ## @@ -20,7 +20,7 @@ ## Author: Lukas Reichlin <luk...@gm...> ## Created: October 2009 -## Version: 0.1 +## Version: 0.2 function sys = __sys_inverse__ (sys) @@ -28,21 +28,34 @@ b = sys.b; c = sys.c; d = sys.d; + e = sys.e; - if (rcond (d) < eps) - error ("ss: sys_inverse: inverse is not proper, case not implemented yet"); - else + if (! isempty (e) || rcond (d) < eps) # dss or strictly proper ss + + n = rows (a); + m = columns (b); # p = m (square system) + + if (isempty (e)) # avoid testing twice? + e = eye (n); + endif + + sys.a = [a, b; c, d]; + sys.b = [zeros(n, m); -eye(m)]; + sys.c = [zeros(m, n), eye(m)]; + sys.d = zeros (m); + sys.e = [e, zeros(n, m); zeros(m, n+m)]; + + sys.stname = repmat ({""}, n+m, 1); + + else # proper ss + di = inv (d); - f = a - b * di * c; - g = b * di; - h = -di * c; - j = di; + sys.a = a - b * di * c; + sys.b = -b * di; + sys.c = di * c; + sys.d = di; + endif - sys.a = f; - sys.b = g; - sys.c = h; - sys.d = j; - endfunction \ No newline at end of file Modified: trunk/octave-forge/main/control/inst/@ss/__zero__.m =================================================================== --- trunk/octave-forge/main/control/inst/@ss/__zero__.m 2010-09-15 22:34:50 UTC (rev 7734) +++ trunk/octave-forge/main/control/inst/@ss/__zero__.m 2010-09-15 23:43:02 UTC (rev 7735) @@ -26,6 +26,10 @@ function [zer, gain] = __zero__ (sys) + if (! isempty (sys.e)) + error ("ss: zero: dss models not supported yet"); + endif + [zer, gain] = slab08nd (sys.a, sys.b, sys.c, sys.d); endfunction \ No newline at end of file Modified: trunk/octave-forge/main/control/inst/ltimodels.m =================================================================== --- trunk/octave-forge/main/control/inst/ltimodels.m 2010-09-15 22:34:50 UTC (rev 7734) +++ trunk/octave-forge/main/control/inst/ltimodels.m 2010-09-15 23:43:02 UTC (rev 7735) @@ -298,7 +298,8 @@ ## inverse of state-space models ## test from SLICOT AB07ND -## note the negative signs in Me for compatibility reasons +## result differs intentionally from a commercial +## implementation of an octave-like language %!shared M, Me %! A = [ 1.0 2.0 0.0 %! 4.0 -1.0 0.0 @@ -333,7 +334,7 @@ %! De = [ 0.2500 0.0000 %! 0.0000 1.0000 ]; %! -%! Me = [Ae, -Be; -Ce, De]; +%! Me = [Ae, Be; Ce, De]; # Me = [Ae, -Be; -Ce, De]; %! %!assert (M, Me, 1e-4); This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |