plot
!! 例子见 Matlab Graphics - Line Plots
-
plot(X,Y)creates a 2-D line plot of the data in Y versus the corresponding values in X- If X and Y are both vectors, then they must have equal length
- If X and Y are both matrices, then they must have equal size, and it 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 function plots discrete points
- To see the points you must specify a marker symbol
-
plot(X,Y,LineSpec)sets the appearance of the plot by LineSpec- LineSpec should be a char vector made up of
- line style
- marker symbol
- color
- 无顺序, 也无需包含全部三者
- For example:
-.or,db,--mo
- LineSpec should be a char vector made up of
-
plot(X1,Y1,...,Xn,Yn)plots multiple X, Y pairs using the same axes for all lines -
plot(X1,Y1,LineSpec1,...,Xn,Yn,LineSpecn)sets the line style, marker type, and color for each line- You can mix X, Y, LineSpec triplets with X, Y pairs, like
plot(X1,Y1,X2,Y2,LineSpec2,X3,Y3)
- You can mix X, Y, LineSpec triplets with X, Y pairs, like
-
plot(Y)creates a 2-D line plot of the data in 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
- In this case
plot(Y)is equivalent toplot(real(Y),imag(Y))
- In this case
- If Y is a vector, then the x-axis scale ranges from 1 to
-
plot(Y,LineSpec)sets the line style, marker symbol, and color -
plot(___,Name,Value)specifies line properties using one or more Name,Value pair arguments- Name-value pair settings apply to all the lines plotted.
-
plot(ax,___)creates the line in the axes specified by ax instead of in the current axes (gca) !tocheck -
h = plot(___)returns a column vector of chart line objects