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: Mon, 14 Jul 2014 20:08:26 -0400
User-agent: Mozilla/5.0 (X11; Linux x86_64; rv:24.0) Gecko/20100101 Thunderbird/24.6.0

Thank you to all who posted very valuable suggestions and very useful code!

JMB

On 07/14/2014 04:59 AM, Juan Pablo Carbajal wrote:
> On Mon, Jul 14, 2014 at 9:17 AM, Helios de Rosario
> <address@hidden> wrote:
>>>>> El día 11/07/2014 a las 1:31, jmb <address@hidden> escribió:
>>> 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?
>> The following should work:
>>
>> N = 200;
>> figure (1)
>> x = 0:(N-1);
>> # Use sine and cosine for clearer plots
>> y1 = sin(pi/100*x);
>> y2 = cos(pi/100*x);
>> hold on
>> plot(x(1), y1(1), '.-b');
>> plot(x(1), y2(1), '.-r');
>> axis([0 N -1 1]);
>> vh = get(gca,'children');
>> for i=1:length(x)
>>    set(vh(1), 'xdata',x(1:i), 'ydata', y1(1:i));
>>    set(vh(2), 'xdata',x(1:i), 'ydata', y2(1:i));
>>    pause(0.10);
>> endfor
>>
>>
>> Plotting over the previous lines (as suggested by Kai) looks the same,
>> but overloads the axes with superimposed, unncecessary objects, and it
>> may work slower -- very slow, for too many data.
>>
>> Helios
>>
>>
>> SABEMOS QUÉ HICIMOS EN 2013
>> 365 días de Innovación
>> ANUARIO DE BIOMECÁNICA
>> http://www.ibv.org/anuario2013
>> ______________________________
>>
>> INSTITUTO DE BIOMECÁNICA DE VALENCIA
>> Universidad Politécnica de Valencia • Edificio 9C
>> Camino de Vera s/n • 46022 VALENCIA (ESPAÑA)
>> Tel. +34 96 387 91 60 • Fax +34 96 387 91 69
>> www.ibv.org
>>
>> Antes de imprimir este e-mail piense bien si es necesario hacerlo.
>> En cumplimiento de la Ley Orgánica 15/1999 reguladora de la Protección
>> de Datos de Carácter Personal, le informamos de que el presente mensaje
>> contiene información confidencial, siendo para uso exclusivo del
>> destinatario arriba indicado. En caso de no ser usted el destinatario
>> del mismo le informamos que su recepción no le autoriza a su divulgación
>> o reproducción por cualquier medio, debiendo destruirlo de inmediato,
>> rogándole lo notifique al remitente.
>>
>>
>> _______________________________________________
>> Help-octave mailing list
>> address@hidden
>> https://lists.gnu.org/mailman/listinfo/help-octave
> Maybe this code is helpful.
> http://agora.octave.org/snippet/dW3e/
>




reply via email to

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