I'm working on a project where I need to generate a LUT for Hamming Window to perform a FFT.

I'm using this function (doing the table with MATLAB):

n = 0:4095;
LUT_length = length(n);
WIN_HAM_v = round(4095*(0.54-(0.46*cos(2*pi*n/(LUT_length-1)))));

I have some doubts if the function is correct

  • $\begingroup$ Can you ask a more specific question? For instance, what do you expect your code to do, and what is it actually doing? $\endgroup$ – MBaz Jan 23 '17 at 22:32

Your code is correct.

This can also be implemented by calling the built-in MATLAB function hamming:

WIN_HAM_v = round(4095*hamming(LUT_length));

You can (should) compare the two methods yourself:

win1 = 4095*(0.54-(0.46*cos(2*pi*n/(LUT_length-1)))); 
win2 = 4095*hamming(LUT_length);
maxError = max(abs(win1(:)-win2(:))); 
% result: 2.2737e-12

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.