|
On Nov 10, 8:09 pm, "humpty Kumaratunga" <suje...@lps.umontreal.ca>
wrote:
> if data is an N-dimensional 1D array that holds amplitudes that make up a wave;
>
> in Matlab, I am using -
> Y=fft(data(:,2),NFFT);
> where 2^(NFFT) = N
>
> and in fftw, I am using:
> static fftw_plan p = fftw_plan_dft_1d(len, data,out,FFTW_REDFT01,FFTW_MEASURE);
> fftw_execute(p);
First, by passing NFFT in Matlab you are zero padding the array. In
FFTW, it doesn't look like you are zero-padding. Don't zero-pad in
Matlab if you want to get the same results.
Second, it makes no sense whatsoever to pass FFTW_REDFT01 to
fftw_plan_dft_1d. You should be passing FFTW_FORWARD to match the
Matlab FFT function. Moreover, FFTW_REDFT01 is only valid as an
argument to fftw_plan_r2r, and it corresponds to a type of discrete
cosine transform, which is an entirely different operation than the
discrete Fourier transform the Matlab fft function computes.
Regards,
Steven G. Johnson.
|