scipy.fftshift() in Python
Last Updated :
29 Aug, 2020
With the help of scipy.fftshift() method, we can shift the lower and upper half of vector by using fast fourier transformation and return the shifted vector by using this method.
Syntax : scipy.fft.fftshift(x)
Return : Return the transformed vector.
Example #1 :
In this example we can see that by using scipy.fftshift() method, we are able to shift the lower half and upper half of the vector by using fast fourier transformation and return the shifted vector.
Python3
import scipy
import numpy as np
x = np.arange( 6 )
gfg = scipy.fft.fftshift(x)
print (gfg)
|
Output :
[3 4 5 0 1 2]
Example #2 :
Python3
import scipy
import numpy as np
x = np.arange( 11 )
gfg = scipy.fft.fftshift(x)
print (gfg)
|
Output :
[ 6 7 8 9 10 0 1 2 3 4 5]
Like Article
Suggest improvement
Share your thoughts in the comments
Please Login to comment...