From: <par...@us...> - 2011-11-09 20:18:47
|
Revision: 9040 http://octave.svn.sourceforge.net/octave/?rev=9040&view=rev Author: paramaniac Date: 2011-11-09 20:18:40 +0000 (Wed, 09 Nov 2011) Log Message: ----------- control-devel: work on argument checking of model reduction commands (2) Modified Paths: -------------- trunk/octave-forge/extra/control-devel/inst/__ab09id_modred__.m trunk/octave-forge/extra/control-devel/inst/bstmodred.m trunk/octave-forge/extra/control-devel/inst/hnamodred.m Added Paths: ----------- trunk/octave-forge/extra/control-devel/inst/__check_tol__.m Modified: trunk/octave-forge/extra/control-devel/inst/__ab09id_modred__.m =================================================================== --- trunk/octave-forge/extra/control-devel/inst/__ab09id_modred__.m 2011-11-09 19:44:44 UTC (rev 9039) +++ trunk/octave-forge/extra/control-devel/inst/__ab09id_modred__.m 2011-11-09 20:18:40 UTC (rev 9040) @@ -89,16 +89,10 @@ ordsel = 0; case "tol1" - if (! is_real_scalar (val)) - error ("%smodred: argument %s must be a real scalar", method, varargin{k}); - endif - tol1 = val; + tol1 = __check_tol__ (val, "tol1"); case "tol2" - if (! is_real_scalar (val)) - error ("%smodred: argument %s must be a real scalar", method, varargin{k}); - endif - tol2 = val; + tol2 = __check_tol__ (val, "tol2"); case "alpha" alpha = __check_alpha__ (val, dt); Added: trunk/octave-forge/extra/control-devel/inst/__check_tol__.m =================================================================== --- trunk/octave-forge/extra/control-devel/inst/__check_tol__.m (rev 0) +++ trunk/octave-forge/extra/control-devel/inst/__check_tol__.m 2011-11-09 20:18:40 UTC (rev 9040) @@ -0,0 +1,30 @@ +## 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 <http://www.gnu.org/licenses/>. + +## -*- texinfo -*- +## check tolerance for model reduction commands + +## Author: Lukas Reichlin <luk...@gm...> +## Created: November 2011 + +function tol = __check_tol__ (tol, str = "") + + if (! is_real_scalar (tol)) + error ("modred: argument %s must be a real scalar", str); + endif + +endfunction \ No newline at end of file Modified: trunk/octave-forge/extra/control-devel/inst/bstmodred.m =================================================================== --- trunk/octave-forge/extra/control-devel/inst/bstmodred.m 2011-11-09 19:44:44 UTC (rev 9039) +++ trunk/octave-forge/extra/control-devel/inst/bstmodred.m 2011-11-09 20:18:40 UTC (rev 9040) @@ -86,20 +86,14 @@ ordsel = 0; case "tol1" - if (! is_real_scalar (val)) - error ("hnamodred: argument %s must be a real scalar", varargin{k}); - endif - tol1 = val; + tol1 = __check_tol__ (val, "tol1"); case "tol2" - if (! is_real_scalar (val)) - error ("hnamodred: argument %s must be a real scalar", varargin{k}); - endif - tol2 = val; + tol2 = __check_tol__ (val, "tol2"); case "alpha" alpha = __check_alpha__ (val, dt); - + case "beta" if (! issample (val, 0)) error ("bstmodred: argument %s must be BETA >= 0", varargin{k}); Modified: trunk/octave-forge/extra/control-devel/inst/hnamodred.m =================================================================== --- trunk/octave-forge/extra/control-devel/inst/hnamodred.m 2011-11-09 19:44:44 UTC (rev 9039) +++ trunk/octave-forge/extra/control-devel/inst/hnamodred.m 2011-11-09 20:18:40 UTC (rev 9040) @@ -96,16 +96,10 @@ ordsel = 0; case "tol1" - if (! is_real_scalar (val)) - error ("hnamodred: argument %s must be a real scalar", varargin{k}); - endif - tol1 = val; + tol1 = __check_tol__ (val, "tol1"); case "tol2" - if (! is_real_scalar (val)) - error ("hnamodred: argument %s must be a real scalar", varargin{k}); - endif - tol2 = val; + tol2 = __check_tol__ (val, "tol2"); case "alpha" alpha = __check_alpha__ (val, dt); This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |