Hamming window for filtering unwanted terms I am trying to filter off two unwanted terms in this frequency spectrum (the spectrum on top).
First, I used a convolution between a rectangular window to make the unwanted terms equal to zero. 



the first problem is when I tried to centralize the remaining part and multiplying it by a cos ( 2 * pi * f *t) I didn't get any result.

And my second question about hamming window is that in an article about a similar issue, a hamming and a blackman window were used. So, is it possible to use hamming window to filter off the unwanted terms? if yes, then how do I choose the starting and the final point of the hamming window to leave only the desired part! I really need help to understand how does it work and how to use it.
Below is some code (in scilab which is similar to but not the same as matlab) that attempts to do what you're saying.

The output is the following graph which has:


The original signal
The signal multiplied by the window to leave just the left-hand peak.
The signal modulated with a complex exponential to shift the remaining peak to the centre (DC).




// 25709
N = 1024;
dc = 1 + rand(1,N,'norm');
fc = 0.388729874;
a = 1+0.5*rand(1,N,'norm');
t = [0:N-1];
phi = 0.187238947;
x = dc + a.*sin(2*%pi*fc*t + phi);
X= fft(x);

f = fftshift((fftshift([0:N-1]) - N/2)/N);

clf;
subplot(311);
plot(f, fftshift(abs(X)))

subplot(312);
wind = [zeros(1,N-500) ones(1,500) ];
plot(f,fftshift(abs(X.*wind)));

subplot(313);
y = ifft(X.*wind);
yy = y.*exp(%i*2*%pi*fc*t);
plot(f,fftshift(abs(fft(yy))))