Accurately calculate the spectrum energy (scaling, window and other concerns)

1 view (last 30 days)
Hi,
I am studying on how to calculate the energy within a frequency band. I tried to use the psd function as well as the fft function. The code is as follows.
h = spectrum.periodogram('Hann');
Hpsd = psd(h,xframe,'NFFT',2^13,'Spectrumtype','Twosided','Fs',Fs);
and
frame_fft = abs(fft(xframe.*hann(length(xframe)),2^13));
frame_psd = frame_fft.^2/Fs/length(xframe);
I found that the Hann window used in each function has a different gain, which leads to the different results.
So my question is how to get a PSD with accurate values (w/wo window function)? In addition, could anybody please explain why we need to divide the Fs and frame length to normalize the scale? I tried to look into the psd function but couldn't understand the 'KMU' variable which is the 'Normalizing scale factor'.
Any help will be appreciated, Bach

Answers (0)

Categories

Find more on Fourier Analysis and Filtering in Help Center and File Exchange

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!