help-octave
[Top][All Lists]
Advanced

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

subplot with step and impulse answer


From: John W. Eaton
Subject: subplot with step and impulse answer
Date: Fri, 22 Feb 2008 04:12:59 -0500

On 22-Feb-2008, Marcus Obst wrote:

| I tried to subplot an impulse and step answer of an SISO system
| within one chart:
| 
| octave.exe:1> sys = tf([1], [1 2]);
| octave.exe:2> subplot(1, 2, 1), step(sys)
| octave.exe:3> subplot(1, 2, 2), impulse(sys)
| 
| But it did not work as expected.  After both commands there is only
| the impulse answer left.
| 
| In Matlab everything is fine.
| 
| Any ideas? (Octave version ist 3.0.0)

I made the following change to avoid this problem, at least for calls
to step and impulse that only generate a single plot.

BTW, these lines

     ncols = floor (sqrt (NOUT));
     nrows = ceil (NOUT / ncols);

in __stempimp__.m look a little suspicious.  Perhaps someone would
like to investigate that and provide a better way of doing this?

Thanks,

jwe


# HG changeset patch
# User John W. Eaton <address@hidden>
# Date 1203671136 18000
# Node ID 05eb3486f6507ef91ddc8bd0dd0722f6897208e9
# Parent  59bee17bc1923b7ff7b08c70b66da0ee85949ab0
__stepimp__: don't call subplot for single plot

diff --git a/scripts/ChangeLog b/scripts/ChangeLog
--- a/scripts/ChangeLog
+++ b/scripts/ChangeLog
@@ -1,3 +1,7 @@ 2008-02-21  John W. Eaton  <address@hidden
+2008-02-22  John W. Eaton  <address@hidden>
+
+       * control/base/__stepimp__.m: Don't use subplot for just one plot.
+
 2008-02-21  John W. Eaton  <address@hidden>
 
        * image/imshow.m: Call axis ("image").
diff --git a/scripts/control/base/__stepimp__.m 
b/scripts/control/base/__stepimp__.m
--- a/scripts/control/base/__stepimp__.m
+++ b/scripts/control/base/__stepimp__.m
@@ -237,7 +237,9 @@ function [y, t] = __stepimp__ (sitype, s
     ncols = floor (sqrt (NOUT));
     nrows = ceil (NOUT / ncols);
     for i = 1:NOUT
-      subplot (nrows, ncols, i);
+      if (nrows > 1 || ncols > 1)
+       subplot (nrows, ncols, i);
+      endif
       if (DIGITAL)
        [ts, ys] = stairs (t, y(i,:));
        ts = ts(1:2*n-2)';

reply via email to

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