IFFT conversion using FFTW libraries - DSP

This is a discussion on IFFT conversion using FFTW libraries - DSP ; Hi, I am trying to convert a FFT and IFFT Matlab code to C using the fftw libraries. Hoiwever, I am stuck at a particular step: The Matlab command is: G = ifftn(P21,'symmetric'); ow do I convert this statement to ...

+ Reply to Thread
Results 1 to 5 of 5

IFFT conversion using FFTW libraries

  1. Default IFFT conversion using FFTW libraries

    Hi,
    I am trying to convert a FFT and IFFT Matlab code to C using the fftw
    libraries. Hoiwever, I am stuck at a particular step:
    The Matlab command is: G = ifftn(P21,'symmetric');
    ow do I convert this statement to C using the fftw library. I have tried
    the following steps:
    1.I used fftw_plan_dft_2d to compute the FFT for a double array of size nx
    by ny. the FFT values match the Matlab values. I also used
    fftw_plan_dft_2d(..,..,..,..,fftw_backward, fftw_estimate) to compute the
    IFFT. This also did not provide the desired results.
    2. I then thought of using r2c and a c2r IFFT. This also gives me wrong
    results.
    Can somebody suggest an alternative??
    Thanks in advance,
    Vivek



  2. Default Re: IFFT conversion using FFTW libraries

    On Nov 9, 7:48 am, "vivekv80" <vivek_...@yahoo.com> wrote:
    > 1.I used fftw_plan_dft_2d to compute the FFT for a double array of size nx
    > by ny. the FFT values match the Matlab values. I also used
    > fftw_plan_dft_2d(..,..,..,..,fftw_backward, fftw_estimate) to compute the
    > IFFT. This also did not provide the desired results.


    Matlab's ifft differs from FFTW's fftw_backward by a scale factor of 1/
    N (N = # points = nx * ny).

    Regards,
    Steven G. Johnson


  3. Default Re: IFFT conversion using FFTW libraries

    >On Nov 9, 7:48 am, "vivekv80" <vivek_...@yahoo.com> wrote:
    >> 1.I used fftw_plan_dft_2d to compute the FFT for a double array of size

    nx
    >> by ny. the FFT values match the Matlab values. I also used
    >> fftw_plan_dft_2d(..,..,..,..,fftw_backward, fftw_estimate) to compute

    the
    >> IFFT. This also did not provide the desired results.

    >
    >Matlab's ifft differs from FFTW's fftw_backward by a scale factor of 1/
    >N (N = # points = nx * ny).
    >
    >Regards,
    >Steven G. Johnson
    >
    >

    Well as per Matlab's reference manual: I think I need to convert my FFT
    coeffs into conjugate symmetric before I can pass them to the FFTW
    library. Can someone provide pointers??

  4. Default Re: IFFT conversion using FFTW libraries

    vivekv80 wrote:
    >> On Nov 9, 7:48 am, "vivekv80" <vivek_...@yahoo.com> wrote:
    >>> 1.I used fftw_plan_dft_2d to compute the FFT for a double array of size

    > nx
    >>> by ny. the FFT values match the Matlab values. I also used
    >>> fftw_plan_dft_2d(..,..,..,..,fftw_backward, fftw_estimate) to compute

    > the
    >>> IFFT. This also did not provide the desired results.

    >> Matlab's ifft differs from FFTW's fftw_backward by a scale factor of 1/
    >> N (N = # points = nx * ny).
    >>
    >> Regards,
    >> Steven G. Johnson
    >>
    >>

    > Well as per Matlab's reference manual: I think I need to convert my FFT
    > coeffs into conjugate symmetric before I can pass them to the FFTW
    > library. Can someone provide pointers??


    Yes. The FFTW manual:
    http://www.fftw.org/fftw3_doc/Multi_...Real-Data.html

    I wrote a C++ wrapper for FFTW that understands various 2d (and 1d & 3d)
    matrix types. The idea was that this frontend would make programming a
    lot easier. There is a bit of example code there that demostrates the
    layout as well.
    http://sip.unige.ch/cvmlcpp/source/doc/Fourier.html
    http://sip.unige.ch/cvmlcpp/

    Best,
    Fokko Beekhof

  5. Default Re: IFFT conversion using FFTW libraries

    >vivekv80 wrote:
    >>> On Nov 9, 7:48 am, "vivekv80" <vivek_...@yahoo.com> wrote:
    >>>> 1.I used fftw_plan_dft_2d to compute the FFT for a double array of

    size
    >> nx
    >>>> by ny. the FFT values match the Matlab values. I also used
    >>>> fftw_plan_dft_2d(..,..,..,..,fftw_backward, fftw_estimate) to

    compute
    >> the
    >>>> IFFT. This also did not provide the desired results.
    >>> Matlab's ifft differs from FFTW's fftw_backward by a scale factor of

    1/
    >>> N (N = # points = nx * ny).
    >>>
    >>> Regards,
    >>> Steven G. Johnson
    >>>
    >>>

    >> Well as per Matlab's reference manual: I think I need to convert my

    FFT
    >> coeffs into conjugate symmetric before I can pass them to the FFTW
    >> library. Can someone provide pointers??

    >
    >Yes. The FFTW manual:
    >http://www.fftw.org/fftw3_doc/Multi_...Real-Data.html
    >
    >I wrote a C++ wrapper for FFTW that understands various 2d (and 1d & 3d)
    >matrix types. The idea was that this frontend would make programming a
    >lot easier. There is a bit of example code there that demostrates the
    >layout as well.
    >http://sip.unige.ch/cvmlcpp/source/doc/Fourier.html
    >http://sip.unige.ch/cvmlcpp/
    >
    >Best,
    >Fokko Beekhof
    >


    Has someone worked on a C implementation of the conjugate symmetric
    conversion of the coefficients?? This way the coefficients match the
    values obtained by doing a IFFT(..., Symmetric) in Matlab

    Vivek

+ Reply to Thread

Similar Threads

  1. Another Matlab fft2 != FFTW
    By Application Development in forum DSP
    Replies: 1
    Last Post: 09-22-2007, 10:18 AM
  2. Problem using fftw
    By Application Development in forum DSP
    Replies: 3
    Last Post: 09-10-2007, 02:58 AM
  3. Multi-threaded FFTW
    By Application Development in forum DSP
    Replies: 3
    Last Post: 08-14-2007, 04:29 PM
  4. Replies: 9
    Last Post: 08-11-2007, 02:46 PM