Getting Started |
Creating a Plot
The plot
function has different forms, depending on the input arguments. If y
is a vector, plot(y)
produces a piecewise linear graph of the elements of y
versus the index of the elements of y
. If you specify two vectors as arguments, plot(x,y)
produces a graph of y
versus x
.
For example, these statements use the colon
operator to create a vector of x
values ranging from 0 to 2, compute the sine of these values, and plot the result:
Now label the axes and add a title. The characters \pi
create the symbol . See text strings for more symbols:
Basic Plotting Functions | Multiple Data Sets in One Graph |
© 1994-2005 The MathWorks, Inc.