help-octave
[Top][All Lists]
Advanced

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

Re: Plotting and Animating in Octave (vs. Matlab)


From: Dmitri A. Sergatskov
Subject: Re: Plotting and Animating in Octave (vs. Matlab)
Date: Tue, 16 Jul 2013 14:23:31 -0500




On Tue, Jul 16, 2013 at 1:27 PM, Jeff <address@hidden> wrote:
Hi Ron. I have not considered that because 1) I do not know how to write images to files, 2) I don't know how to write to a "sequential" file (and I only sort of get what you mean by a "sequential file", and 3) I've never heard of ImageMagick.

I will research ImageMagick tonight. If it's free (I suspect yes) I will try it out. Could you give me a hint how to write successive images to a file? A list of commands I need to read up on should be adequate (a small code snippet would be ideal).



Here is an example:

t=linspace(0,10,1001);
for ii=1:100
  w = 2*pi*0.1*ii;
  plot(t,sin(w*t),";;")
  fname = sprintf("anim_%04i.png", ii);
  tstring = sprintf("Frequency = %4.2f Hz", 0.1*ii);
  title(tstring)
  xlabel("Time")
  ylabel("Amplitude")
  print (fname, "-dpngcairo")
endfor

====

After you ran this code in octave in your current directory you will have 100 files
with names like
anim_0001.png
to
anim_0100.png
Those are sequential frames of your animation.

You can now either look at them with
animate -delay 10 anim_*.png

or create some stand-alone movie file with e.g. 'mencoder'

mencoder mf://anim_*.png -mf fps=15:type=png -ovc copy -o anim_mng.avi

Dmitri.
--




reply via email to

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