Reply by vivekv80 November 14, 20072007-11-14
>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_002dDimensional-DFTs-of-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 by Fokko Beekhof November 11, 20072007-11-11
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_002dDimensional-DFTs-of-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
Reply by vivekv80 November 9, 20072007-11-09
>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??
Reply by Steven G. Johnson November 9, 20072007-11-09
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
Reply by vivekv80 November 9, 20072007-11-09
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