MATLAB Answers

How to interpret FFT output signal?

35 ビュー (過去 30 日間)
Melvin Corvers
Melvin Corvers 2020 年 8 月 6 日
コメント済み: Rena Berman 2020 年 10 月 9 日 16:47
Hi,
I am analyzing a signal using FFT to obtain its frequency spectrum. Raw data is shown below.
The machine should measure at a frequency 0.316 Hz.
Code spectral analysis:
x = t2(:,3);
%x = x-mean(x);
n = length(x);
dt = 3;
fs = 1/dt;
t = (0:n-1)*dt;
y = fft(x);
f = (0:n-1)*(fs/n);
power = abs(y).^2/n;
figure()
plot(f,power)
xlabel('Frequency [Hz]')
ylabel('Power')
grid on
After spectral analysis I end up with two peaks: one at 0 Hz and one at 0.3316 Hz.
If you uncomment the second line you end up with this: a peak at 0.0017 and 0.3316 Hz.
My question is how to interpret the first peak? Has it a physical meaning? I've read somewhere that a large peak at zero frequency means that you have a massive DC offset. What does that mean? And could it be that through discretization the actual value (0.316 Hz) and found value (0.3316 Hz) are slightly different?

  3 件のコメント

Niels van Dalen
Niels van Dalen 2020 年 8 月 6 日
Judging from the fluctuations of your initial signal, there should be more than two frequencies present in its frequency content. Besides that, the fft functions will output a complex series of numbers, which you are plotting, and which is responsible for the symetry. I can't see how taking abs(y) helps you, since a physical signal has no such thing as negative frequency content.
And could it be that through discretization the actual value (0.316 Hz) and found value (0.3316 Hz) are slightly different?
Yes, could very well be. Might also be inaccurate clicking on the exact peak if ur using datatips to find the peak in ur plot.
This is a bit of a halfassed answer I'm sorry, but I'd recommend you to read: https://medium.com/analytics-vidhya/breaking-down-confusions-over-fast-fourier-transform-fft-1561a029b1ab .
Covers everything you need to know to go from a time signal to meaningful frequency analysis using the fft function in matlab. Good luck!
Rik
Rik 2020 年 9 月 7 日
Question posted by Melvin Corvers recovered from Google cache (permalink, should be available after a few hours):
Hi,
I am analyzing a signal using FFT to obtain its frequency spectrum. Raw data is shown below.
The machine should measure at a frequency 0.316 Hz.
Code spectral analysis:
x = t2(:,3);
%x = x-mean(x);
n = length(x);
dt = 3;
fs = 1/dt;
t = (0:n-1)*dt;
y = fft(x);
f = (0:n-1)*(fs/n);
power = abs(y).^2/n;
figure()
plot(f,power)
xlabel('Frequency [Hz]')
ylabel('Power')
grid on
After spectral analysis I end up with two peaks: one at 0 Hz and one at 0.3316 Hz.
If you uncomment the second line you end up with this: a peak at 0.0017 and 0.3316 Hz.
My question is how to interpret the first peak? Has it a physical meaning? I've read somewhere that a large peak at zero frequency means that you have a massive DC offset. What does that mean? And could it be that through discretization the actual value (0.316 Hz) and found value (0.3316 Hz) are slightly different?
Rena Berman
Rena Berman 2020 年 10 月 9 日 16:47
(Answers Dev) Restored edit

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

回答 (1 件)

Peng Li
Peng Li 2020 年 8 月 6 日
Based on your code, your sampling frequency is 1/3 Hz. There is no way you can detect a component of 0.316 Hz using 1/3 Hz sampling frequency.
The spectrum is symmetrical to 0 Hz. By default MATLAB gives a shifted spectrum that is symmetrical Fs/2. You can fftshift it or you can simply plot the first half. The second peak on the righthand side is not what you want to detect; it is simply a mirror of the peak on the left hand side.

  0 件のコメント

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

タグ

Community Treasure Hunt

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

Start Hunting!

Translated by