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
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
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
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';