Basic question about using MATLAB fft: divide fft() by number of data points?

Hi,
I have a very basic question regarding the use of the MATLAB fft() function.
In the MATLAB documentation on fft http://www.mathworks.com/help/matlab/ref/fft.html, an example was given for calculating the spectrum of a time domain vector y, with length L. The example code is as below for reference.
****************************************
NFFT = 2^nextpow2(L); % Next power of 2 from length of y
Y = fft(y,NFFT)/L;
f = Fs/2*linspace(0,1,NFFT/2+1);
******************************************
My question is, why is the fft() result divided by L here? The actual number of data points used is NFFT, not L. Should the fft() result be divided by NFFT instead?
Thanks!
Xi

 採用された回答

Star Strider
Star Strider 2014 年 11 月 11 日

0 投票

The nextpow2 function zero-pads the signal so the fft calculation is more efficient. It adds no energy to the signal, so dividing by the length of the original signal is appropriate to normalise the amplitudes of the transformed components.

その他の回答 (1 件)

XC
XC 2014 年 11 月 11 日

0 投票

Thanks Star Strider, that was a very clear answer! Thank you.

カテゴリ

ヘルプ センター および File ExchangeFourier Analysis and Filtering についてさらに検索

タグ

質問済み:

XC
2014 年 11 月 11 日

コメント済み:

2014 年 11 月 11 日

Community Treasure Hunt

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

Start Hunting!

Translated by