FFT of acceleration data?

1 次查看(过去 30 天)
Careniena Opem
Careniena Opem 2021-6-22
回答: Chunru 2021-6-23
I have acceleration data stored as the variable avgacc. I am trying to generate (and smooth) an FFT but having difficulty. Here is my code for the FFT unsmoothed:
Fs = 1000; %sampling rate
L = 2000; %length of data
Y = fft(avgacc);
P2 = abs(Y/L);
P1 = P2(1:L/2+1);
P1(2:end-1) = 2*P1(2:end-1);
f = Fs*(0:(L/2))/L;
plot(f,P1);
I attempted a moving average and using sgolayfilt but am pretty lost regarding this step. Any help would be greatly appreciated!

回答(1 个)

Chunru
Chunru 2021-6-23
Using fft alone, the spectrum estimate is not smooth.
X = randn(4196, 1);
N = 256;
h(1)=subplot(211); plot(20*log10(1/sqrt(N)*abs(fft(X(1:N)))));
One can use periodogram or pwelch for better spectrum estimate (segment, window, fft and average).
Pxx = pwelch(X,N,N/2,N);
h(2)=subplot(212); plot(10*log10(abs(Pxx)));
linkaxes(h, 'xy')

类别

Help CenterFile Exchange 中查找有关 Fourier Analysis and Filtering 的更多信息

Community Treasure Hunt

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

Start Hunting!

Translated by