M-File Help: diff2 | View code for diff2

# diff2

First-order difference

d = diff2(v) is the first-order difference (1xN) of the series data in vector v (1xN) and the first element is zero.

d = diff2(a) is the first-order difference (MxN) of the series data in each row of the matrix a (MxN) and the first element in each row is zero.

## Notes

- Unlike the builtin function DIFF, the result of DIFF2 has the same number of columns as the input.

## See also

diff

© 1990-2014 Peter Corke.