フィルターのクリア

about the amplitude of spectrum by fft

2 ビュー (過去 30 日間)
Ray Lee
Ray Lee 2014 年 7 月 17 日
コメント済み: Honglei Chen 2014 年 7 月 23 日
As for cos(2*pi*t), the peaks locates at -1 and 1 Hz with a value of 0.5. It's correct.
t = 0:0.1:10;
x = cos(2*pi*t);
y = fft(x)/length(x);
real(fftshift(y))
As for sin(2*pi*t), the peak locations are correct but the polarity is reversed from the theoretical predition.
t = 0:0.1:10;
x = sin(2*pi*t);
y = fft(x)/length(x);
imag(fftshift(y))
We know that the fourier transform of exp(-pi*t^2) is exp(-pi*f^2). Thus, the peak amplitude is expected to be 1.
t = -10:0.2:10;
t = ifftshift(t);
x = exp(-pi*t.^2);
y = fft(x)/length(x);
real(fftshift(y))
but the peak of the amplitude spectrum by fft is 0.05, not 1 as predicted by the analytic solution.

採用された回答

Honglei Chen
Honglei Chen 2014 年 7 月 17 日
編集済み: Honglei Chen 2014 年 7 月 17 日
why do you say for sin(2*pi*t) the polarity is reversed? The theoretical equation has 1/(2*1i) as the scaling factor, so the result is correct.
As to the Gaussian signal, the relation you quoted is for continuous Fourier transform, not for FFT. Since you don't sample every point on the curve, your frequency domain sample does not end up at 1. The value at f=0 is simply sum(x)/length(x), which is approximately 0.05, matching what you get.
Another way to look at it is that the point in your frequency domain result represents the integration of a small frequency bin, and the width of each bin is fs/N where fs is the sampling rate and N is the number points. In your example, fs is 5 and N is length(x). Therefore, the value is 1*5/length(x).
  2 件のコメント
Ray Lee
Ray Lee 2014 年 7 月 23 日
why the spectral amplitude of sin and cos is not scaled?
Honglei Chen
Honglei Chen 2014 年 7 月 23 日
Because they are single frequency so you only get energy at that very point, there is no energy spread in the bin

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

その他の回答 (0 件)

カテゴリ

Help Center および File ExchangeSpectral Measurements についてさらに検索

Community Treasure Hunt

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

Start Hunting!

Translated by