2.1.22.2.1.13 fft_2d_complex

Description

Perform 2d complex FFT

Syntax

int fft_2d_complex( int nFFTRow, int nFFTCol, matrix<complex> & mSig, FFT_SIGN iSign = FFT_FORWARD )

Parameters

nFFTRow
[input] the number of rows of the bivariate data sequence.
nFFTCol
[input] the number of columns of the bivariate data sequence.
mSig
[modify] the original signal to be transformed, and the result of the transform
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] the transformation to carry out
= FFT_FORWARD: FFT (by default)
= FFT_BACKWARD: IFFT.

Return

Returns 0 for success or error codes for failure.

Examples

Prior 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_complex_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_complex(2, 2, sig);
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");
}
}