%-------------------------------------------------------------------------
%               Create AVI after loop runs: movie2avi
%-------------------------------------------------------------------------

clear;
close all;
clc

data.x = linspace(0,2*pi,100000);

for i=1:100
    data.y = cos(i*data.x);
    axis equal
    plot(data.x,data.y)
	M(i) = getframe;
    pause(.05)
end

disp('now to the movie')

movie(M,2)
movie2avi(M, 'cosine.avi', 'compression', 'none');
