Hello,
I have some difficulties with understanding the FFT plot. I have a text file that contains data (4096 samples) that have been collected from a sensor at 512Hz.
I tried code to do the FFT plot: plot(linspace(0, 1, 4097)*512, abs(fft(load('signal.txt')))).
Now although my data range only from -190 to 185, i see the amplitude axis range from zero to almost 3X10^4. What does that actually represent?
If I am wrong what code would work to show the FFT of the text file?
Thanks

回答 (1 件)

Star Strider
Star Strider 2020 年 5 月 6 日

1 投票

Now although my data range only from -190 to 185, i see the amplitude axis range from zero to almost 3X10^4. What does that actually represent?
The data may only go from -190 to 185 (range of 375), however there appears to be a significant d-c (or constant) offset.
To eliminate the constant offset and plot a one-sided Fourier transform:
signal = load('signal.txt')
FTsignal = fft(signal - mean(signal))/numel(signal);
plot(linspace(0, 1, 2048)*256, abs(FTsignal(1:2048))*2)
grid
This assumes ‘signal’ is a vector. If it is a matrix, the code would have to be changed to reflect that.

カテゴリ

ヘルプ センター および File ExchangeGet Started with Signal Processing Toolbox についてさらに検索

タグ

質問済み:

2020 年 5 月 6 日

回答済み:

2020 年 5 月 6 日

Community Treasure Hunt

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

Start Hunting!

Translated by