STEP

Syntax: | `vector = STEP( vector, scalar ) matrix = STEP( matrix, scalar )`

The `STEP` function accepts either a vector or a matrix as its first argument. It shifts the elements of a vector or the rows of a matrix by the specified step size, the scalar second argument.

Suppose the step size is n.

• | If n > 0, the last n elements of the vector or the last n rows of the matrix are lost.
• | If n = 0, the vector or matrix is returned unchanged.
• | If n < 0, the first n elements of the vector or the first n rows of the matrix are lost.

If the step size is not an integer, then linear interpolation is used to generate new values.

Examples

function | result
`STEP([1:10],2)` | `[1;1;1;2;3;4;5;6;7;8]`
`STEP([1:10],-2)` | `[3;4;5;6;7;8;9;10;10;10]`
`STEP([1:10],1.7)` | `[1;1;1.3;2.3;3.3;4.3;5.3;6.3;7.3;8.3]`

Suppose you have a matrix `M`

                | 1  2  3  4 |
            M = | 5  6  7  8 |
                | 9 10 11 12 |

function | result
`STEP(M,2)` |
`| 1 2 3 4 |`
`| 1 2 3 4 |`
`| 1 2 3 4 |`
`STEP(M,-1)` |
`| 5 6 7 8 |`
`| 9 10 11 12 |`
`| 9 10 11 12 |`
`STEP(M,1.5)` |
`| 1 2 3 4 |`
`| 1 2 3 4 |`
`| 3 4 5 6 |`