Y axis of FFT plot

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

Answers (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.

Categories

Find more on Fourier Analysis and Filtering in Help Center and File Exchange

Tags

Asked:

on 6 May 2020

Answered:

on 6 May 2020

Community Treasure Hunt

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

Start Hunting!