... and how to get your matlab plots into animated gifs, and into your blog!
I noted the other day that the fast fourier transform of an identity matrix can look really cool when plotted, and that stringing matrices of increasing size along in an animation looked really cool.
So when it came to sharing it this morning I came across a little fault in blogger which means that you can't directly load animated .gif files into your blog posts. The solution is to upload your image onto the web, get the html for the link, and embed that into your blog post. I used Tinypic - uploaded the image, and embedded the html code here:
Here's the matlab code for the animation
>> cf=0; %current frame
>> for k=10:50 % identity matrix from [10,10] to [50,50]
>> plot(fft(eye(k))) %plot
>> axis equal; axis off; axis([-1 1 -1 1]); % sort out axes
>> pause(0.01) %take a break
>> cf=cf+1; %update current frame
>> saveas(gcf, sprintf('frame%d', 1000+cf), 'jpg') %save the current frame as a jpg
This next bit of code tells the operating system (the bang command, !) to use the unix program 'convert' to make an animated gif out of all of those frames (i've set it to compress and downsize by half to save on file space)
>> !convert -antialias -loop 1000 -delay 5 -geometry 50% -compress LZW frame10* ffteye.gif
Gif creation is my new favourite toy - watch out Daily Daniel!