Overlapping windows using the fft for time discrete data

조회 수: 17 (최근 30일)
AC_GBX
AC_GBX 2020년 10월 15일
댓글: Mathieu NOE 2020년 10월 20일
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
AC_GBX
AC_GBX 2020년 10월 20일
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 2020년 10월 20일
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 )

댓글을 달려면 로그인하십시오.

답변 (0개)

카테고리

Help CenterFile Exchange에서 Spectral Estimation에 대해 자세히 알아보기

Community Treasure Hunt

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

Start Hunting!

Translated by