Graphics Previous page   Next Page

Example -- Visualizing an FFT as a Movie

This example illustrates the use of movies to visualize the quantity fft(eye(n)), which is a complex n-by-n matrix whose elements are various powers of the nth root of unity, exp(i*2*pi/n).

Creating the Movie

Create the movie in a for loop calling getframe to capture the graph. Since the plot command resets the axes properties, call axis equal within the loop before getframe.

Running the Movie

After generating the movie, you can play it back any number of times. To play it back 30 times, type

You can readily generate and smoothly play back movies with a few dozen frames on most computers. Longer movies require large amounts of primary memory or a very effective virtual memory system.

Movies that Include the Entire Figure

If you want to capture the contents of the entire figure window (for example, to include GUI components in the movie), specify the figure's handle as an argument to the getframe command. For example, suppose you want to add a slider to indicate the value of k in the previous example.

In this example, the movie frame contains the entire figure. To play so that it looks like the original figure, make the playback axes fill the figure window.

Previous page  Movies Erase Modes Next page

© 1994-2005 The MathWorks, Inc.