Intel® oneAPI Math Kernel Library
Ask questions and share information with other developers who use Intel® Math Kernel Library.

FFTW3xf : Frequency & Amplititude Vs Matlab

ppthelion
Beginner
821 Views
Hi:
I have use the function: DFFTW_PLAN_DFT_R2C_1D(MY_PLAN,N,IN,OUT,FFTW_ESTIMATE) to calculate the spectrum of areal vector in(n),but I don't know the relation between frequencyand out(n/2+1), in otherwords ,I'm not asure howspectrum stored in ''out'',could anyone give some answers or suggestions? IusedMatlab to do the samething,thepower spectrum graph shows a little different. I think maybe I misstake the storedorder!
Thanks for your answer!
0 Kudos
1 Solution
Dmitry_B_Intel
Employee
821 Views

Hi,

For real input the spectrumfull_out(1:n) obeys relation full_out(k) = conj(full_out(n+2-k)).Matlab likely returns the full spectrum. MKL's R2Ccomputes out(1:n/2+1) that can be used to restorefull_out as follows:
full_out(k) = out(k) ! k = 1...n/2+1
full_out(k) = conj(out(n+2-k)) ! k = n/2+2...n

Thanks
Dima

View solution in original post

0 Kudos
3 Replies
Dmitry_B_Intel
Employee
822 Views

Hi,

For real input the spectrumfull_out(1:n) obeys relation full_out(k) = conj(full_out(n+2-k)).Matlab likely returns the full spectrum. MKL's R2Ccomputes out(1:n/2+1) that can be used to restorefull_out as follows:
full_out(k) = out(k) ! k = 1...n/2+1
full_out(k) = conj(out(n+2-k)) ! k = n/2+2...n

Thanks
Dima
0 Kudos
ppthelion
Beginner
821 Views

Hi,

For real input the spectrumfull_out(1:n) obeys relation full_out(k) = conj(full_out(n+2-k)).Matlab likely returns the full spectrum. MKL's R2Ccomputes out(1:n/2+1) that can be used to restorefull_out as follows:
full_out(k) = out(k) ! k = 1...n/2+1
full_out(k) = conj(out(n+2-k)) ! k = n/2+2...n

Thanks
Dima

Thanks for your timely reply,but I have another question: if my step is dt ,accorfding to spectrum full_out(k),the corresponding frequency is k/dt {k| -1thanks
0 Kudos
Dmitry_B_Intel
Employee
821 Views

Hi,

Thefrequency corresponding to full_out(k) is (k-1)/(dt*n), where 1 <= k <= n if full_out is defined as dimension(n) array. The other part is conjugate-symmetric, as defined by the identity above.

Thanks
Dima
0 Kudos
Reply