Question on usage of fft

1 visualización (últimos 30 días)
Pappu Murthy
Pappu Murthy el 17 de Sept. de 2018
Comentada: Pappu Murthy el 17 de Sept. de 2018
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.

Respuesta aceptada

Image Analyst
Image Analyst el 17 de Sept. de 2018
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 comentario
Pappu Murthy
Pappu Murthy el 17 de Sept. de 2018
I understand now. Thanks much for patiently explaining. I accept your answer.

Iniciar sesión para comentar.

Más respuestas (0)

Categorías

Más información sobre Fourier Analysis and Filtering en Help Center y File Exchange.

Productos

Community Treasure Hunt

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

Start Hunting!

Translated by