In general, the sine-cosine signal is sampled and the DfT is calculated, and the spectrum is shown to be not clean. This phenomenon is called spectral leakage. Because the DFT operation can only be a finite sequence, a sudden truncation creates a leak.
There is a special case where the spectrogram is particularly clean when the sampling intercept is exactly the whole number of cycles. Can be understood as just take the complete cycle, the periodicity is obvious, the frequency is relatively single.
MATLAB experiment was done for this purpose:
TS = 0.01;% Sample Rate 100Hz
n = 0:n-1;
y = sin (2*pi*20*n*ts);%20hz signal, 5 points per cycle
XK = ABS (FFT (y,n));% Note According to the FFT algorithm, here n and sequence length n are the same
Stem (XK);
When n = 20, 22, 24, 25 o'clock of the spectrum:
Since 20 and 25 are multiples of 5, the period taken is complete, so the spectrum is clean. This is the so-called special case.
However, in general, without the complete cycle, the spectrum leakage can not be avoided. And the severity of the leak will affect the ability to distinguish. The next question, then, is how to improve the resolution.
We try to sample the number of points, and the FFT points are increased. When n=64 the spectrum:
Usually the number of DfT points can be increased, the number of sampling points will not increase, so we have the method of zero.
In the example above, the 64-point DFT, but N is 0:24, followed by the complement 0, that is, y = [sin (2*pi*20*n*ts), zeros (1,39)]; 64 points. The resulting spectrum is:
We'll take the higher points. When the sample count equals the frequency spectrum of the DfT number equal to 1024:
When the sampling number is added to the 1024-point spectrum by means of a zero complement:
So we have important conclusions:
In order to make the spectrum more accurate, that is, to approximate the waveform of DTFT, there are two methods. The first approach is to increase both the sample length and the DfT length, which, if possible, can be used in such a way as to improve the actual resolution and reduce the leakage. The second method is to increase the length of the DFT, while the sampling length is the same length as the complement zero. This method only increases the apparent resolution, which leaks or leaks.