`y=diff(x,s)`

`y=diff(x,s,k)`

Inputs | |

`x` |
A vector or a matrix. |

`s` |
An integer. |

`k` |
A positive integer whose default value is assumed to be `1` . |

Outputs | |

`y` |
A vector or matrix of numbers computed by differencing the input `k` times. |

For a vector input,

`diffsn(x,s)`

returns the array
` [ x[s+1]-x[1] , x[s+2]-x[2] , x[s+3]-x[3] ....].`

If

`x`

is a matrix, the finite differnces are calculated column by column.
`diffsn(x, s k)`

calculate the `k'th`

difference by differencing the input array
`k`

times.