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 and numpy import scipy import numpy as np x = np.arange( 6 ) # Using scipy.fftfreq() method gfg = scipy.fft.fftshift(x) print (gfg) |
Output :
[3 4 5 0 1 2]
Example #2 :
Python3
# import scipy and numpy import scipy import numpy as np x = np.arange( 11 ) # Using scipy.fftfreq() method gfg = scipy.fft.fftshift(x) print (gfg) |
Output :
[ 6 7 8 9 10 0 1 2 3 4 5]