.. highlightlang:: us .. _diff: diff ==== .. index:: diff .. us.tag diff ENGLISH math-base :ref:`diff` computes differences such as the following: [x[2] - x[1], x[3] - x[2], ... , x[n] - x[n-1]] .. function:: rmDiff = diff(rmMat) .. us.return **Return Value** *rmDiff* is a difference matrix or a vector. .. us.params **Parameters** .. uparam:: r *rmMat* is a real matrix or a vector. .. us.example **Example** :: * a = [1,2,5,4,5,6] * diff(a) 1 3 -1 1 1 .. seealso:: :ref:`overview-mathematic`, :ref:`cumsum` :sub:`id-273623`