# mstep

For a given set of x values, returns a vector of values that smoothly transitions from (or steps from) one level of y value to another. This function can create a vector that has many steps and can use different forms of interpolating step functions.

## Syntax

mstep(x_vector, use_abs_steps, interp_key, x0, y0, x1, y1, [x2,x3,y3], [x4,x5,y5]…[xn-1,xn,yn])

## Argument

x_vector
The independent vector x.
use_abs_steps
Indicates whether the y values should be considered as absolute values or relative to the previous step value. Valid values are 0 and 1. A value of 0 will consider a relative step while 1 will consider absolute values.
interp_key
Indicates the type of function to be used for interpolation. See Comments below.
x0, x1, x2,..xn-1, xn
Values of x at which the step changes.
y0, y1, y2,..yn
Values of y from or to which the step needs to be taken.

## Example 1

Single step with absolute values and uses the step interpolation.

x = 0:100:1

y = mstep(x,1,1,20,10,40,20)

## Example 2

Single step with relative values and uses the step5 interpolation.

x = 0:100:1

y = mstep(x,0,2,20,10,40,20)

## Example 3

Multiple step with relative values and uses the havsin interpolation.

x = 0:100:1

y = mstep(x,0,1,20,10,40,20,50,70,35,80,90,-50)