0
$\begingroup$

I have coded a discrete fourier transform script in python sageMath. I am trying to analysis the frequency spectrum of the function 1-2t. The graph for 1-2t from 0 to 4 is below:

1-2t

When I run the DFT code I get the following frequency spectrum graph.

frequency spectrum of 1-2t

The graph has a spike at zero. Then slope downward towards 0 in x-axis. But it has some spike at 0.5,1,1.5 and 2 frequencies. Does it mean the function (1-2t) is mainly composed of four sinusoids of the above frequencies. The function 1-2t is not a periodic function. But Fourier transform is used to analysis non-periodic functions to find their frequency spectrum. But if I create 4 sine wave of the frequency 0,0.5,1,1.5 and 2 Hz and add them together I do not get the graph back. I get something like the following, which is nowhere near the original graph of 1-2t.

inverse 1-2t

$\endgroup$
4
  • $\begingroup$ "But Fourier transform is used to analysis non-periodic functions": Not really. It follows directly from the definition of the DFT that all signals are periodic in both time and frequency. Analyzing non periodic functions can only be done approximately. The DFT is complex. Your synthesis looks like you took the amplitude but not the phase from the DFT. $\endgroup$ Commented May 14 at 17:37
  • $\begingroup$ Main question here is if the original graph is not composed of the above mentioned sinusoids of frequencies 0.5,1,1.5,2 etc, then why we see spikes there? $\endgroup$ Commented May 14 at 19:23
  • 1
    $\begingroup$ Look, I don't know what your background is, but you seem to have a lot of misconceptions about the Fourier Transform. The equation of the DFT is deceptively simple: the actual implications of it are mathematical quite complicated and without a solid understanding of that (sampling, periodicity, time and frequency domain aliasing, frequency res., truncation & windowing, etc.) you will not have a lot of success here. You picked a gnarly example: if you want to tackle this I strongly recommend first working out the CFT by hand and then applying the sampling process to see what happens in the DFT. $\endgroup$ Commented May 15 at 16:25
  • $\begingroup$ AL-zami: The first plot is a function of continuous time $t$ (I assume t is the continuous time variable). However, the $N$-point DFT requires $N$ points of sampled data as input. You have not specified (that I can see) anywhere what your sample period $T_s$ is, what $N$ is, and where the samples were taken. $\endgroup$ Commented May 16 at 2:30

0

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.