Open In App

Python | Numpy np.fftn() method

Last Updated : 21 Nov, 2019
Improve
Improve
Like Article
Like
Save
Share
Report

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

Syntax : np.fftn(Array)
Return : Return a N-D series of fourier transformation.

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




# import numpy
import numpy as np
  
a = np.array([-1, 3, -4, 7, 0])
# using np.fftn() method
gfg = np.fft.fftn(a)
  
print(gfg)


Output :

[ 5. +0.j -2.5 +3.61246823j -2.5-12.22497744j -2.5+12.22497744j
-2.5 -3.61246823j]

Example #2 :




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


Output :

[[-17.6 +0.j -1.1 -9.6624249j -1.1 -3.08018588j
-1.1 +3.08018588j -1.1 +9.6624249j ]
[ -6.6 +0.j -6.6 -1.7149948j -6.6-29.97513624j
-6.6+29.97513624j -6.6 +1.7149948j ]]


Like Article
Suggest improvement
Share your thoughts in the comments

Similar Reads