| 2.1.22.2.1.15 fft_2d_real
 DescriptionPerforms nFFTRow*nFFTCol-point discrete 2D Fourier transform or 2D inverse Fourier transform.
 Syntaxint fft_2d_real( int nFFTRow, int nFFTCol, matrix<complex> & mSig, FFT_SIGN iSign = FFT_FORWARD ) Parameters nFFTRow[input]	the number of rows to do Fourier transform. nFFTCol[input]	the number of cols to do Fourier transform. mSig[modify]	Input:	for forward transform, it contains real signal to be transformed.for backward transform, it contains complex signal.Output:	for forward transform, it contains the complex signal of 2D DFT.for backward transform, it contains the real signal of 2D IDFT. iSign[input] 	FFT_FORWARD: FFT; (by default)FFT_BACKWARD: IFFT.
 ReturnReturns 0 for success or error codes for failure.
 ExamplesPrior to compilation, load fftEx_utils.c to the workspace by executing the following LabTalk command:
 Run.LoadOC("Originlab\fftEx_utils.c", 16);To retain fftEx_utils.c in the workspace for successive sessions, drag and drop the file from the Temporary folder to the System folder.
 EX1
 #include <fftex_utils.h>
void fft_2d_real_ex1()
{
    matrix<complex> sig(2, 2);
    for (int ii=0; ii<2; ++ii)
        for (int jj=0; jj<2; ++jj)
        {
            sig[ii][jj].m_im = (ii+jj)%2;
            sig[ii][jj].m_re = !sig[ii][jj].m_im;
        }
    for (ii=0; ii<2; ++ii)
    {
        for (int jj=0; jj<2; ++jj)
            printf ("%lf+%lfi\t", sig[ii][jj].m_re, sig[ii][jj].m_im);
        printf ("\n");
    }
    printf ("\n");
    fft_2d_real(2, 2, sig, FFT_BACKWARD);
    printf ("\n");
    for (ii=0; ii<2; ++ii)
    {
        for (int jj=0; jj<2; ++jj)
            printf ("%lf+%lfi\t", sig[ii][jj].m_re, sig[ii][jj].m_im);
        printf ("\n");
    }
}RemarkPerforms nFFTRow*nFFTCol-point discrete 2D Fourier transform or 2D inverse Fourier transform.
 mSig will be padded with zeros if it has less than nFFTRow*nFFTCol points and truncated if it has more.
 For forward FT, the input is real data, and the output is complex data;
 For backward FT, the input is complex data, and the output is real data.
 See Alsofft_2d_complex
 Header to IncludefftEx_utils.h
 Reference |