# Taking an inverse spatial fft in MATLAB

조회 수: 6 (최근 30일)
L'O.G. 2022년 3월 13일
댓글: Star Strider 2022년 3월 13일
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 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. 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 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.

댓글을 달려면 로그인하십시오.

### 카테고리

Help CenterFile Exchange에서 Fourier Analysis and Filtering에 대해 자세히 알아보기

R2021b

### Community Treasure Hunt

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

Start Hunting!

Translated by