0
$\begingroup$

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

$\endgroup$
1
  • $\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, 2017 at 22:32

1 Answer 1

0
$\begingroup$

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
$\endgroup$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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