I am still relatively new to signal processing and MATLAB and am working on a short-time fourier transform of some data using a prexisting code. Within the code a Hamming window is produced and multiplied by the signal prior to an fft.

The function itself works correctly, however I want the peak of the Hamming window to be over the first sample, rather than the midpoint (i.e shifting the Hamming window back by (no of samples/2)). What would be the simplest way to achieve this zero meaning?

This is the current generation and application of the Hamming window, where ncol is the number of time windows being used in the stft.

y = window(:,ones(1,ncol)).*y;

Any help is greatly appreciated.



w = w([(end/2+1):end 1:end/2]);


w = circshift(w, ncol/2);
  • $\begingroup$ thanks, this still leaves me with some other problems (im getting wrap around etc) and have an have to zero pad my data bit, but this helps a lot $\endgroup$ – MattC1990 Aug 13 '20 at 16:26

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.