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

8 ビュー (過去 30 日間)
Angelica Black
Angelica Black 2021 年 12 月 9 日
編集済み: David Goodmanson 2021 年 12 月 10 日
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 件のコメント
Mathieu NOE
Mathieu NOE 2021 年 12 月 9 日
hello
can you share the data file as well ?
tx
Angelica Black
Angelica Black 2021 年 12 月 9 日
The data file is too large for me to upload but I can probably attach a snippet of the data if that'll work.

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

採用された回答

David Goodmanson
David Goodmanson 2021 年 12 月 10 日
編集済み: David Goodmanson 2021 年 12 月 10 日
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.

その他の回答 (0 件)

カテゴリ

Help Center および File ExchangeFourier Analysis and Filtering についてさらに検索

タグ

製品


リリース

R2020b

Community Treasure Hunt

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

Start Hunting!

Translated by