Python | The numpy np.fft () method

NumPy | Python Methods and Functions

With the np.fft() method we can get 1-D Fourier transform with np.fft () .

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

Example # 1:
In this example, we can see that with np.fft () we can get a series of Fourier transforms using this method.

# NumPy import

import numpy as np

 

a = np.array ([ 5 , 4 , 6 , 3 , 7 ])

# using the np.fft () method

gfg = np.fft.fft (a)

 

print (gfg)

Exit:

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

Example # 2:

# NumPy import

import numpy as np

  

a = np.array ([ - 5.5 , 4.4 , - 6.6 , 3.3 , - 7.7 ])

# using the np.fft () method < / p>

gfg = np.fft.fft (a)

 

print (gfg)

Output:

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





Get Solution for free from DataCamp guru