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 zero 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 .
Basic Plotting | Multiple Data Sets in One Graph |