0

I have data from the accelerometer sensor and this is an example of my signal enter image description here

the first step i have divided the data into segment (each segment have 300 values) so in total i have 10 segments.

I need to find the frequency of each segment, which means i would have 10 values (each value represent the frequency of specific segment) .

so far i have used this code

NFFT=size(Acc_TD_Segments{1},1); % NFFT (lenght of segment) and Acc_TD_Segments(Time domain signal)

Fss=30;                          % the sampling frequency of the input signal 

Acc_FD_Signal{nn,1}=fft(Acc_TD_Segments{nn},NFFT)/NFFT; % nn (number of segments which is =10) 

if my code is correct what is the next step to find the frequecny of each segment?

if not please could you help me to determine the frequency for each segment!

Cœur
  • 37,241
  • 25
  • 195
  • 267
  • This post may be useful: https://stackoverflow.com/questions/10758315/understanding-matlab-fft-example or this one: https://stackoverflow.com/questions/43409876/finding-bpm-of-a-heartbeat-using-fourier-transform/43410655#43410655. You can also check your result by estimating the period manually by zooming in the graph. – m7913d May 24 '17 at 20:42
  • Dear @m7913d thank you for your help. i really approciate it. but if you could help me please to onlycaclute the frequency for each segment (forget about the index) . i didnt understand the links that you mentioned to me ! now i just want to measure the freqency for each segment. Regards. – Neamah Al-Naffakh May 24 '17 at 21:02

1 Answers1

0
frequency = (indexMax - 1)/N * Fs

with

N = number of points used to calculate your fft
Fs = sampling frequency of your signal
m7913d
  • 10,244
  • 7
  • 28
  • 56
  • Dear @m7913d, sorry for bothering you again. so do you mean the code should be [maxValue,indexMax] = max(abs(fft(Acc_Segments{nn}-mean(Acc_Segments{nn})))); frequency = (indexMax - 1)/N * Fs. – Neamah Al-Naffakh May 24 '17 at 22:01
  • dear @m7913d i have updated the code, could you please have a quick look and tell me what is the next step? – Neamah Al-Naffakh May 24 '17 at 23:20