TD_POWERSPEC Function | Teradata Vantage - TD_POWERSPEC Examples - 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

TD_POWERSPEC Input Table TestDFFT8

N_SeqNo BuoyID Magnitude
0 33 1.0
1 33 2.0
2 33 3.0
3 33 4.0
4 33 5.0
5 33 6.0
6 33 7.0
7 33 8.0

Example: TD_POWERSPEC Call with K_SAMPLE_RATE, AUTOCORR, BARTLETT

EXECUTE FUNCTION INTO VOLATILE ART (MYTAB)
  TD_POWERSPEC (
    SERIES_SPEC (
      TABLE_NAME (TestDFFT8),
      SERIES_ID (BuoyID),
      ROW_AXIS (SEQUENCE (N_SeqNo)),
      PAYLOAD (FIELDS (MAGNITUDE), CONTENT (REAL))
    ),
    FUNC_PARAMS (
      FREQ_STYLE ('K_SAMPLE_RATE'),
      ALGORITHM ('AUTOCORR'),
      WINDOW (WINDOW_NAME ('BARTLETT')
    )
  )
);

TD_POWERSPEC Output with K_SAMPLE_RATE, AUTOCORR, BARTLETT

Display the primary RETURNS TABLE with this statement:

SELECT * FROM MYTAB;
     BuoyID                   ROW_I  SPECTRAL_DENSITY_MAGNITUDE
-----------  ----------------------  --------------------------
         33   1.25000000000000E-001       2.23997237659951E-001
         33   2.50000000000000E-001       4.84068627450980E-002
         33   3.75000000000000E-001       3.33557035165193E-002
         33   5.00000000000000E-001       3.49264705882353E-002

TD_POWERSPEC Input Table TestRiver

N_SeqNo BuoyID Magnitude
0 1 54.6
1 1 325.4
2 1 509.5
3 1 99.4
4 1 55.5
5 1 25.8
... ... ...

Example: TD_POWERSPEC Call with FREQ_STYLE ('K_INTEGRAL')

EXECUTE FUNCTION INTO VOLATILE ART (power_spec_default)
  TD_POWERSPEC (
    SERIES_SPEC (
      TABLE_NAME (TestRiver),
      SERIES_ID (BuoyID),
      ROW_AXIS (SEQUENCE (N_SeqNo)),
      PAYLOAD (FIELDS (MAGNITUDE), CONTENT (REAL))
    ),
    FUNC_PARAMS (FREQ_STYLE ('K_INTEGRAL'))
  );

TD_POWERSPEC Output with FREQ_STYLE ('K_INTEGRAL')

Display the RETURNS TABLE with this statement:

SELECT * FROM power_spec_default;
     BuoyID        ROW_I  SPECTRAL_DENSITY_MAGNITUDE
-----------  -----------  --------------------------
          1            0       221.461756
          1            1       23.873774
          1            2       10.719196
          1            3       8.434559
          1            4       15.741662
          ...