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.

enter image description here

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.xlabel(r'Frequency ($\times 2\pi$)')
    plt.xlim([-0.01, 0.51])

def run():
    a = 2
    n = 100
    x = np.ones(n)
    for i in range(n):
        x[i] = a*i  

  • $\begingroup$ Entry 308 refers to $x^n$ not $x \cdot n$. Closing until you clarify. Plus, all of those entries in the table are for the continuous-time Fourier transform, not the discrete Fourier transform implemented by the FFT in Python. $\endgroup$
    – Peter K.
    Mar 23, 2022 at 15:40
  • $\begingroup$ 1. When n=1, the function is x, and the continuous FT of a*x can be obtained by a * the FT of x. 2. Yes. It is not correct to compare the result from discrete FT and continuous FT. $\endgroup$
    – Jayyu
    Mar 23, 2022 at 16:17

1 Answer 1


Your code implements the Discrete Fourier Transform (DFT) your equations describe the continuous Fourier Transform (CFT). They are quite different.

The DFT is applicable if the signal is discrete in both time and frequency, which implies that the signals are also periodic time and frequency as well.

Your signal is neither periodic or even just limited in time, frequency or amplitude. Converting it to a discrete signal will generate large errors, no matter how you do it. You are in essence approximating the CFT of a sawtooth wave not a ramp.

Sometimes the DFT can be used to numerically approximate the results of a CFT, but in your case this is not going to work.

  • $\begingroup$ I modify the title and the first equation because the signal is discrete. Can you elaborate on why the DFT is only applicable to signals that are "periodic time and frequency as well"? $\endgroup$
    – Jayyu
    Mar 23, 2022 at 15:30
  • $\begingroup$ @Jayz That doesn't change that the table you refer to is for the Fourier transform (continuous time variable) not the discrete Fourier transform as implemented in Python's scipy.fft.fft. $\endgroup$
    – Peter K.
    Mar 23, 2022 at 15:42
  • $\begingroup$ Everything that's discrete in one domain is periodic in the other. That's a fundamental mathematical property of the Fourier Transform. $\endgroup$
    – Hilmar
    Mar 23, 2022 at 18:40

Not the answer you're looking for? Browse other questions tagged or ask your own question.