Skip to content Skip to sidebar Skip to footer

Strange Phase For Gaussian Beam 2d

I have Gaussian beam in 2D: After doing fft2 and angle I get strange results: def finite2D(x,y, N, M, a, hx): f = np.array([[0.0]*N]*N) for i in range(len(x)): f

Solution 1:

The FFT asumes that the origin is in the top-left corner of the image. Thus, you are computing the FFT of a Gaussian shifted by half the image size. This shift leads to a high-frequency phase shift in the frequency domain.

To solve the problem, you need to shift the origin of your Gaussian signal to the top-left corner of the image. ifftshift does this:

f = fftpack.ifftshift(f)
D1 = fftpack.fft2(f)
D2 = fftpack.fftshift(D1)

Note that where the magnitude is very small, the phase is defined by rounding errors, don’t expect zero phase there.


The updated result looks good, but there still is a very small gradient in the central region. This is caused by the half-pixel shift of the Gaussian. This shift is given by the definition of the x and y coordinates:

N = 128x = np.linspace(-a, a, N)
y = np.linspace(-a, a, N)

For an even-sized N, do

x = np.linspace(-a, a, N, endpoint=False)
y = np.linspace(-a, a, N, endpoint=False)

such that there is a sample where x==0.

Post a Comment for "Strange Phase For Gaussian Beam 2d"