我使用numpy和matplotlib來分析我模擬的數據輸出。有一個(明顯的)不一致,我找不到根源。它有以下幾種:(numpy)FFT數組的錯誤幅度(?)?
我有一個信號,具有給定的能量a^2〜1。當我使用rfft進行傅里葉變換並計算傅里葉空間中的能量時,它會變得更大。排尿給我的數據等的細節,這裏是一個簡單的正弦波的例子:
from pylab import *
xx=np.linspace(0.,2*pi,128)
a=np.zeros(128)
for i in range(0,128):
a[i]=sin(xx[i])
aft=rfft(a)
print mean(abs(aft)**2),mean(a**2)
原則上這兩個數字應該是相同的(至少在數字意義上的),但是這是我擺脫這種代碼:
62.523081632 0.49609375
我試圖去通過numpy.fft文檔,但無法找到任何東西。這裏的一個搜索提供了以下但我無法理解的解釋有:
Big FFT amplitude difference between the existing (synthesized) signal and the filtered signal
我缺少/誤解?任何幫助/指針在這方面將不勝感激。
謝謝!
[Parseval's theorem in Python]可能的重複(http://stackoverflow.com/questions/14011506/parsevals-theorem-in-python) – Jaime 2013-03-01 00:19:35