The basic function for producing 2-D graphs is the MATLAB '
is generally called with two identically sized row (or column) vectors, one for the set of
abscissa values and the second for the ordinate axis.
The plotted points are ordered pairs
of values, one from the first vector and one from the second vector.
For example, to plot
), ( ,
are created and then passed to the plot function for graphing.
x=[0 2 5 8 10]; % Create x vector
y=[0 4 -3 -3 6]; % Create y vector
plot(x,y) % Plot (0,0), (2,4), (5,-3), (8,-3), (10,6)
When the '
command is issued within an m-File or from the Command
window, MATLAB opens a new Figure window, draws a set of axes automatically scaled
to fit the data, plots the points in the order in which they appear in the two vectors, and
then connects all the points by straight lines.
Numerical scales appear on both axes as do