Octave meshgrid, surf and video slideshow

Since the release of the splendid GUI, Octave has become again one of my favorite tools. Here is a simple and hopefully useful application. The following code is quite self-explanatory:

tx = ty = linspace (-4, 4, 41)';
[xx, yy] = meshgrid (tx, ty);
for ii=1:23
  alpha = 0.01*ii;
  tz = exp(-alpha*(xx .^2 + yy .^2 ));
  surf(tx, ty, tz);
  tit = strcat ("alpha=", num2str(alpha));
  title(tit);
  fname = sprintf("anim_%02i.jpg", ii);
  print (fname)
  ans = yes_or_no ("prompt")
endfor

 

After that, having installed ffmpeg, just issue from either bash or cmd shell:

ffmpeg.exe  -framerate 2 -start_number 1 -i "anim_%02d.jpg" -vcodec mpeg4 evolution.mp4

 

to obtain:

 

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s