0
$\begingroup$

I'm working with position data from a hand sensor, and need to apply an FFT to it to get the level of tremor based on the frequency of the signal. I get two arrays, one with +1000 frames of position data, the other with +1000 timestamps related to position data, both in .csv files. I'm having trouble formatting the data for the FFT function on matlab. How i transform my position (and probably timestamps) data to a signal who can be processed on function FFT()?

$\endgroup$
1
$\begingroup$

FFT in matab uses a dataset as a vector or an array. If the array is X, the FFT is calculated using FFT(X). Therefore first make an array using the csv file. You can use X = csvread(filename). Then use FFT(X) command. You dont need the time stamp for this.

$\endgroup$
  • 1
    $\begingroup$ fft does assume that each time steps is of the same size. So one would have to check this. $\endgroup$ – fibonatic Mar 7 at 19:07
  • $\begingroup$ Thank you for replying! I have a doubt about that, my sampling frequency is not static, it varies by 3-6% for each frame. That's why I rescued the time stamps assuming they would be necessary for the FFT, how can be implemented to the calculation my time matrix to give more robustness to the result? $\endgroup$ – gondsieg Mar 7 at 20:15
  • $\begingroup$ Doesn’t the number of data points in an FFT have to be a power of 2? $\endgroup$ – SteveO Mar 7 at 20:40
  • $\begingroup$ Since the difference of the sampling time is about 5%, you can interpolate the values and make a uniformly sampled dataset. Use 'resample' function available in the matlab. Let me know if you need further help. $\endgroup$ – Tharindu Suraj Mar 8 at 3:09

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.