# DFT: Why is the total time equal to $N\cdot T_s \quad \text{and not}\quad (N-1)\cdot T_s$? [duplicate]

In the definitions of the DFT

DFT $$X(j)=\sum_{k=0}^{N-1} x(k) \exp \left(-i 2 \pi\left(\frac{j}{N}\right) k\right)$$

Let us say, if we have $$10$$ points, $$N=10$$, each sampled at $$0.2$$ seconds, why is the total time used for calculating the frequency resolution is equal to $$\frac{1}{N\Delta t }$$

where $$k$$ will run from $$0, 1, 2, \ldots , 9$$.

If the first point was at zero, the sampled time will be at $$0.2$$, and the last sampled point will be at $$0.2\cdot (N-1)= 0.2\cdot 9 = \mathbf{1.8 \ \rm s}$$

Rather the total time is equal to $$0.2\cdot N= 0.2\cdot 10=\mathbf{2.0 \ \rm s}$$ in the frequency step.

P.S.: I have seen the query and the discussion How do I measure the time duration?

Here $$\Delta t = 0.1 \ \mathrm{s}, N= 11 (\text{Eleven data points}), k= N-1$$; So

$$\text{total signal duration} = k\cdot \Delta t = (11-1)\cdot \Delta t= 1 \ \text{second}$$

This agrees with the $$10 \rm \ Hz$$ sampling rate, i.e., $$10$$ points were collected in $$1 \ \text{second}$$ and the $$11^{th}$$ point belonged to the next cycle.

• Dilip I had read this answer before posting it. There were many answers but I had this specific query in mind. – M. Farooq Nov 21 at 20:47
• But I don't see how your question is not answered by these answers! – Marcus Müller Nov 22 at 1:38
• @MarcusMüller This is not a duplicate of the referred post, and is closer to this one, but neither answer or explain it directly enough. I'd vote to reopen. – OverLordGoldDragon Nov 22 at 11:12
• OP, there's more to the story - I'd encourage you to open a new question, nearly same as this one, but add "how is this related to normalized frequency?", as that'd disqualify it further as a duplicate and is actually key to your question. -- @MarcusMüller I forgot you couldn't hammer-close this; long shot to get 5 reopen votes. – OverLordGoldDragon Nov 22 at 11:45
• Rather, let me clarify: is your question why the frequency resolution is defined as $(N\Delta t)^{-1}$, or why that's the duration? These are separate questions; if you ask about former, this is a duplicate (though still not entirely as the connection isn't necessarily obvious). – OverLordGoldDragon Nov 22 at 11:51

You are right, the duration associated with taking $$N$$ uniform samples of a signal is

$$D = (N-1) \cdot T_s$$

where $$T_s$$ is the sampling period.

A concrete example is sufficient; assume your sampling period $$T_s$$ is 1 hour long, and you want to take 3 samples of a slowly changing process, such as the height of an iceberg tip while it's melting.

Your first sample is taken at $$t=0$$ (the electronic sampling process itself takes about a micro second or less, so ignore it compared to an hour of sampling-period!). Then your second sample arrives at $$1$$ hour later and your third (and final) sample arrives at $$2$$ hours later.

Hence your $$3$$ samples long observation takes $$D = (3-1) \cdot 1 = 2$$ hours long. As soon as you take your last (third) sample, you shut down the sampling system. You do not wait one more hour (one more sampling interval) after taking your last sample.

And this methodology of calculation is exactly on par with calculating distances within crystal lattice structures. What's the distance between N atoms? What's the total length of N atoms (regularly placed on x-dimension) ?

Nevertheless, in the literature, you can find expressions involving $$D = N \cdot T_s$$. Some applications may require that; i.e., block based signal processing, DFT, sample rate conversion make use of such a viewpoint, which is justified in their processing of data blocks one after other.

To understand why $$D = N \cdot T_s$$ may be used in DFT analysis, consider the following example. Assume you have long data set, such as $$4 \cdot N$$ samples, divided into 4 blocks of $$N$$ samples; i.e, you will have 4 blocks of $$N$$ samples each. The blocks are adjacent, their sample orders are (1,N) ,(N+1,2N) , (2N+1,3N) , (3N+1,4N). The sample $$N+1$$ belongs to second block, but the duration of first block is measured beginning from the sample 1 up to sample N+1. Because, the duration between the samples N and N+1 belongs to the first block, and this explains why the duration of that block is taken as $$D = N \cdot T_s$$. However, for the last block of samples (3N+1,4N), the duration will be $$(N-1)\cdot Ts$$, as there are no more adjacent blocks.

Last but not least, this is a topic of debate. :-)

• Thanks for the confirmation, but why the frequency step in DFT = 1/N*delta(t)? I haven't much of crystal structure myself, but my interest is in improving chromatography peak shapes using FT methods. – M. Farooq Nov 21 at 21:37
• @M.Farooq editted... – Fat32 Nov 21 at 22:04
• Interesting analysis. So you think this is still open ended? In all DFT analysis, I checked, especially the old classical tutorials from 1960s, they take total duration as N*delta t. – M. Farooq Nov 22 at 0:11
• No the concept of duration is not open ended, instead, what is open ended is the precise meaning of the term frequency resolution... you may just use the duration to be N x Ts, but you cannot be sure what the exact consequence of the numbers you get to reresent the freq-resolution as a result. – Fat32 Nov 22 at 0:35
• A friend emailed me to convince that the total duration of a signal can also be understood from sampling rate as well. If our sampling rate is 10 Hz, and we collect data for 1 sec starting for 0, and a sine wave of 1 Hz, we will see 11 points. The 11th point exactly at 1 s. But that last 11th point belongs to the next cycle. By definition, we should have 10 data points in a second. However, the dilemma is that the total duration is then (11-1)*0.1= 1 sec. The total duration is then (N-1)*Ts. – M. Farooq Nov 22 at 0:46