# hann function

I am trying to implement hann function according to http://en.wikipedia.org/wiki/Hann_function but I dont understand what "n" and "N" stand for. I want to use hann function for FFT processing.
###### Who is Participating?

x
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

Commented:
As best as I can decode the function, it appears that "n" is your input variable (just like "x" is in the simple function f(x) = 2x+1.

"N", on the other hand, appears to be the number of samples you have.  So for example, if you have 100 samples, N = 100, and "n" ranges from 0 to 99.

Experts Exchange Solution brought to you by

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

\Commented:
When you do an fft, you choose how many samples you wish to work with. This is the Window size, N. Typically, you want N to be a power of 2, such as 64, 256, 1048, etc.

The hann function is a smoothing filter to pre-apply to your data to remove high frequencies introduced by the fact that the window is only a piece of your total data set. At the boundaries of the window, there is a sharpness introduced since outside the window, the fft acts as if the values are 0. To reduce this high frequency effect, as you can see, the hann filter in your link starts off at 0 and gradually builds up at the center of the window.

w(n) is the n_th value of the hann function. If N = 128, for example, then you need to compute 128 values of w(n). To do this, let n take on values from 0 to 127.
\Commented: