Skip to content
Related Articles
Get the best out of our app
GeeksforGeeks App
Open App
geeksforgeeks
Browser
Continue

Related Articles

scipy.fftshift() in Python

Improve Article
Save Article
Like Article
Improve Article
Save Article
Like Article

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]

My Personal Notes arrow_drop_up
Last Updated : 29 Aug, 2020
Like Article
Save Article
Similar Reads
Related Tutorials