HANN & RECTANGULAR WINDOWING

Status
Not open for further replies.

derick007

Member
I have been using excel to calculate the power spectrums for both HANN and RECTANGULAR windowing with :

N - 1
DFT = X(K) =1/N x(n) ( cos (2πnk/N) - j sin (2πnk/N) )
n = 0

HANN x(n) = 0.5 (1 - cos (2πn/(N-1)))

RECTANGULAR x(n) =1

The RECTANGULAR function turns out to be ok, with 0 dB at 0 Hz. However I am having difficulty with the HANN function. It would appear from what I read online this should also be 0 dB at 0 Hz ? However when I use excel and the formulae above I get -6 dB at 0 Hz, which to be honest is what I would expect. Which is correct for the HANN function, 0 dB or -6 dB at 0 Hz ? If it is 0 dB, why do I get -6 dB ? If it is -6 dB, why do all these resources online quote 0 dB ?
 
Hi,

I am not entirely sure what you are doing but i get 0db.

From Wikipedia if we have N=9 then to do 0Hz we need to use n=4. With N=9 and n=4 we get 0db with the 'cosine' formula.
 
Hi Mr Al,

For the Hann function I get the following 9 samples in the time domain :

x(0) = 0, x(1) = 0.146, x(2) = 0.5, x(3) = 0.854, x(4) = 1, x(5) = 0.854, x(6) = 0.5, x(7) = 0.146, x(8) = 0 ;N = 9

Considering both positive and negative frequencies, DFT transforms this to

X(0) = 4, X(1) = -2.19 – j0.8, X(2) =0.16 + j0.14, X(3) = 0.03 + j0.05, X(4) = 0.0027 + j0.015, X(5) = 0.0027 – j0.015, X(6) = 0.03 – j0.05, X(7) = 0.16 –j0.14, X(8) = -2.19 + j0.8

|X(0)|/N = 4/9 = 0.444v = 0.2 watts = 22.95 dBm = dc or average value. MATLAB = 30 dBm

PEAK ;|X(1)|/N = 2.33/9 = 0.26v (pk) = 0.0676 watt (pk) = 18.3 dBm (pk) MATLAB = 23.98 dBm

RMS ; |X(1)|/N = 2.33/9 = 0.26v (pk) = 0.26/√2 v (rms) = 0.184 watt (rms) = 22.65 dBm (rms) MATLAB = 23.98 dBm

PEAK ;|X(2)|/N = 0.21/9 = 0.023v (pk) = 0.00053 watt (pk) = -2.76 dBm (pk) MATLAB = -32.99 dBm

RMS ; |X(2)|/N = 0.21/9 = 0.023v (pk) = 0.023/√2 v (rms) = 0.00027 watt (rms) = -5.78 dBm (rms) MATLAB = -32.99 dBm

I built a very simple model in MATLAB, Simulink (no coding required) consisting of a signal generator, an oscilloscope and a spectrum analyser.

The MATLAB readings above were taken from a power spectrum plot in the spectrum analyser – not sure if they are peak/rms.

As you can see none of my calculations match either what you say above or the readings MATLAB produces. I suspect I am not calculating X(f) correctly see page 2 of the attached pdf.
 

Attachments

  • For a continuous.pdf
    220.6 KB · Views: 303
Status
Not open for further replies.
Cookies are required to use this site. You must accept them to continue using the site. Learn more…