Forums

fftw 1D transform of 2D signal

Started by Nico April 2, 2008
Hello,

I have a 2D signal (x,y) in an array, and I would like to fourier 
transform it along one and only one dimension, x for example.


I have (nx+1) and (ny+1) points in the x and y direction respectively.

the data is stored in a 1D array so that the (i,j) point is simply i + 
j*(nx+1)



I think that the advanced interface should be good for my problem, but I 
don't understand some of the parameters required to make the plan.


fftw_plan fftw_plan_many_dft_r2c(int rank, const int *n, int howmany,
                                       double *in, const int *inembed,
                                       int istride, int idist,
                                       fftw_complex *out, const int 
*onembed,
                                       int ostride, int odist,
                                       unsigned flags);



int rank : 1

const int *n; I think the only element n[0] is the logical size of the 
array, so I would say n[0] = nx

int howmany; is the number of transform, since I want the FFT along the 
x direction, there is ny+1 FFT to compute, so howmany=ny+1

double *in; this is my input array, I'm not sure, should I give all 
(nx+1)(ny+1) points to the planner, or only (nx)(ny+1) (because the 
(nx+1)th point is the same as the first one.)

const int *inembed; What is the difference between this parameter and *n 
? should it be nx+1 ? nx ?

int stride;  I think this one is 1 in my case.

int idist; And this one should be nx+1 since I want the fourier 
transform along x, i.e. along each line of nx+1 points.


fftw_complex *out; In my case it should be an array of (nx/2+1)*(ny+1) 
fftw_complex, right ?



const int *onembed; nx/2+1 ?

int ostride;  1 I think

int odist; nx/2+1 I think ?

unsigned flag; ok I choose what I want here...


Thanks for telling me where I'm wrong :)

Nico

On Apr 2, 3:52 am, Nico <nicolas.au...@free.fr> wrote:
> I have a 2D signal (x,y) in an array, and I would like to fourier > transform it along one and only one dimension, x for example. > ....
It looks fine to me; I'm not sure what your question is or why you think it is wrong. Why not just try it for a small sample dataset? (Note that the nembed parameters are really only important for one- dimensional transforms, for cases where you are performing a multi- dimensional transform of a portion of a multi-dimensional array. Here, your transforms are 1d so these parameters are ignored anyway and you could just pass NULL.) Regards, Steven G. Johnson