NDK_DFT

int __stdcall NDK_DFT ( double *  X,
size_t  N,
double *  retAmp,
double *  retPhase,
size_t 
)

Calculates the discrete fast Fourier transformation for amplitude and phase.

Returns
status code of the operation
Return values
NDK_SUCCESS  Operation successful
NDK_FAILED  Operation unsuccessful. See Macros for full list.
Parameters
[in] is the univariate time series data (a one dimensional array).
[in] is the number of observations in X.
[out] retAmp  is an array of the amplitudes of the fourier transformation components
[out] retPhase  is an array of the phase angle (radian) of the Fourier transformation components .
[in] is the number of spectrum components (i.e. size of amp and phase)
Remarks
  1. The input time series may include missing values (e.g. NaN) at either end, but they will not be included in the calculations.
  2. The input time series must be homogeneous or equally spaced.
  3. The first value in the input time series must correspond to the earliest observation.
  4. The frequency component order, \(k\), must be a positive number less than \(N\), or the error (#VALUE!) is returned.
  5. The DFT returns the phase angle in radians, i.e. \(0 \lt \phi \lt 2 \times \pi\).
  6. The discrete Excel Fourier transformation (DFT) is defined as follows: \[ X_k = \sum_{j=0}^{N-1} x_j e^{-\frac{2\pi i}{N} j k} \] Where:
    • \(k\) is the frequency component
    • \(x_0,...,x_{N-1}\) are the values of the input time series
    • \(N\) is the number of non-missing values in the input time series
  7. The Cooley-Tukey radix-2 decimation-in-time fast Excek Fourier transform (FFT) algorithm divides a DFT of size N into two overlapping DFTs of size \(\frac{N}{2}\) at each of its stages using the following formula: \[ X_{k} = \begin{cases} E_k + \alpha \cdot O_k & \text{ if } k \lt \dfrac{N}{2} \\ E_{\left (k-\frac{N}{2} \right )} - \ \alpha \cdot O_{\left (k-\frac{N}{2} \right )} & \text{ if } k \geq \dfrac{N}{2} \end{cases} \] Where:
    • \(E_k\) is the DFT of the even-indicied values of the input time series, \(x_{2m} \left(x_0, x_2, \ldots, x_{N-2}\right)\)
    • \(O_k\) is the DFT of the odd-indicied values of the input time series, \(x_{2m+1} \left(x_1, x_3, \ldots, x_{N-2}\right)\)
    • \(\alpha = e^{ \left (-2 \pi i k /N \right )}\),
    • \(N\) is the number of non-missing values in the time series data.
  8. The unit frequency of the DFT is \(\frac{2\pi}{N}\), where \(N\) is the number of non-missing observations.
Requirements
Header SFSDK.H
Library SFSDK.LIB
DLL SFSDK.DLL
Examples


   
Namespace:  NumXLAPI
Class:  SFSDK
Scope:  Public
Lifetime:  Static
int NDK_DFT ( double[]  pData,
UIntPtr  nSize,
short  component,
short  argRetType,
out double  retVal 
)

Calculates the discrete fast Fourier transformation for amplitude and phase.

Returns
status code of the operation
Return values
NDK_SUCCESS  Operation successful
NDK_FAILED  Operation unsuccessful. See Macros for full list.
Parameters
[in] pData  is the univariate time series data (a one dimensional array).
[in] nSize  is the number of observations in pData.
[out] component  is an array of the amplitudes of the fourier transformation components
[out] argRetType  is an array of the phase angle (radian) of the Fourier transformation components .
[in] retVal  is the number of spectrum components (i.e. size of amp and phase)
Remarks
  1. The input time series may include missing values (e.g. NaN) at either end, but they will not be included in the calculations.
  2. The input time series must be homogeneous or equally spaced.
  3. The first value in the input time series must correspond to the earliest observation.
  4. The frequency component order, \(k\), must be a positive number less than \(N\), or the error (#VALUE!) is returned.
  5. The DFT returns the phase angle in radians, i.e. \(0 \lt \phi \lt 2 \times \pi\).
  6. The discrete Excel Fourier transformation (DFT) is defined as follows: \[ X_k = \sum_{j=0}^{N-1} x_j e^{-\frac{2\pi i}{N} j k} \] Where:
    • \(k\) is the frequency component
    • \(x_0,...,x_{N-1}\) are the values of the input time series
    • \(N\) is the number of non-missing values in the input time series
  7. The Cooley-Tukey radix-2 decimation-in-time fast Excek Fourier transform (FFT) algorithm divides a DFT of size N into two overlapping DFTs of size \(\frac{N}{2}\) at each of its stages using the following formula: \[ X_{k} = \begin{cases} E_k + \alpha \cdot O_k & \text{ if } k \lt \dfrac{N}{2} \\ E_{\left (k-\frac{N}{2} \right )} - \ \alpha \cdot O_{\left (k-\frac{N}{2} \right )} & \text{ if } k \geq \dfrac{N}{2} \end{cases} \] Where:
    • \(E_k\) is the DFT of the even-indicied values of the input time series, \(x_{2m} \left(x_0, x_2, \ldots, x_{N-2}\right)\)
    • \(O_k\) is the DFT of the odd-indicied values of the input time series, \(x_{2m+1} \left(x_1, x_3, \ldots, x_{N-2}\right)\)
    • \(\alpha = e^{ \left (-2 \pi i k /N \right )}\),
    • \(N\) is the number of non-missing values in the time series data.
  8. The unit frequency of the DFT is \(\frac{2\pi}{N}\), where \(N\) is the number of non-missing observations.
Exceptions
Exception Type Condition
None N/A
Requirements
Namespace NumXLAPI
Class SFSDK
Scope Public
Lifetime Static
Package NumXLAPI.DLL
Examples
	
References
* Hamilton, J .D.; Time Series Analysis , Princeton University Press (1994), ISBN 0-691-04289-6
* Tsay, Ruey S.; Analysis of Financial Time Series John Wiley & SONS. (2005), ISBN 0-471-690740
* D. S.G. Pollock; Handbook of Time Series Analysis, Signal Processing, and Dynamics; Academic Press; Har/Cdr edition(Nov 17, 1999), ISBN: 125609906
* Box, Jenkins and Reisel; Time Series Analysis: Forecasting and Control; John Wiley & SONS.; 4th edition(Jun 30, 2008), ISBN: 470272848