MATLAB: Scaling for periodic signal using hann window

hann windowscaling

How can i scale for periodic signal using hann window. i know for flattop i.e 1/sum(window)but i do not know how to scale with hann window with a periodic signal. kindly help

Best Answer

Hi Lisa, it should be the same:
t = 0:0.001:1-0.001;
xn = cos(2*pi*100*t);
w = hanning(length(xn));
x = xn'.*w;
sc = 1/sum(w);
xdft = fft(xn);
xdft = xdft(1:length(xn)/2+1);
y = sc*xdft;
plot(abs(y));