Animation, MATLAB in Mathematics

Animation:

In this part we will observe a couple of ways to animate a plot. These are visuals, therefore the outcomes can't really be shown here; it is essential to type these into a MATLAB to view the results.

We begin by animating a plot of sin(x) with the vectors:

>> x = -2*pi : 1/100 : 2*pi;

>> y = sin(x);

This results in sufficient points that we will be able to view the result by using the built-in comet function, that shows the plot by first displaying the point (x(1),y(1)), and then moving on to the point (x(2),y(2)), and so forth, leaving a trail of all the earlier points.

   >> comet(x,y)

The final result looks similar as plot(x,y).

The other way of animating is to use the built-in function movie that shows recorded movie frames. The frames are captured in a loop by using the built-in function getframe, and are stored in the matrix. For illustration, the script below again animates the sin function. The axis function is used so that the MATLAB will use similar set of axes for all frames, and by using the min and max functions on the data vectors x & y will permit us to see all points.

It shows movie once in the for loop, and then again whenever the movie function is called.

2091_Animation.png

Posted Date: 10/22/2012 1:51:45 AM | Location : United States







Related Discussions:- Animation, Assignment Help, Ask Question on Animation, Get Answer, Expert's Help, Animation Discussions

Write discussion on Animation
Your posts are moderated
Related Questions
The variance is generally defined in terms of the arithmetic mean as: At times, though, the denominator is defined as n instead of n - 1. The default definition used by t

Illustration of Labels and prompts: The program below prompts the user for endpoints (x1, y1) and (x2, y2) of a line segment, and computes the midpoint of the line segment, th

Three-dimensional pie and bar: For the bar3 function, x & y vectors are passed and the function displays three-dimensional bars as shown in figure: Figure: Three-dimen

Plot types: Besides plot and bar, there are another plot types like stem plots, histograms, stem plots, area plots and pie charts, and also other functions which customize the

Built-in function for Differentiation: The MATLAB has a built-in function, diff that returns the differences between consecutive elements in a vector. For illustration, >>

strvcat function - concatenation: The function strvcat will concatenate it vertically, that means that it will generate a column vector of the strings.   >> strvcat(fir

Writing and Reading Spreadsheet Files: The MATLAB functions xlswrite & xlsread will write to and read from the spreadsheet files which have the extension .xls. For illustratio

Illustration of Minimum and Maximum Value Both of these functions also return the index of the minimum or maximum value; when there is more than one occurrence, it returns the

How do I write a product series running from i to n of x''s using a for loop?

This project requires you to use the ideas of Chapter 25 regarding maximization of a function. Here we assume that evolution has acted to generate highly efficient foragers. By hig