calculates the discrete Fourier transform or inverse Fourier transform of a sequence of iSize real data values. For forward FT, the output is in Hermitian form; For backward FT, the input sequence is in Hermitian form.
int fft_fft_real( int iSize, double * vSig, FFT_SIGN iSign = FFT_FORWARD )
Returns 0 for success or error codes for failure.
EX1
//Assume the current Worksheet has 4 columns. The first column contains 7 data. This piece //of code reads in a sequence of real data values from the first column, and prints //their discrete Fourier transform (as computed by fft_fft_real) into the second and //the third column, after expanding it from Hermitian form into a full complex sequence. //It also performs an inverse transform to obtain the original data in the fourth column. #include <..\originlab\fft.h> void TEST_fft_fft_real() { int n = 7, j, success, n2, nj; //Attach 4 Datasets to these 4 columns Worksheet wks = Project.ActiveLayer(); if(wks) { Dataset xx(wks, 0); Dataset aa(wks, 1); aa.SetSize(n); Dataset bb(wks, 2); bb.SetSize(n); Dataset cc(wks, 3); cc.SetSize(n); vector x = xx; ///FT success = fft_fft_real(n, x); //output the result into worksheet. if(success == 0) { aa[0] = x[0]; bb[0] = 0.0; n2 = (n-1)/2; for (j = 1; j<=n2; j++) { nj = n - j; aa[j] = x[j]; aa[nj] = x[j]; bb[j] = x[nj]; bb[nj] = -x[nj]; } if (n % 2==0) { aa[n2+1] = x[n2+1]; bb[n2+1] = 0.0; } } ///IFT success = fft_fft_real(n, x, FFT_BACKWARD); //output the result into worksheet. cc = x; } }
fft_fft_complex, fft_fft_2d_complex
fft.h