I've set up this case to try to understand DFT implementing a real case in Excel
Frame Size $\;\color{blue}{(T}$): 5 s
Time Sampling $\;\color{blue}{(TS}$): 0,1 s
Block Size $\;\color{blue}{(N = TT/TS+1)}$: 51
Sampling Rate $\;\color{blue}{(FS = TT/TS+1)}$: 10 Hz
Frequency Resolution $\;\color{blue}{(FR = FS/(N-1))}$: 0.2 Hz
In time spectrum I have put just 2 sines functions added
The firt sine has amplitude $\color{blue}{10}$, phase $ \color{blue}{\pi/3}$ and frequency $\color{blue}{2}$ Hz. The second sine has amplitude $\color{blue}{5}$, phase $\color{blue}{0}$ and frequency $\color{blue}{1}$ Hz: $ \color{blue}{\quad ( n = 0\; to \;50)}$
$$ \color{blue}{X[n] = 10\, \sin{(2\pi t 2 + \pi/3)}+ 5\, \sin{(2\pi t 1)}}$$
So I have generated DFT values where $\color{blue}{\; k=0\; to\; 50\quad }$ and $\color{blue}{\quad x_k=a_k + ib_k}\;$:
$$\color{blue}{a_k = (1/N) \; \Sigma_{n=0,N-1} X_n \cos{(2 \pi n k /N)}} $$ $$\color{blue}{b_k = (1/N) \; \Sigma_{n=0,N-1} X_n \sin{(2 \pi n k /N)}} $$
After, I've calculated module $\color{blue}{A}$ and phase $\color{blue}{\Phi}$ for $ \color{blue}{\; ( n = 0\; to \;50)}$
$$\color{blue}{A_k = \sqrt{(a_k)^2 + (b_k)^2}} $$ $$\color{blue}{\Phi_k = atan2(b_k, a_k)} $$
I consider in my analysis $$\color{blue}{ Freq_k = k.FS/(N-1)} $$
Now my doubt arise. In my understanding, the signal should be concentrated in the values of frequencies $\color{blue}{1}$ Hz and $\color{blue}{2}$ Hz. It is not. Not even remotely. Amplitude $\color{blue}{A_k}$ for $\color{blue}{8.2}$ and $\color{blue}{9.2}$ Hz are very strong. In short, the frequency spectrum is very noise. Also $\color{blue}{2.2}$ Hz and $\color{blue}{8}$ hz amplitudes are almost half of $\color{blue}{1}$ Hz amplitude.
I'm working with frequence sampling $\color{blue}{10}$ Hz, five times than maximum detected frequency ($\color{blue}{2}$ Hz).
What's happening?
To check if I had made a mistake, I calculated the DTF inverse and the original signal was restored exactly!
DFT frequencies may be easier to think of as going from -SR/2 to SR/2 instead of from 0 to SR. Then for real-valued input, F(-k) = conj(F(k)).