diff

Calculates the n-th difference between adjacent elements of #p1

Syntax

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

Inputs

ArgumentTypeDescriptionUnit
xvector or audiothe array or signaln/a
nscalarskip count-

Outputs / Return Value

Notes

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

Review Status