What does it mean for a power spectral density exhibiting leakes from one frequency bin to other.
I am reading a book which states the following:
"Often the time series we use as input for our algorithm will have a non-zero DC average, which may even slowly change over time. Such a DC average will show up in the first frequency bin (m = 0) of the resulting spectrum. If a window function is used or the average changes over time, it will also leak into adjacent frequency bins, possibly masking low-frequency signals."
Could somebody explain what does this mean? Why does a window leak power into adjacent frequency bins?
I also read the following which has probably a similar connection and it would be good to get an explanation on this as well:
"If we simply take a stretch of length N out of a time series containing a sinusoidal signal and perform a DFT, we will most likely find that the sinusoidal signal which we might naively expect to result in a sharp peak in only one frequency bin, will instead show up as something ugly, The reason is that the DFT implicitly assumes that the signal is periodic, i.e. that the time series of length N repeats itself infinitely in a cyclic manner. If the frequency of the sinusoidal input signal is not an exact multiple of the frequency resolution fres, i.e. does not fall in the exact center of a frequency bin, this assumption is not true, and the DFT will ‘see’ a discontinuity between the last sample and the first sample due to the cyclic continuation. That discontinuity spreads power all across the spectrum"
What does it mean for DFT to "see" a discontinuity as written above"?
EDIT:After accepting answer:
I ran a MATLAB simulation (code below) in which the frequency of sinusoidal is exactly a multiple of resolution of the PSD and thus falls directly at the center of a frequency bin, still there is leakage into neighboring bins (3 to the right and three to the left of this bin in which the sinusoidal lies). This spilling gets more and more resolved as I increase the window length. Which would seem to suggest that even the frequencies that fall directly at the center of frequency bins leak into the adjacent frequency bins and the amount of leakage will depend on the shape of the window and the length of the window. Is this understanding correct?
MATLAB code:
%%%%%%%%%%%%%%%%%%%% PSD Estimation%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
close all;
N=50; %number of periods
Fs= 4096;
snr=10;
M=256; %length of FFT
Fres=Fs/M;
Mul_factor=20;
F_c=Fres*Mul_factor; %in Hz%
Window_length=128;
Overlap=floor(0.4*Window_length);
x=0:1/Fs:N*(1/F_c);
y=sin(2*pi*x*F_c) + 1/sqrt(snr).*randn(1,length(x));
[ppx,w]=pwelch(y,Window_length,Overlap,M,Fs);
figure;
hold on;
subplot(2,1,1);
plot(x,y);
subplot(2,1,2);
plot(w,ppx);
hold off;