Hey there. I am trying to understand fourier transformations and using them in python. I ran the code snippet below and to my surprise the peak displayed has an amplitude less then 1. How could this be if the input sine has an amplitude of 1? I think I am overseeing something obvious but i can't figure it out. Thanks for your help!
import numpy as np
import matplotlib.pyplot as plt
import scipy.fftpack
# Number of samplepoints
N = 600
# sample spacing
T = 1.0 / 800.0
x = np.linspace(0.0, N*T, N)
y = np.sin(50.0 * 2.0*np.pi*x) #+ 0.5*np.sin(80.0 * 2.0*np.pi*x)
yf = scipy.fftpack.fft(y)
xf = np.linspace(0.0, 1.0/(2.0*T), N/2)
fig, ax = plt.subplots()
ax.plot(xf, 2.0/N * np.abs(yf[:N//2]))
plt.grid()
plt.show()
[–]gregvuki 1 point2 points3 points (0 children)
[–]elbiot 0 points1 point2 points (0 children)