How to use FFT on my acceleration data in Matlab?

26 Ansichten (letzte 30 Tage)
Sam Osborne
Sam Osborne am 22 Nov. 2022
Kommentiert: Star Strider am 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!

Akzeptierte Antwort

Star Strider
Star Strider am 22 Nov. 2022
Try something like this —
T1 = readtable('https://www.mathworks.com/matlabcentral/answers/uploaded_files/1203773/example.xlsx', '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);
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.
.
  4 Kommentare
Sam Osborne
Sam Osborne am 23 Nov. 2022
I sincerely appreciate your kind and explicit help. I was able to apply your solution (now that I understand it) to a separate dataset and successfully dampen the signal to my liking. Your support jump started my learning moreso than any video.
Star Strider
Star Strider am 23 Nov. 2022
As always, my pleasure!
I very much appreciate your compliment!

Melden Sie sich an, um zu kommentieren.

Weitere Antworten (0)

Kategorien

Mehr zu Downloads finden Sie in Help Center und File Exchange

Tags

Produkte

Community Treasure Hunt

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

Start Hunting!

Translated by