Fourier transform of a Gaussian is not a Gaussian, but thats wrong! - Python

后端 未结 5 1569
萌比男神i
萌比男神i 2020-12-30 10:46

I am trying to utilize Numpy\'s fft function, however when I give the function a simple gausian function the fft of that gausian function is not a gausian, its close but its

5条回答
  •  醉梦人生
    2020-12-30 11:29

    It is being displayed with the center (i.e. mean) at coefficient index zero. That is why it appears that the right half is on the left, and vice versa.

    EDIT: Explore the following code:

    import scipy
    import scipy.signal as sig
    import pylab
    x = sig.gaussian(2048, 10)
    X = scipy.absolute(scipy.fft(x))
    pylab.plot(x)
    pylab.plot(X)
    pylab.plot(X[range(1024, 2048)+range(0, 1024)])
    

    The last line will plot X starting from the center of the vector, then wrap around to the beginning.

提交回复
热议问题