Produce a stairstep plot. The arguments may be vectors or matrices.
If only one argument is given, it is taken as a vector of y-values and the x coordinates are taken to be the indices of the elements.
If two output arguments are specified, the data are generated but not plotted. For example,
stairs (x, y);and
[xs, ys] = stairs (x, y); plot (xs, ys);are equivalent.
The following code
x = 1:10; y = rand (1, 10); stairs (x, y);
Produces the following figure
![]() |
The following code
x = 1:10; y = rand (1, 10); [xs, ys] = stairs (x, y); plot (xs, ys);
Produces the following figure
![]() |