How can I plot the FFT from Datapoints

Hi,
I'm collecting data from Excel to Matlab. I meassured with 50Hz, 50 samples, for 1 Second, so I got 50 values of time and voltage. The signal is very noisy and I want to plot the FFT of this signal, but I don´t know how to do this with meassured values.
data=xlsread('filename'); time=data(:,1); voltage=data(:,2);
The point is, I have never made a fft of data points. Can anybody give me an advise or a litte example how to get the plot of the fft please?

回答 (1 件)

Damas Limoge
Damas Limoge 2017 年 3 月 16 日

0 投票

This documentation is great, and they have plenty of examples. https://www.mathworks.com/help/matlab/ref/fft.html

3 件のコメント

Damas Limoge
Damas Limoge 2017 年 3 月 16 日
Fs = 50; %Sampling Frequency
T = 1/Fs;
L = 50; %Signal length
Y = fft(voltage);
P2 = abs(Y/L);
P1 = P2(1:L/2+1);
P1(2:end-1) = 2*P1(2:end-1);
f = Fs*(0:(L/2))/L;
plot(f,P1)
Felifa
Felifa 2017 年 3 月 16 日
Thank you very much. But at this point I get a little bit confused:
P1 = P2(1:L/2+1); %what is done here?
P1(2:end-1) = 2*P1(2:end-1);
f = Fs*(0:(L/2))/L;
Why does the frequency scale stop at 25?
priya singh
priya singh 2022 年 5 月 13 日
As per my knowledge since fft is complex. fft decomposes the signal into amplitude or phase. Above code is trying to plot the single sided amplitude spectrum. we can plot phase spectrum also. double sided spectra is the replica of right side spectrum with redundant information. Hence it is generally considered to obtain one side spectra only.

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

カテゴリ

ヘルプ センター および File ExchangeFourier Analysis and Filtering についてさらに検索

タグ

質問済み:

2017 年 3 月 16 日

コメント済み:

2022 年 5 月 13 日

Community Treasure Hunt

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

Start Hunting!

Translated by