How do I plot an FFT of a large data set?

18 visualizaciones (últimos 30 días)
Angelica Black
Angelica Black el 9 de Dic. de 2021
Editada: David Goodmanson el 10 de Dic. de 2021
I have a very large data set that I am trying to use to plot a FFT. The sampling frequency is 20000 and there are 555201 data points. My code is not giving me an accurate graph for figure 2, the plot of the FFT.
Here is my code:
filename = 'Sample192.xlsx';
T = readtable(filename);
x = T{1:555201,1};
y = T{1:555201,2};
%
figure(1)
plot(x,y);
%
Y = fft(y);
Fs = 20000;
f = (0:length(Y)-1)*(Fs/length(Y));
figure(2)
plot(f,abs(Y))
  3 comentarios
Mathieu NOE
Mathieu NOE el 9 de Dic. de 2021
hello
can you share the data file as well ?
tx
Angelica Black
Angelica Black el 9 de Dic. de 2021
The data file is too large for me to upload but I can probably attach a snippet of the data if that'll work.

Iniciar sesión para comentar.

Respuesta aceptada

David Goodmanson
David Goodmanson el 10 de Dic. de 2021
Editada: David Goodmanson el 10 de Dic. de 2021
Hi Angelica,
One possible reason is that the data has a DC offset, i.e. its mean is not zero. What can happen is that the DC offset, which is the f=0 point in the resulting transform, is much, much larger that any other point in the fft, so all you see is a peak at f = 0. For a signal S, If you take away the mean with S = S - mean(S) and then do the transform, you may well do better. Or you could do the equivalent by taking the existing transform (let's say the fft output is Y) and zero out the first point (which corresponds to f=0 if you have not used fftshift) with Y(1) = 0 and see what that looks like on a plot.

Más respuestas (0)

Categorías

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

Etiquetas

Productos


Versión

R2020b

Community Treasure Hunt

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

Start Hunting!

Translated by