Dividing fourier transform by factor n

3 ビュー (過去 30 日間)
Sepp
Sepp 2017 年 11 月 12 日
コメント済み: Star Strider 2017 年 11 月 12 日
Hello everybody
I have a problem with the fast fourier transform. I would like to extract the low and high frequency power of a signal. I have seen the following example (actually it is Python):
Y = np.fft.fft(signal)/n #Calculate FFT
Y = Y[range(n/2)] #Return one side of the FFT
lf = np.trapz(abs(Y[(frq>=0.04) & (frq<=0.15)]))
hf = np.trapz(abs(Y[(frq>=0.16) & (frq<=0.5)])) #Do the same for 0.16-0.5Hz (HF)
signal is just a an array of values (Let's say 10000 values).
The problem here is that I don't see what n should be. Should n just be the length of signal?

採用された回答

Star Strider
Star Strider 2017 年 11 月 12 日
‘Should n just be the length of signal?’
Yes. (Note that it is the length of the original signal, not of a signal zero-padded to have a length of a power-of-2.)
  2 件のコメント
Sepp
Sepp 2017 年 11 月 12 日
What do you mean with zero-padded?
Star Strider
Star Strider 2017 年 11 月 12 日
Zero-padding a vector to create an ‘augmented’ vector of length equal to the next highest power of 2 is sometimes desired because (1) it increases the efficiency of the fft calculation, and (2) increases the frequency resolution of the transformed vector.
The point is that all the energy in the vector are in the first ‘n’ samples, and that is the correct normalising value.

サインインしてコメントする。

その他の回答 (0 件)

カテゴリ

Help Center および File ExchangeFourier Analysis and Filtering についてさらに検索

Community Treasure Hunt

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

Start Hunting!

Translated by