diff
Finite differencing.
y=diff(x)
y=diff(x,k)
Inputs
x A vector or a matrix.
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.


Description
For a vector input, diff(x) returns the array [ x[2]-x[1] , x[3]-x[2] , x[4]-x[3] ....] .

If x is a matrix, the finite differnces are calculated column by column.

diff(x,k) calculate the k'th difference by differencing the input array k times.


Example
>>a=[4 10 12 15]'
>>a
          4
         10
         12
         15

>>diff(a)
          6
          2
          3

>>diff(a,2)
         -4
          1

>>diff(diff(a))
         -4
          1