Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Python Inverse Fourier Transform of Imaginary Odd Function

I am trying to understand how the fft and ifft functions work in python. I made a simple example of an imaginary odd function to compute the inverse Fourier transform in the hopes of getting a real odd function (as should be the case). Below is my code:

v = np.array([-1,-2,0,2,1]) * 1j
t = [-2,-1,0,1,2]
V = ifft(fftshift(v))

Clearly, the function sampled by v is an odd imaginary function, so when I compute the inverse Fourier Transform and after shifting, I should get a real odd function. But this is not the case. What am I misunderstanding about the Fourier Transform? Thanks!

like image 303
Solarflare0 Avatar asked Mar 04 '19 03:03

Solarflare0


People also ask

Is the Fourier transform of an odd function odd?

Theorem 5.6 The Fourier transform of an odd function is odd. dt. = −F(−s). The Fourier transform of the even part (of a real function) is real (Theorem 5.3):

How do you do inverse fft in Python?

Compute the one-dimensional inverse discrete Fourier Transform. This function computes the inverse of the one-dimensional n-point discrete Fourier transform computed by fft . In other words, ifft(fft(a)) == a to within numerical accuracy.

How does Numpy fft2 work?

Compute the 2-dimensional discrete Fourier Transform. This function computes the n-dimensional discrete Fourier Transform over any axes in an M-dimensional array by means of the Fast Fourier Transform (FFT). By default, the transform is computed over the last two axes of the input array, i.e., a 2-dimensional FFT.

What is the inverse Fourier transform of Dirac delta function?

Since ⟨δ,f⟩=f(0) (this is the definition of δ), the unitary inverse Fourier transform of the Dirac delta is a distribution which, given a function f, evaluates the Fourier transform of f at zero. In other words, ⟨F−1(δ),f⟩=1√2π∫∞−∞f(x)dx.


1 Answers

You need ifftshift where you use fftshift and fftshift at the very end:

>>> w = fftshift(ifft(ifftshift(v)))
>>> 
>>> np.allclose(w, w.real)
True
>>> np.allclose(w, -w[::-1])
True
like image 138
Paul Panzer Avatar answered Oct 06 '22 16:10

Paul Panzer