フィルターのクリア

Getting the magnitude of FFT of a sine wave

63 ビュー (過去 30 日間)
Nina
Nina 2013 年 2 月 18 日
I am new to fft and a bit confused about the magnitude. This is what I have
A =1;
t = 0:0.01:1-0.01;
x = A*cos(2*pi*10*t);
xdft = fft(x,1024);
When I plot abs(xdft) I get a magnitude of the length of the wave * amplitude /2. I am confused because I though the magnitude would be 1024*A/2. What am I missing? also since I am trying to learn fft and understand the output it spits out very well, can someone direct me to a good source to start with? Thank you.

回答 (1 件)

Wayne King
Wayne King 2013 年 2 月 18 日
編集済み: Wayne King 2013 年 2 月 18 日
You should not zero pad here because as is your frequency of 10 Hz falls directly on a DFT bin.
A =1;
t = 0:0.01:1-0.01;
x = A*cos(2*pi*10*t);
xdft = fft(x);
plot(abs(xdft))
Your data, x, is 100 samples in length. So you get 100*A/2 at -10 Hz and +10 Hz. That is equal to 50.
The zero pad length does not affect the amplitude, just the length of the data vector.
You can of course do:
xdft = fft(x)/length(x);
plot(abs(xdft))
  3 件のコメント
Wayne King
Wayne King 2013 年 2 月 18 日
I did in my example above, you wrote fft(x,1024) that is padding out to 1024. I wrote just fft(x)
Nina
Nina 2013 年 2 月 18 日
Oh I see, thank you :)

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

カテゴリ

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