Google News
logo
SciPy - Interview Questions
Explain SciPy FFTpack
The FFT stands for Fast Fourier Transformation. The Fourier transformation converts the time-domain signal into the frequency domain. It breaks a waveform (a function or signal) into another replacement characterized by sine and cosine. It can convert the periodic time signal whereas the Laplace transform converts both periodic and aperiodic signal.
 
There is a limitation in the Fourier transformation, it can only convert the stable time signal. SciPy provides the fftpack module, which is used to calculate Fourier transformation.
 
Fast Fourier Transform : 
 
The FFT of length N sequence x[n] is calculated by fft() function and the inverse transform is calculated using ifft().
 
#Importing the fft and inverse fft functions from fftpackage
from scipy.fftpack import fft  
#Importing numpy  
import numpy as np  
#create an array with random n numbers  
x = np.array([1.0, 2.0, 1.0, -1.0, 1.5])
#Applying the fft function  
y = fft(x)
print (y)
 
Output :
 
[ 4.5       +0.j        ,  2.08155948-1.65109876j,
       -1.83155948+1.60822041j, -1.83155948-1.60822041j,
        2.08155948+1.65109876j]

 

Advertisement