How to use FFT on my acceleration data in Matlab?

5 views (last 30 days)
Hello, in a bit of pinch here. I have a single-axis acceleration dataset collected at 100 Hz and wish to perform an FFT on it. The dataset contains one column of acceleration values and one column of time values. I've attached an example of this data in an excel workbook.
I am quite new to this. While I have a fundamental understanding of what FFT does, I can't figure out how to implement it using this data or if this is even possible/useful.
I would like to perform an FFT, filter out some frequencies, and replot the filtered data in the time domain. Any help would be greatly appreciated, thank you!

Accepted Answer

Star Strider
Star Strider on 22 Nov 2022
Try something like this —
T1 = readtable('', 'VariableNamingRule','preserve')
T1 = 244×2 table
Acceleration Forward (cm/s²) UTC Time _____________________________ ________ -39 0 -89 0.01 -147 0.02 -187 0.03 -134 0.04 -126 0.05 -126 0.06 -57 0.07 -23 0.08 0 0.09 47 0.1 3 0.11 83 0.12 60 0.13 12 0.14 14 0.15
Acc = T1{:,1};
t = T1{:,2};
Fs = 1/(t(2)-t(1));
Fn = Fs/2;
L = size(t,1);
NFFT = 2^nextpow2(L);
FTAcc = fft(Acc-mean(Acc),NFFT)/L;
Fv = linspace(0, 1, NFFT/2+1)*Fn;
Iv = 1:numel(Fv);
plot(Fv, abs(FTAcc(Iv))*2)
title('Fourier Transform of Acceleration Data')
Your intent to ‘filter out some frequencies’ can be done in a relatively straightforward way.
There are a number of filtering functions such as bandstop (and related functions) that you can use for this, although the signal appears to be relatively ‘clean’. It would be nice to have more details.
Star Strider
Star Strider on 23 Nov 2022
As always, my pleasure!
I very much appreciate your compliment!

Sign in to comment.

More Answers (0)



Community Treasure Hunt

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

Start Hunting!

Translated by