# -*- coding: utf-8 -*-
"""
Created on Tue Oct 18 15:02:19 2022

@author: dsaby
"""

import numpy as np
import matplotlib.pyplot as plt
from numpy.fft import fft

t = np.linspace(0,4*np.pi,1000)
e = np.sin(2*np.pi*t)+0.5*np.sin(2*np.pi*10*t)+0.3*np.sin(2*np.pi*30*t)

T=4*np.pi
tfd=fft(e)
N=len(e)
spectre = np.absolute(tfd)*1/N
freq = np.arange(N)*1.0/T

plt.figure(figsize=(10,4))
plt.plot(freq,spectre,'r')
plt.grid()
plt.axis([-0.1,40,0,spectre.max()])
plt.show()