Taking an inverse spatial fft in MATLAB

1 次查看(过去 30 天)
This is as much a conceptual question as a MATLAB question. I want to take an inverse fft of a function in reciprocal space and transform it to real space. How do I do this in MATLAB? Can I use the ifft function, which seems to be for time-frequency transforms, but I guess there is no major difference here? Also, how do I select my minimum, maximum, and spacing for recipirocal space Q?

采纳的回答

Star Strider
Star Strider 2022-3-13
The question is a bit ambiguous, and I do not have the frequency and complex amplitude vectors to work with.
For a one-sided complex Fourier transform (or that can be made complex from the magnitude and phase vectors), taking the inverse Fourier transform is straightforward. If ‘v’ is the complex vector and ‘f’ the frequency vector that begins at 0 and goes to the Nyquist frequency —
C = [v conj(v)]; % Two-Sided Complex Fourier Transform Vector
s = ifft(C); % Inverse Fourier Transform Of ‘C’
t = (0:numel(s)-1)/(2*max(f)); % Associated Time Vector
The original units of whatever the ‘t’ vector are here are irrelevant — it can be time, distance, pixels or anything else, so long as it is regularly sampled.
If ‘v’ and ‘f’ are anything other than as described here, the process quickly gets complicated and calculating the inverse transform may not be possible.
  2 个评论
L'O.G.
L'O.G. 2022-3-13
Thank you! I have a few follow-up questions to make sure I understand. Could you please elaborate on why C must take the form it does (i.e., with the conjugate)? And why t must take the form it does, including the -1? Also, I suppose in the spatial case, "frequency" is reciprocal space, and "time" is real space, or did I get that backward?
Star Strider
Star Strider 2022-3-13
My pleasure!
The ‘C’ vector is defined as it is here because that is the way MATLAB creates its fft output vectors. The second half is the complex conjugate of the first half. (This assumes that the original complex Fourier transform vector is a one-sided Fourier transform, and creates the two-sided Fourier transform from it.) This also assumes that the original tow-sided Fourier transform vector has an even number of elements, as would be the situation if the nextpow2 function would be used to define the length of the fft.
The ‘t’ vector (considered to be time here, however it can be anything) is always the length of the original time-domain vector. It is assumed here tto start at 0 so the ‘-1’ forces the lengths of the time vector and the ifft result to be the same length. I also assume here that the maximum value of the ‘f’ (frequency) vector is the Nyquist frequency ‘Fn’, half the sampling frequency, ‘Fs’. The sampling interval is then the reciprocal of the sampling frequency, so ‘1/Fs’ or ‘1/(2*Fn)’.
I believe that this covers everything. I will do my best to explain any ambiguities that remain.

请先登录,再进行评论。

更多回答(0 个)

标签

产品


版本

R2021b

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by