MATLAB: How to change the window length??

fftwindow length

I am implementing an FFT over 2 sin signals which are placed at frequencies 300Hz and 380 Hz as the frequency components are very close to each other,I cant resolve then and i know if i increase the window length tbut i cannot change the window length is it possible to change window length in a normal FFT or should i consider the STFT???

Best Answer

Yes in the sense that they will typically change the DFT bin in which they are located, but you have to remember that the frequency axis changes too, which you did not do above.
Fs = 1e3;
t = 0:1/Fs:(100*1/Fs)-1/Fs;
x = cos(2*pi*300*t)+cos(2*pi*310*t);
xdft = fft(x,256);
freq = 0:Fs/256:500;
stem(freq,abs(xdft(1:256/2+1)));
xlabel('Hz'); ylabel('Magnitude');
Related Question