From: <par...@us...> - 2010-09-25 16:00:32
|
Revision: 7767 http://octave.svn.sourceforge.net/octave/?rev=7767&view=rev Author: paramaniac Date: 2010-09-25 16:00:26 +0000 (Sat, 25 Sep 2010) Log Message: ----------- control: improve argument checks Modified Paths: -------------- trunk/octave-forge/main/control/inst/@lti/feedback.m trunk/octave-forge/main/control/inst/@ss/ss.m trunk/octave-forge/main/control/inst/@tf/tf.m trunk/octave-forge/main/control/inst/place.m trunk/octave-forge/main/control/inst/strseq.m Modified: trunk/octave-forge/main/control/inst/@lti/feedback.m =================================================================== --- trunk/octave-forge/main/control/inst/@lti/feedback.m 2010-09-25 14:35:25 UTC (rev 7766) +++ trunk/octave-forge/main/control/inst/@lti/feedback.m 2010-09-25 16:00:26 UTC (rev 7767) @@ -142,7 +142,7 @@ function fbsign = checkfbsign (fbsign) - if (isnumeric (fbsign)) + if (is_real_scalar (fbsign)) fbsign = sign (fbsign); elseif (ischar (fbsign)) if (strcmp (fbsign, "+")) Modified: trunk/octave-forge/main/control/inst/@ss/ss.m =================================================================== --- trunk/octave-forge/main/control/inst/@ss/ss.m 2010-09-25 14:35:25 UTC (rev 7766) +++ trunk/octave-forge/main/control/inst/@ss/ss.m 2010-09-25 16:00:26 UTC (rev 7767) @@ -75,7 +75,7 @@ [sys, alti] = __sys2ss__ (a); sys.lti = alti; # preserve lti properties return; - elseif (isnumeric (a)) # static gain + elseif (is_real_matrix (a)) # static gain d = a; a = []; b = zeros (0, columns (d)); Modified: trunk/octave-forge/main/control/inst/@tf/tf.m =================================================================== --- trunk/octave-forge/main/control/inst/@tf/tf.m 2010-09-25 14:35:25 UTC (rev 7766) +++ trunk/octave-forge/main/control/inst/@tf/tf.m 2010-09-25 16:00:26 UTC (rev 7767) @@ -80,7 +80,7 @@ [sys, numlti] = __sys2tf__ (num); sys.lti = numlti; # preserve lti properties return; - elseif (isnumeric (num)) # static gain + elseif (is_real_vector (num)) # static gain num = num2cell (num); num = __vec2tfpoly__ (num); [p, m] = size (num); Modified: trunk/octave-forge/main/control/inst/place.m =================================================================== --- trunk/octave-forge/main/control/inst/place.m 2010-09-25 14:35:25 UTC (rev 7766) +++ trunk/octave-forge/main/control/inst/place.m 2010-09-25 16:00:26 UTC (rev 7767) @@ -90,14 +90,14 @@ if (nargin < 3) # nargin > 5 already tested print_usage (); else - if (! isnumeric (a) || ! isnumeric (b) || ! issquare (a) || rows (a) != rows (b)) + if (! is_real_square_matrix (a) || ! is_real_matrix (b) || rows (a) != rows (b)) error ("place: matrices a and b not conformal"); endif discrete = 0; # assume continuous system endif endif - if (! isnumeric (p) || ! isvector (p) || isempty (p)) + if (! isnumeric (p) || ! isvector (p) || isempty (p)) # p could be complex error ("place: p must be a vector"); endif Modified: trunk/octave-forge/main/control/inst/strseq.m =================================================================== --- trunk/octave-forge/main/control/inst/strseq.m 2010-09-25 14:35:25 UTC (rev 7766) +++ trunk/octave-forge/main/control/inst/strseq.m 2010-09-25 16:00:26 UTC (rev 7767) @@ -1,4 +1,4 @@ -## Copyright (C) 2009 Lukas F. Reichlin +## Copyright (C) 2009 - 2010 Lukas F. Reichlin ## ## This file is part of LTI Syncope. ## @@ -28,7 +28,7 @@ ## Author: Lukas Reichlin <luk...@gm...> ## Created: September 2009 -## Version: 0.1 +## Version: 0.2 function strvec = strseq (str, idx) @@ -36,11 +36,8 @@ print_usage (); endif - n = numel (idx); - strvec = cell (n, 1); + idx = reshape (num2cell (idx), [], 1); - for k = 1 : n - strvec{k, 1} = sprintf ("%s%d", str, idx(k)); - endfor + strvec = cellfun (@(x) sprintf ("%s%d", str, x), idx, "uniformoutput", false); endfunction \ No newline at end of file This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |