# Why does a longer observation time improve DFT resolution, but repeating a signal does not?

As was proven here: https://math.stackexchange.com/questions/228614/why-doesnt-repeating-a-signal-give-rise-to-a-finer-resolution-of-dft-fft repeating a certain sequence does not improve DFT frequency resolution. However, it is known that oberserving a signal for a longer time will in fact improve the ability to resolve two tones in a signal (because the 'beamwidth' of the window in the frequency domain will become narrower: it is 2/NT with NT the total observation time).

I do not understand this discrepancy: If we assume the signal has two tones f1 and f2, and has a period T. Let's say we observe it over a time N*T such that 1/(NT) becomes small enough to distinguish f1 and f2. We have improved the frequency resolution by observing the signal over a longer time. Why is this not equivalent to simply observing the signal for 1 period, and then paste it together N times? This will give the same signal in the time domain, but according to the proof in the link that I posted, it will not improve the frequency resolution.

The only explanation that I can think of myself is: observing for a longer time period does not improve the frequency resolution further once the observation time becomes larger than T. However, I have written some matlab code where I do an FFT on a pure sine over a certain time. I clearly see the 'beam width' in the frequency domain associated with the windowing start to narrow down as I increase the observation time. Given that a pure sine is also periodic and the observation times that I used are bigger than this period, I must thus conclude that my 'explanation' is incorrect.

Could someone try to show me the correct explanation?

• Your setup is unclear. In the Matlab description you apply a windowing function to the signal? Do you take the windowed signal for the repetitions, or the raw signal that then gets windowed before applying the FFT? Btw., if you have full periods then no windowing is necessary, the continuation of the raw signal segment as a periodic function (which is implicit in the discrete Fourier transform) is already continuous (and smooth for combinations of sine signals). Mar 5 '21 at 16:34

Why is this not equivalent to simply observing the signal for 1 period, and then paste it together N times?

It's only equivalent if certain conditions are met. Let's look at a single sine wave with frequency $$f_0$$ and period $$T_0 = 1/f_0$$. Sample rate is $$f_s$$, sampling period $$T_s = 1/f_s$$ and DFT length is $$N$$.

The input to the FFT would be $$x[n] = sin(2\pi \cdot f_0\cdot T_s \cdot n), 0 \leq n < N$$

Now let's create two signals of length $$2N$$: one with double the length and one with pasting two buffers together. $$x_1[n] = sin(2\pi \cdot f_0\cdot T_s \cdot n), 0 \leq n < 2N$$

and $$x_1[n] = sin(2\pi \cdot f_0\cdot T_s \cdot mod(n,N)), 0 \leq n < 2N$$

The only difference is that modulo function in the second one, but it's important. It basically resets the counter to 0 when it reaches an integer multiple of N. In general this will create a discontinuity in the signal. It forces $$x_2[N] = x_2[0] = 0$$ even if $$x[N]$$ would be non zero. The first halves of $$x_1$$ and $$x_2$$ are the same but the second halves are not. $$x_1$$ is still a sine wave but $$x_2$$ isn't anymore.

The ONLY case where pasting is the same as making the signal longer is if the period of the signal is an integer multiple of the sampling period. In this case, there is no discontinuity and both cases are identical. And sure enough, in this case the DFT will resolve two different frequencies perfectly (as long as both meet the integer multiple condition).

A more philosophical interpretation: Making the signal longer provides more information. Pasting buffers just repeats information you already have, so you are not gaining anything new.

Why is this not equivalent to simply observing the signal for 1 period, and then paste it together N times?

Because that statement presupposes that you already know how long one period is. If you do -- problem solved! If you don't -- you're not meeting the prerequisites for that statement!

In general (if there is any noise or measurement uncertainty, etc.) you can't be sure if your repeated waveform is exactly one period or not. Your pasting could add a glitch between what you suspect to be full periods, but are actually slightly shorter or longer waveforms than exactly one period. Or, what you suspect to be identically repeating periods might not be exactly identical, but contain some changing spectrum or modulations.

The more periods you gather, the less opportunity there is to add a discontinuity between each period, and the less weight there is for any discontinuity at the very beginning or end, compared to all the continuous periods in between. And any differences between what you suspect to be identical periods will show up. So your FFT becomes more informative.

Of course, if you know exactly what constitutes your original signals (period(s) and complete spectral composition) with no possible modulations, error in period length, or noise, then you don't need to do an FFT at all. In that case, the FFT provides nothing you don't already know, so you can hack your FFT (fake input and length, synthetic duplication, etc.) to produce the exactly the result you want or know. (But if you are mistaken about any of this, all bets that this result is meaningful are off.)

In summary, a longer signal capture (fed to a longer FFT) potentially gathers more information than you might already have. Or not have.

With no disagreement to the other two answers previously provided; we can equally describe the longer signal as having higher frequency resolution, but if you simply copy and pasted the result from a shorter segment, then there will be no other signal to resolve that are within that resolution. Consider the reverse case to see how this is true:

Consider a 1 Hz waveform combined with a 1.1 Hz waveform that is 50 dB lower (so not visible without doing a log plot). Consider one capture that is 10 seconds long, and then compare that to another capture starting at the same phase but only 1 second long in which we repeat that capture 10 times. The 1.1 Hz waveform requires 10 seconds to complete one cycle relative to the 1 Hz waveform; after every 10 seconds the characteristics of the combined waveform will be identical to a waveform that continues for infinity, but this is not at all the case with the waveform we made up by copy and pasting the 1 second captures; in that case we had a partial 1.1 Hz waveform that was truncated and repeated at a 1 Hz rate. In both cases we have the same resolution, but the waveform we are resolving is very different.

• Thank you, I agree with what you are saying, but in that case we are not copy-pasting a full (or an integer number of) period(s) of the signal that we are interested in! :) I am specifically interested in that case. Mar 3 '21 at 13:04
• So in other words for the example you would need to copy and paste 10 seconds to get the full number of periods, right? Then you are also saying there is nothing else within that higher frequency resolution for you to see--- that doesn't mean the resolution isn't there, it just means you already know the other spectrum that you would possibly see isn't! I am looking at it as if I received the waveform from someone else and didn't know if they copy and pasted or not. Mar 3 '21 at 13:06
• Here is another good example: Compare the DFT of a zero padded waveform to the cut and paste waveform (the zero padding provides more samples on the DTFT, and in the DTFT the frequency resolution of both cases is clearly visible). Mar 3 '21 at 13:10
• Understood: the narrower spectra come from the longer windowing, but we do not need these smaller spectra: If we know that N is the period of the total signal, then we will be able to resolve the two tones that the signal consists of, as soon as we observe at least N samples! Mar 3 '21 at 13:32
• This is true if you are creating the signal. If you are analyzing the signal then the total duration is critical to the frequency resolution achieved (and even in that case replicating the signal will not improve the resolution (ability to see closely spaced signals) for the example I gave. Mar 3 '21 at 13:34

Say $$x[n]$$ is a sequence of length $$N$$, and let $$x_e[n]$$ be an $$M$$-fold copy of that, of length $$L=NM$$.

If you observe the $$L$$-point DFT spectrum $$X_e[k]$$of $$x_e[n]$$ you will see that it has $$M-1$$ zeros in between every DFT coefficient $$X[k]$$ of $$x[n]$$.

Those zeros are mathematically forced by the copy-paste operation of your proposed method of high resolution analysis. And it indicates the following: You cannot fill-in between the already existing available information $$X[k]$$, by mereley copying an existing block of samples of $$x[n]$$.

Your method cannot produce new information. Therefore, the apparently new high-resolution frequency bins are by default set to zero. They apparently exist but they are set to zero; useless.

And this is totally normal: If you are mathematically certain that your original signal had a period of $$N$$ samples, then your resolution will not improve by oberserving it any longer than $$N$$ samples. This is only true for periodic signals. Those high resolution bins are indeed zero, in that case.

If the signal is bandlimited but not mathematically periodic, then you should observe it indefinetely long to get the complete definition of the signal; hence to resolve it finer in frequency domain.

In most practical cases however, there is a limit of observation length too. You cannot arbitrarily wait to observe the signal to get an exact resolution, rather you just observe it sufficiently long for your application.

• Thank you for your explanation! Just one question: 'And this is totally normal: If you are mathematically certain that your original signal had a period of N samples, then your resolution will not improve by oberserving it any longer than N samples. This is only true for periodic signals.' Does this not contradict the fact that the frequency spectrum (after performing a DFT) of a sine gets a more and more narrow beamwidth for longer observation times? Mar 3 '21 at 12:29
• @Ariane no it does not. What you forget is that the narrowing spectrum does not belong to the ideal sine wave but a finite length windowed version of it. And indeed, in that case if you increase the length of the sine wave you will get narrower beamwdith spectrum; which actually belongs to the implicitly applied rectangular window's DFT and not to the ideal sine wave's... Mar 3 '21 at 13:19
• Does this mean this is correct: let's say we have a periodic signal with 2 tones that we want to resolve. Even though a longer observation time (so in fact, a longer rectangular window) gives me a narrower spectrum - as soon as my observation time is longer than N samples (N being the period of the signal) the narrower spectra will not improve my resolution for this signal, because we can already resolve the two tones as soon as we observe as long as N? This means that yes, we get narrower pulses, but we do not need them as long as we know that our total period is (a submultiple of) N. Mar 3 '21 at 13:31
• Yes. If you are certain that the signal has a period of N samples. That's it. Get those N samples and take its N-point DFT... Had you waited longer, you are just filling zeros in between the available spectrum. Note that for visual purposes, you can take M*N point DFT by M-fold repeating x[n]: it will improve the clarity of the separation between the bins. Yet for spectral resolution purposes you do not need to observe that periodic signal more than N samples. Mar 3 '21 at 13:38

Your sample probably has 2 main frequencies and a slew of "noise" frequencies. If you repeat your sample, the FFT will just show you that slew of noise. If you get new samples, they will still have your 2 main frequencies, but the noise frequencies will have changed. Eventually your noise frequencies will wash each other out and all that will remain is your 2 main frequencies.

• I think what you are talking about is a different averaging mechanism though (noise averaging). Even if your input signal is completely noise free and only contains your two wanted tones, you will not be able to resolve these two tones unless you observe it long enough (long enough being 1/(delta_f)). Of course in a real system you also need to average out the noise, but you can do this by taking new measurements of the first part of a signal, while to distinguish the two tones you really need to measure a complete period. Mar 5 '21 at 8:30
• To be more clear: let us say we have a noisy signal of period T, contatining 2 frequencies with difference delta_f. To average out the noise, we can measure a part of the signal for a duration S<T, and measure this part again and again, at different times. Adding them, the noise will average out. But to actually be able to resolve the two tones, we need to measure at least a complete period T. (I agree that doing multiple measurements will improve the SNR, but I believe this is a different problem than the frequency resolution issue that I had.) Mar 5 '21 at 8:33

Let's ignore about Fourier for a bit, and certainly DFT/FFT – those are just implementation details. The problem is equivalent to this:

Determine the value of $$\pi$$ by counting zero crossings of the sine function.

For example, we can count the amount of zeroes in the interval $$[0,100]$$. It turns out there are 32 of them, which gives us an estimate of $$\pi \approx \frac{100}{32} = 3.125$$ Now, to make this more accurate, consider two approaches:

• Use the same function value, but pasted end-to-end 10 times. This obviously gives us the exact same result, because both the interval length and the number of zeroes is increased tenfold. $$\pi \approx \frac{1000}{320} = 3.125$$
• Use the actual sine function, evaluated on the interval $$[0,1000]$$. There we find 319 zeroes, giving us the better estimate $$\pi \approx \frac{1000}{319} \approx 3.13480.$$
Do it on $$[0,100000]$$ and the estimate improves to $$\frac{100000}{31831} \approx 3.1415915302.$$

This only works because we're dealing with the actual sine function, which continues over the whole real line. When simply repeating the $$[0,100]$$ interval, we're instead dealing with this function:

• while it's ok to add yet another point of view, I think OP states that he knows the period. He is not observing the signal in an arbitrary frame length, but over an exact number of periods. What he wonders is if we should we observe it over multiple periods to increase the spectral resolution; to which my answer is no. One period is sufficient. Mar 3 '21 at 22:20