From: <sla...@us...> - 2009-11-30 00:18:43
|
Revision: 6556 http://octave.svn.sourceforge.net/octave/?rev=6556&view=rev Author: slackydeb Date: 2009-11-30 00:16:15 +0000 (Mon, 30 Nov 2009) Log Message: ----------- control: __axis2dlim__: merge from control-oo. Modified Paths: -------------- trunk/octave-forge/main/control/INDEX trunk/octave-forge/main/control/inst/bode.m trunk/octave-forge/main/control/inst/margin.m trunk/octave-forge/main/control/inst/nichols.m trunk/octave-forge/main/control/inst/nyquist.m trunk/octave-forge/main/control/inst/pzmap.m trunk/octave-forge/main/control/inst/rlocus.m trunk/octave-forge/main/control/inst/sigma.m Added Paths: ----------- trunk/octave-forge/main/control/inst/__axis2dlim__.m Removed Paths: ------------- trunk/octave-forge/main/control/inst/axis2dlim.m Modified: trunk/octave-forge/main/control/INDEX =================================================================== --- trunk/octave-forge/main/control/INDEX 2009-11-29 19:17:14 UTC (rev 6555) +++ trunk/octave-forge/main/control/INDEX 2009-11-30 00:16:15 UTC (rev 6556) @@ -65,7 +65,7 @@ lsim place dkalman h2syn acker Miscellaneous - axis2dlim prompt sortcom swap run_cmd + prompt sortcom swap run_cmd strappend listidx packedform sysidx Obsolete dezero dlqg minfo packsys unpacksys swaprows swapcols rotg qzval @@ -76,6 +76,7 @@ __bodquist__ __freqresp__ __stepimp__ __abcddims__ __syschnamesl__ __syscont_disc__ __sysdefioname__ __sysdefstname__ __sysgroupn__ __tf2sysl__ __zp2ssg2__ __outlist__ __zgpbal__ + __axis2dlim__ Compatibility filt= use <f>tf2sys</f> zpk= use <f>zp</f> Copied: trunk/octave-forge/main/control/inst/__axis2dlim__.m (from rev 6555, trunk/octave-forge/main/control/inst/axis2dlim.m) =================================================================== --- trunk/octave-forge/main/control/inst/__axis2dlim__.m (rev 0) +++ trunk/octave-forge/main/control/inst/__axis2dlim__.m 2009-11-30 00:16:15 UTC (rev 6556) @@ -0,0 +1,71 @@ +## Copyright (C) 1998, 2000, 2004, 2005, 2007 +## Auburn University. All rights reserved. +## +## +## This program 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. +## +## This program 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 this program; see the file COPYING. If not, see +## <http://www.gnu.org/licenses/>. + +## -*- texinfo -*- +## @deftypefn {Function File} {} __axis2dlim__ (@var{axdata}) +## Determine axis limits for 2-D data (column vectors); leaves a 10% +## margin around the plots. +## Inserts margins of +/- 0.1 if data is one-dimensional +## (or a single point). +## +## @strong{Input} +## @table @var +## @item axdata +## @var{n} by 2 matrix of data [@var{x}, @var{y}]. +## @end table +## +## @strong{Output} +## @table @var +## @item axvec +## Vector of axis limits appropriate for call to @command{axis} function. +## @end table +## @end deftypefn + +function axvec = __axis2dlim__ (axdata) + + if (nargin < 1 || isempty (axdata)) + axdata = 0; + endif + + ## compute axis limits + minv = min (axdata); + maxv = max (axdata); + delv = (maxv-minv)/2; # breadth of the plot + midv = (minv + maxv)/2; # midpoint of the plot + axmid = [midv(1), midv(1), midv(2), midv(2)]; + axdel = [-0.1, 0.1, -0.1, 0.1]; # default plot width (if less than 2-d data) + if (max (delv) == 0) + if (midv(1) != 0) + axdel(1:2) = [-0.1*midv(1), 0.1*midv(1)]; + endif + if (midv(2) != 0) + axdel(3:4) = [-0.1*midv(2), 0.1*midv(2)]; + endif + else + ## they're at least one-dimensional + tolv = max(1e-8, 1e-8*abs(midv)); + if (abs (delv(1)) >= tolv(1)) + axdel(1:2) = 1.1*[-delv(1),delv(1)]; + endif + if (abs (delv(2)) >= tolv(2)) + axdel(3:4) = 1.1*[-delv(2),delv(2)]; + endif + endif + axvec = axmid + axdel; + +endfunction Deleted: trunk/octave-forge/main/control/inst/axis2dlim.m =================================================================== --- trunk/octave-forge/main/control/inst/axis2dlim.m 2009-11-29 19:17:14 UTC (rev 6555) +++ trunk/octave-forge/main/control/inst/axis2dlim.m 2009-11-30 00:16:15 UTC (rev 6556) @@ -1,71 +0,0 @@ -## Copyright (C) 1998, 2000, 2004, 2005, 2007 -## Auburn University. All rights reserved. -## -## -## This program 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. -## -## This program 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 this program; see the file COPYING. If not, see -## <http://www.gnu.org/licenses/>. - -## -*- texinfo -*- -## @deftypefn {Function File} {} axis2dlim (@var{axdata}) -## Determine axis limits for 2-D data (column vectors); leaves a 10% -## margin around the plots. -## Inserts margins of +/- 0.1 if data is one-dimensional -## (or a single point). -## -## @strong{Input} -## @table @var -## @item axdata -## @var{n} by 2 matrix of data [@var{x}, @var{y}]. -## @end table -## -## @strong{Output} -## @table @var -## @item axvec -## Vector of axis limits appropriate for call to @command{axis} function. -## @end table -## @end deftypefn - -function axvec = axis2dlim (axdata) - - if (nargin < 1 || isempty (axdata)) - axdata = 0; - endif - - ## compute axis limits - minv = min (axdata); - maxv = max (axdata); - delv = (maxv-minv)/2; # breadth of the plot - midv = (minv + maxv)/2; # midpoint of the plot - axmid = [midv(1), midv(1), midv(2), midv(2)]; - axdel = [-0.1, 0.1, -0.1, 0.1]; # default plot width (if less than 2-d data) - if (max (delv) == 0) - if (midv(1) != 0) - axdel(1:2) = [-0.1*midv(1), 0.1*midv(1)]; - endif - if (midv(2) != 0) - axdel(3:4) = [-0.1*midv(2), 0.1*midv(2)]; - endif - else - ## they're at least one-dimensional - tolv = max(1e-8, 1e-8*abs(midv)); - if (abs (delv(1)) >= tolv(1)) - axdel(1:2) = 1.1*[-delv(1),delv(1)]; - endif - if (abs (delv(2)) >= tolv(2)) - axdel(3:4) = 1.1*[-delv(2),delv(2)]; - endif - endif - axvec = axmid + axdel; - -endfunction Modified: trunk/octave-forge/main/control/inst/bode.m =================================================================== --- trunk/octave-forge/main/control/inst/bode.m 2009-11-29 19:17:14 UTC (rev 6555) +++ trunk/octave-forge/main/control/inst/bode.m 2009-11-30 00:16:15 UTC (rev 6556) @@ -166,7 +166,7 @@ semilogx (w, md); if (max_mag_positive) ylabel ("Gain in dB"); - axvec = axis2dlim ([w(:), md(:)]); + axvec = __axis2dlim__ ([w(:), md(:)]); axvec(1:2) = wv; axis (axvec); endif @@ -189,7 +189,7 @@ if (is_siso_sys) subplot (2, 1, 2); - axvec = axis2dlim ([w(:), phase(:)]); + axvec = __axis2dlim__ ([w(:), phase(:)]); axvec(1:2) = wv; semilogx (w, phase); axis (axvec); Modified: trunk/octave-forge/main/control/inst/margin.m =================================================================== --- trunk/octave-forge/main/control/inst/margin.m 2009-11-29 19:17:14 UTC (rev 6555) +++ trunk/octave-forge/main/control/inst/margin.m 2009-11-30 00:16:15 UTC (rev 6556) @@ -264,9 +264,9 @@ gamma_db = 20 * log10 (gamma); wv = [min(w), max(w)]; - ax_vec_mag = axis2dlim ([w(:), mag_db(:)]); + ax_vec_mag = __axis2dlim__ ([w(:), mag_db(:)]); ax_vec_mag(1:2) = wv; - ax_vec_pha = axis2dlim ([w(:), pha(:)]); + ax_vec_pha = __axis2dlim__ ([w(:), pha(:)]); ax_vec_pha(1:2) = wv; wgm = [w_gamma, w_gamma]; Modified: trunk/octave-forge/main/control/inst/nichols.m =================================================================== --- trunk/octave-forge/main/control/inst/nichols.m 2009-11-29 19:17:14 UTC (rev 6555) +++ trunk/octave-forge/main/control/inst/nichols.m 2009-11-30 00:16:15 UTC (rev 6556) @@ -139,7 +139,7 @@ __outlist__ (outname, " ")); endif - axis (axis2dlim ([phase(:), md(:)])); + axis (__axis2dlim__ ([phase(:), md(:)])); else mag2 = mag; phase2 = phase; Modified: trunk/octave-forge/main/control/inst/nyquist.m =================================================================== --- trunk/octave-forge/main/control/inst/nyquist.m 2009-11-29 19:17:14 UTC (rev 6555) +++ trunk/octave-forge/main/control/inst/nyquist.m 2009-11-30 00:16:15 UTC (rev 6556) @@ -152,7 +152,7 @@ inn{1}, outn{1}, w(1), w(end))); endif - axis (axis2dlim ([[realp(:), imagp(:)]; [realp(:), -imagp(:)]])); + axis (__axis2dlim__ ([[realp(:), imagp(:)]; [realp(:), -imagp(:)]])); ## check for interactive plots dnplot = 1; # assume done; will change later if atol is satisfied Modified: trunk/octave-forge/main/control/inst/pzmap.m =================================================================== --- trunk/octave-forge/main/control/inst/pzmap.m 2009-11-29 19:17:14 UTC (rev 6555) +++ trunk/octave-forge/main/control/inst/pzmap.m 2009-11-30 00:16:15 UTC (rev 6556) @@ -83,6 +83,6 @@ grid ("on"); ## compute axis limits - axis (axis2dlim ([zerdata; poldata])); + axis (__axis2dlim__ ([zerdata; poldata])); endfunction Modified: trunk/octave-forge/main/control/inst/rlocus.m =================================================================== --- trunk/octave-forge/main/control/inst/rlocus.m 2009-11-29 19:17:14 UTC (rev 6555) +++ trunk/octave-forge/main/control/inst/rlocus.m 2009-11-30 00:16:15 UTC (rev 6556) @@ -217,7 +217,7 @@ if (nargout == 0) rlpolv = vec(rlpol); axdata = [real(rlpolv), imag(rlpolv); real(olzer), imag(olzer)]; - axlim = axis2dlim (axdata); + axlim = __axis2dlim__ (axdata); rldata = [real(rlpolv), imag(rlpolv) ]; [stn, inname, outname] = sysgetsignals (sys); Modified: trunk/octave-forge/main/control/inst/sigma.m =================================================================== --- trunk/octave-forge/main/control/inst/sigma.m 2009-11-29 19:17:14 UTC (rev 6555) +++ trunk/octave-forge/main/control/inst/sigma.m 2009-11-30 00:16:15 UTC (rev 6556) @@ -166,7 +166,7 @@ sv_db = 20 * log10 (sv); ## Determine axes - ax_vec = axis2dlim ([[w(:), min(sv_db)(:)]; [w(:), max(sv_db)(:)]]); + ax_vec = __axis2dlim__ ([[w(:), min(sv_db)(:)]; [w(:), max(sv_db)(:)]]); ax_vec(1:2) = [min(w), max(w)]; ## Determine xlabel This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |