Overlapping windows using the fft for time discrete data
17 vues (au cours des 30 derniers jours)
Afficher commentaires plus anciens
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:
![](https://www.mathworks.com/matlabcentral/answers/uploaded_files/381523/image.jpeg)
9 commentaires
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 )
Réponses (0)
Voir également
Catégories
En savoir plus sur Time-Frequency Analysis dans Help Center et File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!