- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
I just want to convert my code from matlab to fortran. So I used the mkl-fftw3 library to complete the FFT computation. But during my test, the position of mkl-fftw3 results does not align with matlab results, it might seems like it's the reverse of matlab results.
Is there anyway to transform the fortran results to align with the matlab results?
Btw,I used vs2017 with ivf2019
In fortran I just wrote
double complex t_in(5),t_out(5) integer*8 plan t_in = dcmplx([1:5]) call dfftw_plan_dft_1d(plan,5,t_in,t_out,FFTW_FORWARD,FFTW_EST 1 IMATE) call dfftw_execute_dft(plan, t_in, t_out) call dfftw_destroy_plan(plan) PRINT *,t_out
I also calculated the backward with t_out as the input
In matlab
fft([1:5])
Results:
FORTRAN:
(15.0000000000000,0.000000000000000E+000) (-2.50000000000000,-3.44095480117793) (-2.50000000000000,-0.812299240582266) (-2.50000000000000,0.812299240582266) (-2.50000000000000,3.44095480117793) (5,0) (25,0) (20,0) (15,0) (10,0)
MATLAB:
15.0000 + 0.0000i -2.5000 + 3.4410i -2.5000 + 0.8123i -2.5000 - 0.8123i -2.5000 - 3.4410i
Link Copied
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
you may take a look at the existing mkl's examples show how to call fftw3 API from intel MKL. As an example, check, dfftw_plan_dft_1d.f90 from mklroot/examples/fftw3xf/source directory
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Hello,
What do you mean by "reverse of the matlab results"? Your output from fortran looks strange. I see the same results.
Best,
Kirill
- Subscribe to RSS Feed
- Mark Topic as New
- Mark Topic as Read
- Float this Topic for Current User
- Bookmark
- Subscribe
- Printer Friendly Page