help-octave
[Top][All Lists]
Advanced

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

Re: 2 Y-axes in the same figure


From: Liam Groener
Subject: Re: 2 Y-axes in the same figure
Date: Fri, 21 Oct 2011 02:55:59 -0700


On Oct 20, 2011, at 3:24 PM, Eduardo J. Adam wrote:

Dear friends,
It's me again.
Well,
after my last visit I have made ​​great progress with my octave code
. But, actually I have a new question.
The following code works very well for me.

clear all, clf
K=1; n=K; d=[1 0.2 1 0];
gs=tf(n,d);
[mag_gs,pha_gs,w]=bode(gs);
mag_gs_db=20*log(mag_gs);
h = plotyy(w,mag_gs_db,w,pha_gs);
set (h, 'xscale', 'log','xminortick', 'on'); grid

The problem appears when I try to plot again because I need to plot 2 or 3 times in different steps. For example, if I write
K=20; n=K; d=[1 0.2 1 0];
gs=tf(n,d);
[mag_gs,pha_gs,w]=bode(gs);
mag_gs_db=20*log(mag_gs);
h =plotyy(w,mag_gs_db,w,pha_gs);
set (h, 'xscale', 'log','xminortick', 'on'); grid

the semilogx scale desappear. Here, I include two figure that shows the problem.


<image.png><image.png>


error: addproperty: a `__plotyy_axes__' property already exists in the graphics
object
error: called from:
error: /usr/share/octave/3.2.4/m/plot/plotyy.m at line 193, column 1
error: /usr/share/octave/3.2.4/m/plot/plotyy.m at line 111, column 1
error: /home/eadam/Desktop/example2.m at line 17, column 3

I don't know what the function tf is and I'm not entirely sure I understand your question, but I think what you want to do is:
1. Enter the command:
h =plotyy(w,mag_gs_db,w,pha_gs);
   only once. For subsequent curves, just use plotyy(w, ,,  without the h =. The dependent variable name should change with each curve.
2. Enter the command
 set (h, 'xscale', 'log','xminortick', 'on'); grid
only once.

reply via email to

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