help-octave
[Top][All Lists]
Advanced

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

Re: how to improve sequence plotting speed (to get more fluent animation


From: Thorsten Meyer
Subject: Re: how to improve sequence plotting speed (to get more fluent animation)?
Date: Sat, 03 Apr 2010 19:56:01 +0200
User-agent: Mozilla-Thunderbird 2.0.0.22 (X11/20090706)

Dr.-Ing. Torsten Finke wrote:
> Hello,
> 
> maybe I'm wrong but I feel, that former versions of Octave had a higher speed
>  in sequence plotting and produced smoother animations. Now I would like to
> ask, how plotting speed could be improved.
> 
> In order to get an impression of timings, I wrote a simple script (see below)
> for octave and nearly equvalent for perl and compared the result. While the
> perl version (that simply run's gnuplot through a primitive pipe) gives a
> fluent animantion, the octave version keeps stagnating on every single plot
> command.
> 
> What would my mistake be?
> 
> Any suggestions appretiated.
> 
> Thanks to the Octave developers for their great work.
> 
> Best regards
> 
> 
> T. Finke
> 
> Version Info: - GNU Octave, version 3.2.4 - G N U P L O T  Version 4.2
> patchlevel 5 - Linux 2.6.31.5 i686 (OpenSuSE 11.2)
> 
> 
> ### Scripts
> 
> Octave: sine.m # --- t = [0:100]/5; s = sin(t) .* exp(-t/5); a = [0, 20, -1,
> 1]; k = 0; while k >= 0, plot(t, sin(k) * s); axis(a); drawnow(); k = k +
> 0.1; end # ---
> 
> Perl: sine.pl # --- #!/usr/bin/perl open GP, "|gnuplot"; my @t = map { $_ / 5
> } ( 0 .. 100 ); my $k = 0; while ( $k >= 0 ) { my @d = map {"$_\t" .
> (sin($k)*sin($_)*exp(-$_/5)) . "\n" } @t; print GP "plot [0:20][-1:1] '-' w
> l\n", @d, "e\n"; $k += 0.1; } # ---
> 
On my debian machine, octave compiled from the development sources (together
with gnuplot 4.4) is faster than 3.2.4 but still by roughly a factor of 7 slower
than your simple perl script.

This is a faster octave version of the animation, but still not as fast as perl:
t = [0:100]/5;
s = sin(t) .* exp(-t/5);
a = [0, 20, -1, 1];
k = 0;
h=plot(t, sin(k) * s);
axis(a);
drawnow();
while k >= 0,
  k = k + 0.1;
  set(h, "ydata", sin(k) * s);
  drawnow();
end

regards

Thorsten



reply via email to

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