Python | Numpy np.fft2 () method

NumPy | Python Methods and Functions

Using the np.fft2() method, we can get a two-dimensional Fourier transform using np.fft2 () .

Syntax: np.fft2 (Array)
Return: Return a 2-D series of fourier transformation.

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

# NumPy import

import numpy as np

 

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

# using the np.fft2 () method

gfg = np.fft.fft2 ( a)

 

print (gfg)

Exit:

[[10 ... + 0.j 8.09016994 + 2.17962758j -3.09016994 + 9.23305061j
-3.09016994 - 9.23305061j 8.09016994 - 2.17962758j]
[40. + 0.j -5.85410197 + 0.j 0.85410197 + 0.j
0.85410197 + 0.j -5.85410197 + 0.j]]

Example # 2:

# NumPy import

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 the np.fft2 () method

gfg = np.fft.fft2 (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]]





Get Solution for free from DataCamp guru