changeset 3882:c8c1ead8474f

[project @ 2002-04-02 18:25:48 by jwe]
author jwe
date Tue, 02 Apr 2002 18:25:48 +0000
parents c34d631dee18
children 69b6bd271277
files scripts/ChangeLog scripts/control/system/starp.m scripts/image/imagesc.m scripts/plot/contour.m
diffstat 4 files changed, 25 insertions(+), 15 deletions(-) [+]
line wrap: on
line diff
--- a/scripts/ChangeLog
+++ b/scripts/ChangeLog
@@ -1,3 +1,13 @@
+2002-04-02  Paul Kienzle <pkienzle@users.sf.net>
+
+	* plot/contour.m: Set default number of levels for contour(x,y,z).
+
+	* control/system/starp.m: Leave more of the documentation
+	processing to texinfo and less to the @format block.
+
+	* image/imagesc.m: Only display image if no output is requested.
+	Code tidying.
+
 2002-03-07  Paul Kienzle  <pkienzle@kienzle.powernet.co.uk>
  
  	* statistics/base/center.m: Accept and return empty matrix.
--- a/scripts/control/system/starp.m
+++ b/scripts/control/system/starp.m
@@ -17,11 +17,9 @@
 ## Software Foundation, 59 Temple Place, Suite 330, Boston, MA 02111 USA.
 
 ## -*- texinfo -*-
-## @deftypefn {Function File} {} starp (@var{inputs})
+## @deftypefn {Function File} {} starp (@var{P}, @var{K}, @var{ny}, @var{nu})
 ## @format
 ##
-## sys = starp(P, K, ny, nu)
-##
 ## Redheffer star product or upper/lower LFT, respectively.
 ##
 ##
--- a/scripts/image/imagesc.m
+++ b/scripts/image/imagesc.m
@@ -34,7 +34,7 @@
 ## Created: July 1994
 ## Adapted-By: jwe
 
-function B = imagesc (x, y, A, zoom)
+function ret = imagesc (x, y, A, zoom)
 
   if (nargin < 1 || nargin > 4)
     usage ("imagesc (matrix, zoom) or imagesc (x, y, matrix, zoom)");
@@ -50,21 +50,20 @@
     zoom = [];
   endif
 
-  [high, wide] = size (A);
-
-  maxval = max (max (A));
-  minval = min (min (A));
-
-  ## Rescale matrix so that all values are in the range 0 to
-  ## length (colormap) inclusive.
+  maxval = max (A(:));
+  minval = min (A(:));
 
   if (maxval == minval)
-    B = ones (high, wide);
+    B = ones (size (A));
   else
     ## Rescale values to between 1 and length (colormap) inclusive.
     B = round ((A - minval) / (maxval - minval) * (rows (colormap) - 1)) + 1;
   endif
 
-  image (x, y, B, zoom);
+  if (nargout == 0)
+    image (x, y, B, zoom);
+  else
+    ret = B;
+  endif
 
 endfunction
--- a/scripts/plot/contour.m
+++ b/scripts/plot/contour.m
@@ -62,7 +62,10 @@
     else
       error ("contour: argument must be a matrix");
     endif
-  elseif (nargin == 4)
+  elseif (nargin == 3 || nargin == 4)
+    if (nargin == 3)
+      n = 10;
+    endif
     if (is_vector (x) && is_vector (y) && is_matrix (z))
       xlen = length (x);
       ylen = length (y);
@@ -104,7 +107,7 @@
       error ("contour: x and y must be vectors and z must be a matrix");
     endif
   else
-    usage ("contour (z, levels, x, y)");
+    usage ("contour (z, x, y, levels)");
   endif
 
 endfunction