I am currently choosing a window function to analyze signals in frequency domain. While I understand the reasoning behind using a window function and what to look for concerning main lobe and side lobe forms, I have stumbled across the fact that the frequency domain representation of a window function that Matlab generates with the wvtool looks a lot different to what I can obtain from simply applying the fft command to my respective window function.
After some research, I now understand that the shape of the window function in frequency domain depends on how many points the fft command uses. E.g. when applying the fft command with 100 points to a window of length n=100, the result is a continuous curve. The more points I use for the fft, the more accurately the lobes start to form that are also visible in the wvtool.
I have also read in this Stack Exchange question that an fft with more points than the signal length n basically interpolates between the samples of the n-point fft and that every second point of a 2n-point fft coincides with the n-point fft.
So, can I assume that the 2n-point fft is more accurate than the n-point fft? And how would that be considering that the 2n-point fft is just created from adding n zeros to the original signal and therefore doesn't add meaningful information to the signal? And when applying ffts to signals that are not window functions: Am I generally better off just adding more points to the fft? Normally, to increase frequency resolution, I would perform an n-point fft over a larger sample size n. But no matter how large the sample size, I can never obtain the lobes of the window functions without performing an fft with more points than samples. So am I somehow missing information when performing only an n-point fft on a real-world signal?
Thanks for any help, the more I research this the more I am confused at the moment.
I have added a minimal code sample to better illustrate what I mean. ws is the window size and m is a factor to increase fft points. So e.g. use m=2 to perform a 2n-point fft.
ws = 1000;
m = 1;
hanning = abs(fft(hann(ws), m * ws)) / sum(hann(ws));
hanning = hanning / max(hanning);
hanning = hanning(1:ws/2+1);
f = (0:(1/m):(ws/(2*m)));
f = f';
figure;
plot(f, 20*log10(hanning));

hanning" as a symbol in your MATLAB code because MATLAB uses that for the Hann window. Sorta like redefiningpi. – robert bristow-johnson Sep 09 '23 at 16:29m=2but it's not. Remember that the FFT (which is a fast DFT) periodically extends the data presented to it. So which is closer to reality? A window function that is repeated right away with copies or a window function separated by some zeros. Because in the continuous-time real life, that window function is supposed to be isolated with zeros on both sides extending forever. – robert bristow-johnson Sep 09 '23 at 16:39