2-D line plot
plot(
creates
a 2-D line plot of the data in X
,Y
)Y
versus the corresponding
values in X
.
If X
and Y
are
both vectors, then they must have equal length. The plot
function
plots Y
versus X
.
If X
and Y
are
both matrices, then they must have equal size. The plot
function
plots columns of Y
versus columns of X
.
If one of X
or Y
is
a vector and the other is a matrix, then the matrix must have dimensions
such that one of its dimensions equals the vector length. If the number
of matrix rows equals the vector length, then the plot
function
plots each matrix column versus the vector. If the number of matrix
columns equals the vector length, then the function plots each matrix
row versus the vector. If the matrix is square, then the function
plots each column versus the vector.
If one of X
or Y
is
a scalar and the other is either a scalar or a vector, then the plot
function
plots discrete points. However, to see the points you must specify
a marker symbol, for example, plot(X,Y,'o')
.
plot(
plots
multiple X1,Y1
,...,Xn,Yn
)X
, Y
pairs using the
same axes for all lines.
plot(
sets
the line style, marker type, and color for each line. You can mix X1,Y1,LineSpec1
,...,Xn,Yn,LineSpecn
)X
, Y
, LineSpec
triplets
with X
, Y
pairs. For example, plot(X1,Y1,X2,Y2,LineSpec2,X3,Y3)
.
plot(
creates a
2-D line plot of the data in Y
)Y
versus the index
of each value.
If Y
is a vector, then the x-axis
scale ranges from 1 to length(Y)
.
If Y
is a matrix, then the plot
function
plots the columns of Y
versus their row number.
The x-axis scale ranges from 1 to the number
of rows in Y
.
If Y
is complex, then the plot
function
plots the imaginary part of Y
versus the real part
of Y
, such that plot(Y)
is equivalent
to plot(real(Y),imag(Y))
.
plot(___,
specifies
line properties using one or more Name,Value
)Name,Value
pair
arguments. For a list of properties, see Chart Line Properties. Use this option with any of
the input argument combinations in the previous syntaxes. Name,Value
pair
settings apply to all the lines plotted.
returns
a column vector of chart line objects. Use h
= plot(___)h
to
modify properties of a specific chart line after it is created. For
a list of properties, see Chart
Line Properties.