An alternative approach to animation is to continually erase and redraw the objects on the screen, making incremental changes with each redraw. One of the ways to do this is to redefine the XData, YData, ZData, and/or CData plot object properties for every change, then make calls to
refreshdata followed by
drawnow; or equivalently linking the plot to the data sources, which will cause the plot to be automatically updated each time the source data is changed by implicitly calling
drawnow. This alternative approach allows for faster rendering at a finite cost to the rendering accuracy. In this recipe, you will create an animation using this erase and redraw strategy.