Borrar filtros
Borrar filtros

FFT of acceleration data?

1 visualización (últimos 30 días)
Careniena Opem
Careniena Opem el 22 de Jun. de 2021
Respondida: Chunru el 23 de Jun. de 2021
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!

Respuestas (1)

Chunru
Chunru el 23 de Jun. de 2021
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')

Categorías

Más información sobre Fourier Analysis and Filtering en Help Center y File Exchange.

Community Treasure Hunt

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

Start Hunting!

Translated by