Scientific Computing & Visualization
Help Contact
About Accounts Computation Visualization Documentation Services

Introduction to MATLAB

Animation

To create animation, first plot each frame and save the data in a corresponding column of a movie matrix, say, M.

>> axis equal  
>> M = moviein(16);      % allocate/initialize the matrix to have 16 frames         
>> set(gca,'NextPlot','replacechildren')  
>> for j=1:16       
     plot(fft(eye(j+16)))       
     M(:,j) = getframe;  
end

Once M is defined for all 16 frames, its time to run the animation.

>> movie(M,30)       % run 30 times  
Documentation
Boston University
Boston University
 
OIT | CCS | July 7, 2009  
Scientific Computing & Visualization Boston University home page Boston University home page