Function Reference
— Function File: stairs (x, y)
— Function File: stairs (..., style)
— Function File: stairs (..., prop, val)
— Function File: stairs (h, ...)
— Function File: h = stairs (...)

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.

Demonstration 1

The following code

 x = 1:10;
 y = rand (1, 10);
 stairs (x, y);

Produces the following figure

Demonstration 2

The following code

 x = 1:10;
 y = rand (1, 10);
 [xs, ys] = stairs (x, y);
 plot (xs, ys);

Produces the following figure