Multiple bode plots fail on same figure

Ben Abbott bpabbott at mac.com
Fri Jun 27 19:17:11 CDT 2008


On Jun 27, 2008, at 7:23 PM, Anon5710 wrote:

>
> Hi,
>
> It an easy to reproduce bug.
> Here's an example.
>
> ********************
> clear all;
> [a1,b1] = butter( 7, [25, 41], 's');
> [a2,b2] = butter( 7, [49, 81], 's');
> bandpass_1 = tf( a1, b1);
> bandpass_2 = tf( a2, b2);
> figure(1);
> clf;
> bode( bandpass_1 )
> hold on;
> bode( bandpass_2 )
> ********************
>
> The resulting figure has the phase plot of both system functions.  
> But it
> only shows the magnitude plot of the last one to given. (in this case
> bandpass_2)
>
> Are there any solutions to this?
>
> I am using GNU Octave, version 3.0.1
> Compiled from source on my gentoo system. (I have instaled the various
> octave-forge-* packages.)

Octave 3.0.1 includes the property "nextplot" for each axis. I  
understand that "hold on" only respects the current axis, not the  
current figure. So there is no bug (if I'm wrong feel free to correct  
me) ... however the help text for "hold" appears to be in need of  
clarity.

To get the effect you're looking for try replacing "hold on" with ...

	set (findobj (gcf, "type", "axes"), "nextplot", "add")

The equivalent to "hold off" is

	set (findobj (gcf, "type", "axes"), "nextplot", "replace")

Alternatively, you can use

	hold (findobj (gcf, "type", "axes"), "on")

	hold (findobj (gcf, "type", "axes"), "off")

Ben


More information about the Bug-octave mailing list