I'm very new to Python and I have a basic understanding problem. To me it seems that the result of an FFT is just based on the linspace chosen by oneself.
# Number of samplepoints
N = 600
# sample spacing
T = 1.0 / 800.0
x = p.linspace(0.0, N*T, N)
y = p.sin(50.0 * 2.0*p.pi*x) + 0.5*p.sin(80.0 * 2.0*p.pi*x)
yf = p.fft(y)
xf = p.linspace(0.0, 1.0/(2.0*T), N/2)
plt.plot(xf, 2.0/N * np.abs(yf[0:N/2]))
plt.grid()
plt.show()
By running this fft as an example I get two spikes, at 50 and at 80 Hz. When I change xf to:
xf = p.linspace(0.0, 5.0/(2.0*T), N/2)
the spikes are around 250 and 400 Hz.
Doesn't this mean, that I have to know the correct results beforehand (in this case the frequencies of the two sinus waves the input signal consists of), so that I can later adjust the scaling of the axis to fit those results? Probably not, so I'd be glad if someone could explain this problem.