Apply the Hamming window to a sinusoidal signal I am a novice in signal processing. I am writing a code to apply the hamming window to a sinusoidal signal. So first I have digitized my sinusoidal signal by choosing a sampling rate more than twice its frequency.

These are the values for the signal: F=500 Hz, T=2 ms, and sampling rate=2000 Hz.

Now, I guess I have to multiply the function of the window to the signal so:

for (i=0; i&lt;windowSize; i++)
     data(i)=signal(i)*window(i)
     i=i+0.5;  //sampling time


My question is when we multiply the window to the signal, does the window function has to be digitized by the sampling rate of the signal or it can be digitized anyway we want? In the code I have digitized the window function according to the sampling rate. Thank you.
The window isn't "sampled" as it isn't a signal, really.  It's a vector that you construct, and it doesn't matter how you construct it.  The window vector just has to be the same length as your signal vector.