Azzera filtri
Azzera filtri

FFT of acceleration data?

1 visualizzazione (ultimi 30 giorni)
Careniena Opem
Careniena Opem il 22 Giu 2021
Risposto: Chunru il 23 Giu 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!

Risposte (1)

Chunru
Chunru il 23 Giu 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')

Categorie

Scopri di più su Fourier Analysis and Filtering in Help Center e File Exchange

Community Treasure Hunt

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

Start Hunting!

Translated by