MATLAB Function Reference    

Stairstep plot



Stairstep plots are useful for drawing time-history plots of digitally sampled data systems.

stairs(Y) draws a stairstep plot of the elements of Y. When Y is a vector, the x-axis scale ranges from 1 to size(Y). When Y is a matrix, the x-axis scale ranges from 1 to the number of rows in Y.

stairs(X,Y) plots X versus the columns of Y. X and Y are vectors of the same size or matrices of the same size. Additionally, X can be a row or a column vector, and Y a matrix with length(X) rows.

stairs(...,LineSpec) specifies a line style, marker symbol, and color for the plot (see LineSpec for more information).

[xb,yb] = stairs(Y) and [xb,yb] = stairs(x,Y) do not draw graphs, but return vectors xb and yb such that plot(xb,yb) plots the stairstep graph.


Create a stairstep plot of a sine wave.

See Also

bar, hist

Discrete Data Plots for related functions

  sscanf start