help-octave
[Top][All Lists]
Advanced

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

Re: How to plot multiple variables in scrolling window


From: jmb
Subject: Re: How to plot multiple variables in scrolling window
Date: Fri, 11 Jul 2014 19:03:49 -0400
User-agent: Mozilla/5.0 (X11; Linux x86_64; rv:24.0) Gecko/20100101 Thunderbird/24.6.0

Hello,

Thanks for the suggestion.  After some more trials this afternoon I stumbled upon a similar solution.  In my case I was updating the variable within the loop and using 'refreshdata' before the endfor statement.  I am still learning octave plotting, so I find this forum immensely helpful.

Thank you again!

JMB

On 07/11/2014 03:58 AM, Kai Torben Ohlhus wrote:
On Fri, Jul 11, 2014 at 1:31 AM, jmb <address@hidden> wrote:
I am trying to make octave plot more than one variable in a
'pseudo-scrolling' manner using the code I found at:

http://octave.1599824.n4.nabble.com/plot-in-a-for-loop-td3331507.html
N = 200;
figure (1)
x = 0:(N-1);
y = rand(1, length(x));
plot(x(1), y(1));
axis([0 N 0 1]);
vh = get(gca,'children');
for i=1:length(x)
   set(vh, 'xdata',x(1:i), 'ydata', y(1:i));
   pause(10);
endfor

which works for one variable 'y'

Then I have tried some variations of the above for 2 variables, but have
been unsuccessful.  Can somebody suggest how it can be done?

I am using:
GNU Octave Version 3.2.4
GNU Octave License: GNU General Public License
Operating System: Linux 3.2.0-53-generic #81-Ubuntu SMP Thu Aug 22
21:01:03 UTC 2013 x86_64

Thanks in advance for any advice, or code snippets.


_______________________________________________
Help-octave mailing list
address@hidden
https://lists.gnu.org/mailman/listinfo/help-octave

Maybe you look for something like this?

N = 200;
figure (1)
x = 0:(N-1);
y1 = rand(1, length(x));
y2 = rand(1, length(x));
axis([0 N 0 1]);
hold on;
for i=1:length(x)
   plot(x(1:i), y1(1:i),'b');
   plot(x(1:i), y2(1:i),'r');
   pause(.01);
endfor
hold off;

HTH, Kai


reply via email to

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