How to use FFT on my acceleration data in Matlab?

5 views (last 30 days)
Sam Osborne on 22 Nov 2022
Commented: Star Strider on 23 Nov 2022
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!

Star Strider on 22 Nov 2022
Try something like this —
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);
figure
plot(Fv, abs(FTAcc(Iv))*2)
grid
xlabel('Frequency')
ylabel('Maagnitude')
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 on 23 Nov 2022
As always, my pleasure!
I very much appreciate your compliment!

Categories

Find more on Spectral Measurements in Help Center and File Exchange

Community Treasure Hunt

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

Start Hunting!

Translated by