# How to set sampling frequency of an acceleration data set

I have a set of accelerometer readings in $X, Y, Z$ axes obtained from an android based smart-phone. The data in $(X, Y, Z)$ was recorded at different time stamps and there is no uniform time period for recording the data.

My data set looks as timestamp $X, Y, Z$. First, I did a filtering (using a low-pass) on this data and now want to perform $\textrm{FFT}$ on a timewindow of 1 min or may be a window containing 250 samples (not very sure about the window length). I am using this FastFourierTransform class of apache commons in Java.

I am getting $\textrm{FFT}$ magnitude but I was wondering how do I know the corresponding frequency of each $\textrm{FFT}$ mag. I know corresponding frequency would be $(n\cdot F_s)/N$ where $n$ is the bin number or data point index, $F_s$ is sampling frequency and $N$ is number of input data points over the window. Now my question is how do I know $F_s$ for a given set of data say for example input data in an array as $\begin{bmatrix}1&2&3&4&5&6& 7\end{bmatrix}$ over a window of size $N_t$ millisec where $N_t=(\textrm{lastTimeStamp}-\textrm{firstTimeStamp})$

Is it $\displaystyle \frac{7}{(N_t\cdot 10^{-2})} \textrm{Hz}$?

This also immediately follows by doing so if this agrees with nyquist sampling frequency? and this says $F_s\ge2F_{max}$ in the signal and I don't know the maximum frequency over the time window $N_t$.

• When you mentioned time stamps you mean that for each sample you have the time? If the sampling time is not regular (the sampling time happens with different periods) you can not just do Filtering and FFT - first you need to create a "fixed sampling series" and then run the process. When you create this series you actually specify the sampling frequency. If you are not emulating a data stream with Fixed Sampling Period I would say that your results are meaningless.
– Moti
May 23, 2015 at 4:16