help-octave
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: rlocus/gnuplot problem


From: A. Scottedward Hodel
Subject: Re: rlocus/gnuplot problem
Date: Wed, 11 Apr 2007 10:33:55 -0500

This patch should fix the axis2dlim problem

eexmac143:~ hodelas$ diff -c /usr/local//share/octave/2.9.10/m/ control/util/axis2dlim.m axis2dlim.m *** /usr/local//share/octave/2.9.10/m/control/util/axis2dlim.m Tue Apr 10 14:46:24 2007
--- axis2dlim.m Wed Apr 11 10:32:59 2007
***************
*** 59,68 ****
      endif
    else
      ## they're at least one-dimensional
!     if(delv(1) != 0)
        axdel(1:2) = 1.1*[-delv(1),delv(1)];
      endif
!     if(delv(2) != 0)
        axdel(3:4) = 1.1*[-delv(2),delv(2)];
      endif
    endif
--- 59,69 ----
      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

A. Scottedward Hodel, 334 844-1854, fax 334 844-1809
address@hidden http://www.eng.auburn.edu/~hodelas



On Apr 10, 2007, at 3:32 PM, John W. Eaton wrote:

On 10-Apr-2007, A. Scottedward Hodel wrote:

| I'm using the recently updated rlocus function in octave 2.9.10 and
| have found a problem that I don't know how to fix.
| octave:2> rlocus(tf(1,[1,2,10]))
| ans = [](0x0)
| octave:3>
| gnuplot> plot "-" using ($1):($2) title "" with lines linestyle 1,
| "-" using ($1):($2) title "asymptotes" with lines linestyle 2, "-"
| using ($1):($2) title "locus" with lines linestyle 3, "-" using ($1): | ($2) title "" with lines linestyle 4, "-" using ($1):($2) title "open
| loop poles" with points linestyle 5;
|
|
|
|
|                          ^
|           line 462: Can't plot with an empty x range!
|
| The problem occurs when replotting with title, xlabel, or ylabel
| commands.  The error message above is not an artifiact; the root
| locus in this case is indeed a pair of vertical lines that go outward
| from poles at -1 +/- j3.  It appears to be a problem interfacing to
| gnuplot, and that's where I get stuck.
|
| Can someone duplicate this problem and, if so, how can I go about
| fixing it?

I think the problem is the call to axis in rlocus.m.  The limits are
computed by control/util/axis2dlim.m and that doesn't seem to be
handling values that are almost but not exactly equal.

Commenting out the call to axis in rlocus.m won't quite work becuase
of a similar bug in the get_axis_limits function in
plot/__go_draw_axes__.m.  I checked in the following patch for that
bug.

What would you like to do with rlocus.m and axis2dlim.m?

jwe


scripts/ChangeLog:

2007-04-10  John W. Eaton  <address@hidden>

        * plot/__go_draw_axes__.m: Try harder to handle min and max vals
        that are close but not exactly equal.

Index: scripts/plot/__go_draw_axes__.m
===================================================================
RCS file: /cvs/octave/scripts/plot/__go_draw_axes__.m,v
retrieving revision 1.14
diff -u -u -r1.14 __go_draw_axes__.m
--- scripts/plot/__go_draw_axes__.m     9 Apr 2007 23:15:47 -0000       1.14
+++ scripts/plot/__go_draw_axes__.m     10 Apr 2007 20:31:24 -0000
@@ -707,9 +707,10 @@
       endif
       warning ("axis: omitting negative data in log plot");
     endif
-    if (min_val == max_val)
-      min_val = 0.9 * min_val;
-      max_val = 1.1 * max_val;
+    ## FIXME -- maybe this test should also be relative?
+    if (abs (min_val - max_val) < sqrt (eps))
+      min_val *= 0.9;
+      max_val *= 1.1;
     endif
     min_val = 10 ^ floor (log10 (min_val));
     max_val = 10 ^ ceil (log10 (max_val));
@@ -717,9 +718,10 @@
     if (min_val == 0 && max_val == 0)
       min_val = -1;
       max_val = 1;
-    elseif (min_val == max_val)
-      min_val = 0.9 * min_val;
-      max_val = 1.1 * max_val;
+    ## FIXME -- maybe this test should also be relative?
+    elseif (abs (min_val - max_val) < sqrt (eps))
+      min_val -= 0.1 * abs (min_val);
+      max_val += 0.1 * abs (max_val);
     endif
## FIXME -- to do a better job, we should consider the tic spacing.
     scale = 10 ^ floor (log10 (max_val - min_val) - 1);



reply via email to

[Prev in Thread] Current Thread [Next in Thread]