changeset 6447:3f79532415b5

[project @ 2007-03-24 00:00:31 by jwe]
author jwe
date Sat, 24 Mar 2007 00:00:31 +0000
parents f82f516c8a00
children 2110cc251779
files scripts/ChangeLog scripts/control/base/bode.m scripts/miscellaneous/dump_prefs.m scripts/plot/axis.m scripts/quaternion/demoquat.m scripts/quaternion/qcoordinate_plot.m scripts/statistics/base/ppplot.m scripts/statistics/base/qqplot.m
diffstat 8 files changed, 84 insertions(+), 81 deletions(-) [+]
line wrap: on
line diff
--- a/scripts/ChangeLog	Fri Mar 23 21:20:21 2007 +0000
+++ b/scripts/ChangeLog	Sat Mar 24 00:00:31 2007 +0000
@@ -1,6 +1,18 @@
 2007-03-23  John W. Eaton  <jwe@octave.org>
 
-	* sparse/spy.m: Update plotting code.
+	* control/base/bode.m, quaternion/demoquat.m,
+	quaternion/qcoordinate_plot.m, statistics/base/qqplot.m,
+	statistics/base/ppplot.m, sparse/spy.m:
+	Update plotting code.
+
+	* control/base/bode.m: Unwrap phase angle.
+
+	* miscellaneous/dump_prefs.m: Remove automatic_replot from the list.
+
+	* plot/axis.m: Don't check automatic_replot, or call replot.
+
+	* quaternion/demoquat.m: Delete comments with obsolete plotting
+	commands.
 
 	* plot/__pltopt1__.m: Handle "@" marker same as "+".
 	Handle numeric color specs.
--- a/scripts/control/base/bode.m	Fri Mar 23 21:20:21 2007 +0000
+++ b/scripts/control/base/bode.m	Sat Mar 24 00:00:31 2007 +0000
@@ -108,19 +108,19 @@
 function [mag_r, phase_r, w_r] = bode (sys, w, outputs, inputs, plot_style)
 
   ## check number of input arguments given
-  if (nargin < 1 | nargin > 5)
+  if (nargin < 1 || nargin > 5)
     print_usage ();
   endif
-  if(nargin < 2)
+  if (nargin < 2)
     w = [];
   endif
-  if(nargin < 3)
+  if (nargin < 3)
     outputs = [];
   endif
-  if(nargin < 4)
+  if (nargin < 4)
     inputs = [];
   endif
-  if(nargin < 5)
+  if (nargin < 5)
     plot_style = "dB";
   endif
 
@@ -133,75 +133,77 @@
   endif
 
   [f, w, sys] = __bodquist__ (sys, w, outputs, inputs, "bode");
-  bode_nin = sysdimensions(sys,"in");
-  bode_nout = sysdimensions(sys,"out");
+  bode_nin = sysdimensions (sys, "in");
+  bode_nout = sysdimensions (sys, "out");
 
-  [stname,inname,outname] = sysgetsignals(sys);
-  systsam = sysgettsam(sys);
+  [stname, inname, outname] = sysgetsignals (sys);
+  systsam = sysgettsam (sys);
 
   ## Get the magnitude and phase of f.
-  mag = abs(f);
-  phase = unwrap (arg(f)*180.0/pi);
+  mag = abs (f);
+  phase = unwrap (arg (f)) * 180.0 / pi;
 
   if (nargout < 1),
     ## Plot the information
-    save_automatic_replot = automatic_replot;
-    unwind_protect
-      automatic_replot(0);
-      if(is_digital(sys))
-	xlstr = ["Digital frequency w=rad/sec.  pi/T=",num2str(pi/systsam)];
-	tistr = "(exp(jwT)) ";
-      else
-	xlstr = "Frequency in rad/sec";
-	tistr = "(jw)";
-      endif
-      xlabel(xlstr);
-      if(is_siso(sys))
-	subplot(2,1,1);
-	title(["|[Y/U]",tistr,"|, u=", inname{1},", y=",outname{1}]);
-      else
-	title([ "||Y(", tistr, ")/U(", tistr, ")||"]);
-	disp("MIMO plot from")
-	disp(__outlist__(inname,"     "));
-	disp("to")
-	disp(__outlist__(outname,"    "));
-      endif
-      wv = [min(w), max(w)];
-      if(do_db_plot && max(mag) > 0)
-	ylabel("Gain in dB");
-	md = 20*log10(mag);
-	axvec = axis2dlim([vec(w),vec(md)]);
+    if (is_digital (sys))
+      xlstr = sprintf ("Digital frequency w=rad/sec.  pi/T=%g", pi/systsam);
+      tistr = "(exp(jwT)) ";
+    else
+      xlstr = "Frequency in rad/sec";
+      tistr = "(jw)";
+    endif
+
+    wv = [min(w), max(w)];
+
+    is_siso_sys = is_siso (sys);
+    max_mag_positive = max (mag) > 0;
+
+    if (is_siso_sys)
+      subplot (2, 1, 1);
+    endif
+
+    if (do_db_plot)
+      md = 20 * log10 (mag);
+      semilogx (w, md);
+      if (max_mag_positive)
+	ylabel ("Gain in dB");
+	axvec = axis2dlim ([w(:), md(:)]);
 	axvec(1:2) = wv;
-	axis(axvec);
-      else
-	ylabel("Gain |Y/U|")
-	md = mag;
-      endif
-
-      grid("on");
-      if (do_db_plot)
-	semilogx(w,md);
-      else
-	loglog(w,md);
+	axis (axvec);
       endif
-      if (is_siso(sys))
-	subplot(2,1,2);
-	axvec = axis2dlim([vec(w),vec(phase)]);
-	axvec(1:2) = wv;
-	axis(axvec);
-	xlabel(xlstr);
-	ylabel("Phase in deg");
-	title([ "phase([Y/U]", tistr, ...
-	   "), u=", inname{1},", y=",outname{1}]);
-	grid("on");
-	semilogx(w,phase);
-      endif
-    unwind_protect_cleanup
-      automatic_replot(save_automatic_replot);
-    end_unwind_protect
+    else
+      loglog (w, mag);
+      ylabel ("Gain |Y/U|")
+    endif
+    xlabel (xlstr);
+    grid ("on");
+
+    if (is_siso_sys)
+      title (sprintf ("|[Y/U]%s|, u=%s, y=%s", tistr, inname{1}, outname{1}));
+    else
+      title (sprintf ("||Y(%s)/U(%s)||", tistr, tistr));
+      disp ("MIMO plot from")
+      disp (__outlist__(inname,"     "));
+      disp ("to")
+      disp (__outlist__(outname,"    "));
+    endif
+
+    if (is_siso_sys)
+      subplot (2, 1, 2);
+      axvec = axis2dlim ([w(:), phase(:)]);
+      axvec(1:2) = wv;
+      semilogx (w, phase);
+      axis (axvec);
+      xlabel (xlstr);
+      ylabel ("Phase in deg");
+      title (sprintf ("phase([Y/U]%s), u=%s, y=%s",
+		      tistr, inname{1}, outname{1}));
+      grid ("on");
+    endif
   else
     mag_r = mag;
     phase_r = phase;
     w_r = w;
   endif
+
 endfunction
--- a/scripts/miscellaneous/dump_prefs.m	Fri Mar 23 21:20:21 2007 +0000
+++ b/scripts/miscellaneous/dump_prefs.m	Sat Mar 24 00:00:31 2007 +0000
@@ -46,7 +46,6 @@
               "PS1";
               "PS2";
               "PS4";
-              "automatic_replot";
               "beep_on_error";
               "completion_append_char";
               "crash_dumps_octave_core";
--- a/scripts/plot/axis.m	Fri Mar 23 21:20:21 2007 +0000
+++ b/scripts/plot/axis.m	Sat Mar 24 00:00:31 2007 +0000
@@ -254,9 +254,8 @@
 
   if (nargin > 1)
     axis (varargin{:});
-  elseif (automatic_replot)
-    replot ();
   endif
+
 endfunction
 
 %!demo
--- a/scripts/quaternion/demoquat.m	Fri Mar 23 21:20:21 2007 +0000
+++ b/scripts/quaternion/demoquat.m	Sat Mar 24 00:00:31 2007 +0000
@@ -228,7 +228,6 @@
 
       # construct yaw-pitch-roll cartoon
       for kk=1:length(myth(1,:))
-	figure(kk)
 	thy = myth(1,kk);
 	thp = myth(2,kk);
 
@@ -243,16 +242,11 @@
 	[vv,th] = quaternion(qb);
 	printf("      = (vector) = [%8.4f %8.4f %8.4f], th=%5.2f deg\n", ...
 	  vv(1), vv(2), vv(3), th*180/pi);
-
+	fflush (stdout);
 	qb = qmult(qb,qi);
 	title(sprintf("yaw=%5.2f deg, pitch=%5.2f deg",thy,thp))
 	qcoordinate_plot(qi,qb,qview);
-	# uncomment the next four lines to get eps output
-	#__gnuplot_set__ terminal postscript eps 
-	#eval(sprintf("__gnuplot_set__ output 'fig%d.eps'",kk));
-	#replot
-	#__gnuplot_set__ terminal x11
-	#prompt
+	drawnow ();
       endfor
 
     case(quitopt)
--- a/scripts/quaternion/qcoordinate_plot.m	Fri Mar 23 21:20:21 2007 +0000
+++ b/scripts/quaternion/qcoordinate_plot.m	Sat Mar 24 00:00:31 2007 +0000
@@ -110,8 +110,7 @@
   jbv = jnk(:,2);
   kbv = jnk(:,3);
 
-  __gnuplot_set__ size square
-  axis ([-2, 2, -2, 2]);
+  axis ([-2, 2, -2, 2], "square");
 
   [vv, theta] = quaternion (qb);
 
--- a/scripts/statistics/base/ppplot.m	Fri Mar 23 21:20:21 2007 +0000
+++ b/scripts/statistics/base/ppplot.m	Sat Mar 24 00:00:31 2007 +0000
@@ -68,9 +68,8 @@
   endif
 
   if (nargout == 0)
+    plot (p, y);
     axis ([0, 1, 0, 1]);
-    __gnuplot_set__ nokey;
-    plot (p, y);
   endif
 
 endfunction
--- a/scripts/statistics/base/qqplot.m	Fri Mar 23 21:20:21 2007 +0000
+++ b/scripts/statistics/base/qqplot.m	Sat Mar 24 00:00:31 2007 +0000
@@ -78,10 +78,9 @@
   endif
 
   if (nargout == 0)
+    plot (q, s);
     xlabel (q_label);
     ylabel ("sample points");
-    __gnuplot_set__ nokey;
-    plot (q, s);
   endif
 
 endfunction