필터 지우기
필터 지우기

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