fftw_fft_2d_complex

 

Description

computes the two-dimensional discrete Fourier transform or inverse Fourier transform of a bivariate sequence of complex data values.

Syntax

int fftw_fft_2d_complex( int iSizeX, int iSizeY, d_complex * vSig, FFT_SIGN iSign = FFT_FORWARD )

Parameters

iSizeX
[input] the number of rows of the bivariate data sequence.
iSizeY
[input] the number of columns of the bivariate data sequence.
vSig
[modify] the complex data sequences for input and the result data after fourier transformation for output
iSign
[input] the transformation to carry out
= FFT_FORWARD: FFT (by default)
= FFT_BACKWARD: IFFT.

Return

Returns 0 for success or error codes for failure.

Examples

EX1

//Assume the current Worksheet has 6 columns, the first two columns contain 7 data each.
//The first column is the real part of the original complex data and the second column
//is the imaginary part. This piece of code reads in a sequence of these 7 complex data
//values and put the result of the discrete Fourier transform of the original data
//into the third and fourth columns. The third column is the real part and the fourth
//column is the imaginary part. Then inverse Fourier transform is performed, and the
//result is output into the fifth and sixth column.
#include <..\originlab\fft.h> 
void TEST_fftw_fft_2d_complex()
{
        int n=7, m=8, k=n*m, success;
        //Attach two Datasets to these 2 columns
        Worksheet wks = Project.ActiveLayer();
        if(wks)
        {
            Dataset xx(wks, 0);
            Dataset yy(wks, 1);
            Dataset aa(wks, 2);
            aa.SetSize(k);
            Dataset bb(wks, 3);
            bb.SetSize(k);
            Dataset cc(wks, 4);
            cc.SetSize(k);  
            Dataset dd(wks, 5);
            dd.SetSize(k);          
         
            vector x = xx, y = yy;
            //make a complex vector use x and y
            vector<complex> vc;
            vc.MakeComplex(x, y);
                        
            ///FFT
            success = fftw_fft_2d_complex(n, m, vc);
                //put the result back to the current worksheet, the third and the fourth column.
            vc.GetReal(x);
            vc.GetImaginary(y);
            aa = x;
            bb = y;
                        
            ///IFT
            success = fftw_fft_2d_complex(n, m, vc, FFT_BACKWARD);
                //put the result back to the current worksheet, the fifth and the sixth column.
            vc.GetReal(x);
            vc.GetImaginary(y);
            cc = x;
            dd = y;
        }
}

Remark

See Also

fft_fft_2d_complex

header to Include

fft.h

Reference