Overlapping with flat-top window MATLAB
Higher size of your FFT best the resolution of frequencies, but of course it has a cost resulting in a longer to process !

To apply overlap you need define one window size to analyse and one hop/step to walk around your data!

This picture illustrates how this works:



Here a simple code using Window size = 2048pts and 50% overlap step!

n_samples = length(yourdata);
winSize = 2048;

%50% overlap or 0 to not use overlap
OverlapStep = 50;

if OverlapStep &gt; 0

    Overlap = floor((OverlapStep*winSize) / 100); 
    nFrames=floor(n_samples/Overlap)-1; 
else
    Overlap= winSize;
    nFrames=floor(n_samples/Overlap)-1;
end


k=1;
while ( (k+winSize-1) &lt;= n_samples )

    FrameSignal = yourdata(k:k+winSize-1);

    %%%%%%%%%% Start process FFT here  %%%%%%%%%%%%%%%%%
    w = flattopwin(winSize);  
    wdata = FrameSignal(:).*w;
    Y = fft(wdata)
    .
    .
    .

   k=k+Overlap;
end