0
$\begingroup$

How does the n index for a window with $0 \le |n| \le N/2$ e.g the Bohman window function, get implemented when having a specific window size?

enter image description here

if (n >= 0 && n <= N/2) 

what happens with the passed in index e.g. 1000 of a 1024 window size ?

$\endgroup$
1
$\begingroup$

The window is defined as $-N/2 \le n \le N/2$ i.e. symmetric about $n=0$.

So, for a 1024 window size, $n=-512$ to $n=+511$ should give you the appropriate coefficients.

$\endgroup$
  • $\begingroup$ Thanks. So why doesnt the range indicate the -N/2, but starts from 0 instead? $\endgroup$ – jarryd Jan 4 '16 at 19:41
  • 1
    $\begingroup$ @Helium3 It says $0 \le | n | \le N/2$, so $n$ can be negative. $\endgroup$ – Peter K. Jan 4 '16 at 19:45
1
$\begingroup$

If you subtract N/2 from n in the equation, then your window will be centered at N/2, and n can range from 0 to N (e.g. larger than N/2).

$\endgroup$
  • $\begingroup$ ah, that makes sense, hence the | n |. Thanks! $\endgroup$ – jarryd Jan 4 '16 at 19:40
  • $\begingroup$ just to clarify, so the index will become a float? e.g. double bohman(int i, int N) { float index = i - N/2; double f = fabs(index)/(N/2); return (1 - f) * cos(M_PI * f) + 1/M_PI * sin(M_PI * f); } $\endgroup$ – jarryd Jan 4 '16 at 19:54

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.