Python | Numpy np.fft() method

With the help of np.fft() method, we can get the 1-D Fourier Transform by using np.fft() method.

Syntax : np.fft(Array)
Return : Return a series of fourier transformation.

Example #1 :
In this example we can see that by using np.fft() method, we are able to get the series of fourier transformation by using this method.



filter_none

edit
close

play_arrow

link
brightness_4
code

# import numpy
import numpy as np
  
a = np.array([5, 4, 6, 3, 7])
# using np.fft() method
gfg = np.fft.fft(a)
  
print(gfg)

chevron_right


Output :

[25. + 0.j 1.11803399 + 1.08981379j -1.11803399 + 4.61652531j
-1.11803399 – 4.61652531j 1.11803399 – 1.08981379j]

Example #2 :

filter_none

edit
close

play_arrow

link
brightness_4
code

# import numpy
import numpy as np
  
a = np.array([-5.5, 4.4, -6.6, 3.3, -7.7])
# using np.fft() method
gfg = np.fft.fft(a)
  
print(gfg)

chevron_right


Output :

[-12.1 + 0.j -3.85 – 5.68870985j -3.85 – 16.52766106j
-3.85 + 16.52766106j -3.85 + 5.68870985j]



My Personal Notes arrow_drop_up

Check out this Author's contributed articles.

If you like GeeksforGeeks and would like to contribute, you can also write an article using contribute.geeksforgeeks.org or mail your article to contribute@geeksforgeeks.org. See your article appearing on the GeeksforGeeks main page and help other Geeks.

Please Improve this article if you find anything incorrect by clicking on the "Improve Article" button below.