From: <par...@us...> - 2010-09-13 11:08:45
|
Revision: 7707 http://octave.svn.sourceforge.net/octave/?rev=7707&view=rev Author: paramaniac Date: 2010-09-13 11:08:39 +0000 (Mon, 13 Sep 2010) Log Message: ----------- control: improve argument checking Modified Paths: -------------- trunk/octave-forge/main/control/inst/isctrb.m trunk/octave-forge/main/control/inst/isdetectable.m trunk/octave-forge/main/control/inst/isobsv.m trunk/octave-forge/main/control/inst/isstabilizable.m trunk/octave-forge/main/control/src/slab01od.cc Modified: trunk/octave-forge/main/control/inst/isctrb.m =================================================================== --- trunk/octave-forge/main/control/inst/isctrb.m 2010-09-13 10:33:45 UTC (rev 7706) +++ trunk/octave-forge/main/control/inst/isctrb.m 2010-09-13 11:08:39 UTC (rev 7707) @@ -51,9 +51,9 @@ ## Author: Lukas Reichlin <luk...@gm...> ## Created: October 2009 -## Version: 0.2 +## Version: 0.2.1 -function [bool, u] = isctrb (a, b = 0, tol = 0) +function [bool, u] = isctrb (a, b = [], tol = []) if (nargin < 1 || nargin > 3) print_usage (); @@ -70,10 +70,10 @@ rows (a), columns (a), rows (b), columns (b)); endif - ## check tol dimensions - if (! isscalar (tol)) - error ("isctrb: tol(%dx%d) must be a scalar", - rows (tol), columns (tol)); + if (! isreal (tol) && ! isscalar (tol)) + error ("isctrb: tol must be a real scalar"); + elseif (isempty (tol)) + tol = 0; # default tolerance endif [ac, bc, u, ncont] = slab01od (a, b, tol); Modified: trunk/octave-forge/main/control/inst/isdetectable.m =================================================================== --- trunk/octave-forge/main/control/inst/isdetectable.m 2010-09-13 10:33:45 UTC (rev 7706) +++ trunk/octave-forge/main/control/inst/isdetectable.m 2010-09-13 11:08:39 UTC (rev 7707) @@ -56,7 +56,7 @@ ## Author: Lukas Reichlin <luk...@gm...> ## Created: October 2009 -## Version: 0.2 +## Version: 0.2.1 function bool = isdetectable (a, c = [], tol = [], dflg = 0) @@ -67,7 +67,7 @@ print_usage (); endif tol = c; - dflg = isdt (a); + dflg = ! isct (a); [a, b, c] = ssdata (a); elseif (nargin == 1) # isdetectable (a, c, ...) print_usage (); Modified: trunk/octave-forge/main/control/inst/isobsv.m =================================================================== --- trunk/octave-forge/main/control/inst/isobsv.m 2010-09-13 10:33:45 UTC (rev 7706) +++ trunk/octave-forge/main/control/inst/isobsv.m 2010-09-13 11:08:39 UTC (rev 7707) @@ -51,7 +51,7 @@ ## Author: Lukas Reichlin <luk...@gm...> ## Created: October 2009 -## Version: 0.2 +## Version: 0.2.1 function [bool, u] = isobsv (a, c = [], tol = []) @@ -67,11 +67,7 @@ print_usage (); endif - if (isempty (tol)) - [bool, u] = isctrb (a.', c.'); - else - [bool, u] = isctrb (a.', c.', tol); - endif + [bool, u] = isctrb (a.', c.', tol); endfunction Modified: trunk/octave-forge/main/control/inst/isstabilizable.m =================================================================== --- trunk/octave-forge/main/control/inst/isstabilizable.m 2010-09-13 10:33:45 UTC (rev 7706) +++ trunk/octave-forge/main/control/inst/isstabilizable.m 2010-09-13 11:08:39 UTC (rev 7707) @@ -66,7 +66,7 @@ ## Author: Lukas Reichlin <luk...@gm...> ## Created: October 2009 -## Version: 0.2 +## Version: 0.2.1 function bool = isstabilizable (a, b = [], tol = [], dflg = 0) @@ -77,7 +77,7 @@ print_usage (); endif tol = b; - dflg = isdt (a); + dflg = ! isct (a); [a, b] = ssdata (a); elseif (nargin == 1) # isstabilizable (a, b, ...) print_usage (); @@ -85,8 +85,10 @@ error ("isstabilizable: a must be square and conformal to b") endif - if (isempty (tol)) - tol = 0; + if (! isreal (tol) && ! isscalar (tol)) + error ("isstabilizable: tol must be a real scalar"); + elseif (isempty (tol)) + tol = 0; # default tolerance endif ## controllability staircase form Modified: trunk/octave-forge/main/control/src/slab01od.cc =================================================================== --- trunk/octave-forge/main/control/src/slab01od.cc 2010-09-13 10:33:45 UTC (rev 7706) +++ trunk/octave-forge/main/control/src/slab01od.cc 2010-09-13 11:08:39 UTC (rev 7707) @@ -117,7 +117,12 @@ if (info != 0) error ("slab01od: AB01OD returned info = %d", info); - + + // resize + a.resize (n, n); + b.resize (n, m); + u.resize (n, n); + // return values retval(0) = a; retval(1) = b; This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |