Consider a time series dataset generated by a linear function
$$y = a \cdot n, \; n=0,1,...,N$$
According to this reference (entry 308 in the table for one-dimensional functions), the analytical solution of Fourier transformation is given by:
$$ f(\xi) = a\left(\frac{i}{2 \pi}\right) \delta^{'}(\xi) $$ where $\delta^{'}$ is the first distribution derivative of the Dirac delta function. So the amplitude of frequencies other than zero should be zero, i.e.:
$$f(\xi)=0, \forall \xi \ne 0$$
However, using scipy.fft in Python, the result is different: the amplitude for frequencies greater than zero is not zero.
What could be the reason for the difference?
from scipy.fft import fft, fftfreq
def my_fft(x):
deltaT = 1
# Number of sample points
N = len(x)
xf = fftfreq(N, deltaT)[:N//2]
yf = fft(x)
ampl = 1/(N/2) * np.abs(yf[0:N//2])
plt.figure(figsize=(4, 3), dpi=300)
for i in range(len(xf)):
plt.vlines(x=xf[i], ymin=0, ymax=ampl[i])
# plt.plot(key_list[i], value_list[i])
plt.ylabel('Amplitude')
plt.xlabel(r'Frequency ($\times 2\pi$)')
plt.xlim([-0.01, 0.51])
plt.grid(axis='y')
plt.show()
def run():
a = 2
n = 100
x = np.ones(n)
for i in range(n):
x[i] = a*i
my_fft(x)
run()