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 CenterFile Exchange에서 Fourier Analysis and Filtering에 대해 자세히 알아보기

제품

Community Treasure Hunt

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

Start Hunting!

Translated by