I want to work with fast fourier transform using the numpy fft package, and then I am trying to compare the results between the analytical solution and the fast fourier transform, and although I can see with the plots I have done that the curves are similar, it is pretty obvious that the scales are different.
I have tried several different versions of the frequency (angular frequency, frequency and wave number), but all my tries did not work, and in the numpy documentation, it is not clear how the fast fourier transform is exactly defined. For example, I want to work with the fourier transform of the exponential function in time into the angular frequency domain, f(t)=Exp(-a|t|), F(w)=a/pi*(a²+w²) (there are multiple versions of this analytical solution depending on which frequency space we are considering)
def e(t):
return np.exp(-0.5*abs(t))
def F(w):
return 0.5/(np.pi)*(1/(((0.5)**2)+((w)**2)))
t=np.linspace(0,100,1000)
w=np.fft.fftfreq(len(t))
plt.plot(w,F(w),'o',label='F(w)')
plt.legend()
plt.show()
fourier=np.fft.fft(e(t))
plt.plot(w,fourier,'o')
plt.show()
I have tried multiple different variants of the above code specially for the frequency, but I am still not getting to the point where the fft and the analytical solution are similar. could anyone please help me out?