The Step() is like Interpolate() except that it finds the corresponding y for a given x from a step-function fit rather than a linear fit. Use Step() with discrete y values (that is, when the y value’s corresponding x value can be only y1 or y2). However, when the y value’s corresponding x value can fall between y1 and y2, use Interpolate().
As with Interpolate, the data points can be specified as a list:
Step( x, x1, y1, x2, y2, ... );
or as matrices containing the x and y values:
Step( x, xmatrix, ymatrix );
Suppose that your data table shows the discount percentage for purchases of $25, $50, $75, and $100. You want to create a graph that shows the discount for a $35 purchase, which the data table does not specify. The following example shows the value that you want to evaluate, 35, followed by matrices for purchases from $25 to $100.
Step( 35, [25 50 75 100], [5 10 15 25] );
returns:
5
If the discounts were on a sliding scale (in this example, between 5 and 10, you would use Interpolate():
Interpolate( 35, [25 50 75 100], [5 10 15 25] );
returns:
7
As with Interpolate(), the data points must create a positive slope.