Horje
frequency spectrum signal python Code Example
frequency spectrum signal python
#A short example to extract the frequency spectrum of a signal
import numpy as np
import matplotlib.pyplot as plot
samplingFrequency  = 100
t=np.arange(0,5,1/samplingFrequency)
signal=np.sin(2*np.pi*t)
fourierTransform = np.fft.fft(signal)/len(signal)
fourierTransform = fourierTransform[range(int(len(signal)/2))]
tpCount     = len(signal)
values      = np.arange(int(tpCount/2))
timePeriod  = tpCount/samplingFrequency
frequencies = values/timePeriod
plt.plot(frequencies, abs(fourierTransform))




Python

Related
what is instance variable in python Code Example what is instance variable in python Code Example
find the factorial of a given integer in python Code Example find the factorial of a given integer in python Code Example
python initialize multidimensional list Code Example python initialize multidimensional list Code Example
python mp4 to mp3 Code Example python mp4 to mp3 Code Example
use python dotenv Code Example use python dotenv Code Example

Type:
Code Example
Category:
Coding
Sub Category:
Code Example
Uploaded by:
Admin
Views:
8