Y axis of FFT plot

3 Ansichten (letzte 30 Tage)
Wafiik Aumeer
Wafiik Aumeer am 6 Mai 2020
Beantwortet: Star Strider am 6 Mai 2020
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

Antworten (1)

Star Strider
Star Strider am 6 Mai 2020
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.

Kategorien

Mehr zu Fourier Analysis and Filtering finden Sie in Help Center und File Exchange

Tags

Community Treasure Hunt

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

Start Hunting!

Translated by