Diff

From VLECK
Jump to: navigation, search

difference between subsequent elements

Syntax

return = Diff(value);

Return Value

Diff returns the differences between subsequen elements of the matrix or structure Values. The return value is a matrix or structure of the same shape as the argument Values, but with the rows one element shorter.

Parameters

Values structure or matrix with integer or real values


Example

A=Redim(1#20; 4,5)
1	2	3	4	5
6	7	8	9	10
11	12	13	14	15
16	17	18	19	20


A=A*A
1	4	9	16	25
36	49	64	81	100
121	144	169	196	225
256	289	324	361	400


diff(A)
3	5	7	9
13	15	17	19
23	25	27	29
33	35	37	39