diff
Calculates the n-th difference between adjacent elements of #p1
Syntax
y = diff ( x,n[=1] )
y = x.diff ( n[=1] )
Inputs
| Argument | Type | Description | Unit |
|---|---|---|---|
x | vector or audio | the array or signal | n/a |
n | scalar | skip count | - |
Outputs / Return Value
y:yis the array of n-th order difference.
Notes
- If
xis a matrix,yis 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
Review Status
- Legacy parameter naming does not exactly match current engine metadata and should be reviewed manually.