diff

Parent Previous Next

diff

y = diff ( x,n[=1] )
y = x.diff ( n[=1] )

Calculates the n-th difference between adjacent elements of x

arg

type

Description

Unit or Value scale

x

VCT or AUDIO

the array or signal


n

SCAL

skip count


Outputs

  • y is the array of n-th order difference.

Notes

  • If x is a matrix, y is a matrix of row-wise operations

Examples

  • a=1:5; a.diff → [1 1 1 1]
  • a.diff(2) → [2 2 2]
  • s=(1:12).matrix(3); s(2,:) *= 10; ss.diff →
    ans =
    1 1 1
    10 10 10
    1 1 1

See Also

cumsum

Created with the Personal Edition of HelpNDoc: Easily create CHM Help documents