|
IDL Reference Guide: Procedures and Functions |
|
The TS_DIFF function recursively computes the forward differences of an n-element time-series k times. This routine is written in the IDL language. Its source code can be found in the file ts_diff.pro in the lib subdirectory of the IDL distribution.
Result = TS_DIFF( X, K [, /DOUBLE] )
The result is an n-element differenced time-series with its last k elements as zeros.
An n-element integer, single- or double-precision floating-point vector containing time-series samples.
A positive integer or long integer scalar that specifies the number of times X is to be differenced. K must be in the interval [1, N_ELEMENTS(X) - 1].
Set this keyword to force the computation to be done in double-precision arithmetic.
; Define an n-element vector of time-series samples: X = [389, 345, 303, 362, 412, 356, 325, 375, $ 410, 350, 310, 388, 399, 362, 325, 382, $ 399, 382, 318, 385, 437, 357, 310, 391] ; Compute the second forward differences of X: PRINT, TS_DIFF(X, 2)
IDL prints: