TD_DFFT Function Example | Teradata Vantage - TD_DFFT Example - Teradata Vantage

Database Unbounded Array Framework Time Series Functions

Deployment
VantageCloud
VantageCore
Edition
Enterprise
IntelliFlex
VMware
Product
Teradata Vantage
Release Number
17.20
Published
June 2022
Language
English (United States)
Last Update
2024-10-04
dita:mapPath
ncd1634149624743.ditamap
dita:ditavalPath
ruu1634160136230.ditaval
dita:id
ncd1634149624743

Example: Using TD_DFFT with Generated Data

TD_DFFT Input Table genData
ID ROW_I Magnitude
1 1 1.0
1 2 4.0
1 3 2.0
1 4 3.0
... ... ...

TD_GENSERIES4FORMULA Call to Generate Data

EXECUTE FUNCTION INTO VOLATILE ART(GeneratedData)
TD_GENSERIES4FORMULA(
SERIES_SPEC(TABLE_NAME(genData), SERIES_ID(ID), ROW_AXIS(SEQUENCE(ROW_I)),
PAYLOAD( FIELDS(MAGNITUDE), CONTENT(REAL))
),
FUNC_PARAMS(Formula('Y = 4.0*sin(6.283185307179586476*X1/200.0) +
4.0*sin(6.283185307179586476*X1/16.0 + 3.14159265358979323/4.0) +
4.0*sin(6.283185307179586476*X1/8.0 + 3.14159265358979323/2.0) +
4.0*sin(6.283185307179586476*X1/4.0 + 3.14159265358979323/8.0)'))
);

TD_DFFT Call

EXECUTE FUNCTION INTO VOLATILE ART(DfftRaw_INTEGRAL)
TD_DFFT(
SERIES_SPEC( TABLE_NAME(GeneratedData), SERIES_ID(ID), 
   ROW_AXIS( SEQUENCE(ROW_I) ), 
   PAYLOAD( FIELDS(MAGNITUDE), CONTENT(REAL)) ),
FUNC_PARAMS( FREQ_STYLE("K_INTEGRAL"), HUMAN_READABLE(1) ),
OUTPUT_FMT( CONTENT(AMPL_PHASE_RADIANS) ) );

TD_DFFT Output

Display the primary RETURNS TABLE with this statement:

SELECT * FROM DfftRaw_INTEGRAL WHERE Amplitude_Magnitude > 1.0;
Amplitude_Magnitude > 1.0;
ID ROW_I AMPLITUDE_MAGNITUDE PHASE_MAGNITUDE
----------- ----------- ---------------------- ----------------------
1 -100 8.00000000000000E 002 -3.92699081698714E-001
1 -50 7.99999999999999E 002 -7.85398163397436E-001
1 -25 7.99999999999998E 002 3.92699081698730E-001
1 -2 8.00000000000000E 002 1.53938040025900E 000
1 2 8.00000000000000E 002 -1.53938040025900E 000
1 25 7.99999999999998E 002 -3.92699081698730E-001
1 50 7.99999999999999E 002 7.85398163397437E-001
1 100 8.00000000000000E 002 3.92699081698714E-001