Discover MakerZone

MATLAB and Simulink resources for Arduino, LEGO, and Raspberry Pi

Learn more

Discover what MATLAB® can do for your career.

Opportunities for recent engineering grads.

Apply Today

To resolve issues starting MATLAB on Mac OS X 10.10 (Yosemite) visit: http://www.mathworks.com/matlabcentral/answers/159016

scaling for periodic signal using hann window

Asked by Lisa Justin on 13 Mar 2012

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

1 Comment

Lisa Justin on 13 Mar 2012

xn=signal;%%%periodic signal
w=flattopwin(length(xn));
x=xn.*w;
sc=1/sum(w);%%%%scaling
y=(fft(x)).*sc

please how would i scale if i want to usse hann window instead. what would 'sc' be?

Lisa Justin

Products

No products are associated with this question.

1 Answer

Answer by Wayne King on 13 Mar 2012
Accepted 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));

3 Comments

Lisa Justin on 13 Mar 2012

sc is same as flattop you mean. no not true

Lisa Justin on 13 Mar 2012

the signal is periodic remember

Wayne King on 13 Mar 2012

It's not the same as the flat top window, because the sum of the two windows is not the same.

w = hanning(length(xn));
w1 = flattopwin(length(xn));
sum(w)
sum(w1)

Accordingly the reciprocal of the sums is not the same.

Wayne King

Contact us