Question on usage of fft

1 回表示 (過去 30 日間)
Pappu Murthy
Pappu Murthy 2018 年 9 月 17 日
コメント済み: Pappu Murthy 2018 年 9 月 17 日
I have a function F(t) = 1 + 2*sin(pi*t/180);
So it has one harmonic.
If I do
TestFFT = fft(F(t),5); % Asking for 5 harmonics.
The first one should be simply 2 a constant.
I get 5.5232 and this number keeps changing with the number of harmonics I ask for. I am not familiar with all this, hence question. Please help with correct usage of fft command. Thanks.

採用された回答

Image Analyst
Image Analyst 2018 年 9 月 17 日
You need to create a digital representation of the function. For example specify t then create F, then call FFT
t = 1 : 1000; % Whatever...
period = 360; % Whatever you want.
F = 1 + 2 * sin(2 * pi * t / period);
ft = fft(F); % FFT of entire signal.
subplot(1, 2, 1);
plot(real(ft), 'b-', 'LineWidth', 2);
grid on;
title('Real Part', 'FontSize', 20);
subplot(1, 2, 1);
plot(imag(ft), 'b-', 'LineWidth', 2);
grid on;
title('Imaginary Part', 'FontSize', 20);
The 5 you put in is not the number of harmonics like you're thinking about them. It's the number of elements in the transform. If you use 5 that may be too low resolution to even see your signal clearly and way too low to see your harmonics. Use more resolution and look for the spikes in the FFT signal. These will be at multiples of the (1/period) frequency.
  1 件のコメント
Pappu Murthy
Pappu Murthy 2018 年 9 月 17 日
I understand now. Thanks much for patiently explaining. I accept your answer.

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

その他の回答 (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