Open In App
Related Articles

scipy.rfft() in Python

Improve Article
Improve
Save Article
Save
Like Article
Like

With the help of scipy.rfft() method, we can compute the fast fourier transformation for real sequence and return the transformed vector by using this method.

Syntax : scipy.fft.rfft(x)

Return : Return the transformed vector.

Example #1 :

In this example we can see that by using scipy.rfft() method, we are able to compute the fast fourier transformation for real sequence and return the transformed vector by using this method.

Python3




# import scipy and numpy
import scipy
import numpy as np
  
x = np.arange(5)
# Using scipy.fftfreq() method
gfg = scipy.fft.rfft(x)
  
print(gfg)


Output :

[10. +0.j         -2.5+3.4409548j  -2.5+0.81229924j]

Example #2 :

Python3




# import scipy and numpy
import scipy
import numpy as np
  
x = np.arange(10)
# Using scipy.fftfreq() method
gfg = scipy.fft.rfft(x)
  
print(gfg)


Output :

[45. +0.j         -5.+15.38841769j -5. +6.8819096j  -5. +3.63271264j

-5. +1.62459848j -5. +0.j        ]

Whether you're preparing for your first job interview or aiming to upskill in this ever-evolving tech landscape, GeeksforGeeks Courses are your key to success. We provide top-quality content at affordable prices, all geared towards accelerating your growth in a time-bound manner. Join the millions we've already empowered, and we're here to do the same for you. Don't miss out - check it out now!

Last Updated : 29 Aug, 2020
Like Article
Save Article
Previous
Next
Similar Reads
Complete Tutorials