Overlapping windows using the fft for time discrete data

16 vues (au cours des 30 derniers jours)
AC_GBX
AC_GBX le 15 Oct 2020
Commenté : Mathieu NOE le 20 Oct 2020
Hello,
I want to calculate the frequency domain of a measured signal by using the fft. My measurements have the samplerate of 5000Hz over 45s. The signals are acceleration in x,y,z direction of my coordinate system. I need the frequency domain signal for every second. The window I use is the Hann-Window and I decided to use the overlap of 50% as usual.
The problem is:
  • if I say the win_length is 5000Hz as the samplerate, then the result is for every half second
  • if I say the win_length is 10.000Hz then the result is for every second, but the algorithm cosiders 2s.
I must be wrong in understand the fft for a time discrete signal, but I read a lot about that. So what am I doing wrong?
sens_length = length(sensordata);
w = hann(win_length);
num_freq = win_length/2 ;
num_w = 2*sens_length/win_length-1;
for t=1:num_axis % for every axis of the coordinate system
for i = 1:num_w %for every window
sensor_freq(:,i,t) = fft(w .* sensordata((i-1)*num_freq+1:(i-1)*num_freq+win_length,t));
sensor_freq_abs(:,i,t) = abs(sensor_freq(1:num_freq,i,t));
end
end
This is how one of my signals after measurement looks like:
  9 commentaires
AC_GBX
AC_GBX le 20 Oct 2020
Yes this answers my questions. Thank you very much. You helped a lot. I will try to interpolate the first half of the vector up to 2500 values due to shannon .
Mathieu NOE
Mathieu NOE le 20 Oct 2020
ok
FYI, the freq vector generated from the pwelch function is already in range 0 to Fs/2
maybe there is no need to take again the first half of the freq vector (or you will be then limited to 0 : Fs/4 range )

Connectez-vous pour commenter.

Réponses (0)

Community Treasure Hunt

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

Start Hunting!

Translated by