FFT in Matlab to analyze analog accelerometer data

Hello, I am very new to signal processing and am currently trying to analyze a signal from an acclerometer. The acclerometer is the ADXL 337 (specs here https://www.sparkfun.com/products/12786) hooked up to an Arduino Nano 3.0. The accelerometer is an analog device and gives us readings in the x,y, and z directions in voltages. I would like to take these voltages and convert to them to a frequency, but am very confused with how to interpret how to use a Fourier transform to do this. First of all, do we need to know a function that relates our voltage data points or can we apply the transform directly to the data points collected? Also, it would help to understand what single-sided amplitude spectrum is and what the variables used for calculating those mean.
Fs = 1000; % Sampling frequency %What do these all mean and how do we find them?
T = 1/Fs; % Sampling period
L = 1000; % Length of signal
t = (0:L-1)*T; % Time vector
P2 = abs(Y/L); %What is going on here?
P1 = P2(:,1:n/2+1);
P1(:,2:end-1) = 2*P1(:,2:end-1);

Answers (1)

It would help to have at least a representative sample of your data. You can upload it here in a number of formats, a ‘.txt’ file likely being the most convenient, a ‘.mat’ file if you have many variables. The file must contain the sampling times and the corresponding accelerometer outputs.
For help understanding the Fourier transform: fft (link).

2 Comments

Here is an Excel file we are using to collect data, the first column is voltages (in millivolts) in the x, second is the y and third is the z. We collected this data by placing the accelerometer on a rotating table at 260rpm (6Hz) for 100 seconds.
What are the sampling times? I need to know them in order to determine if your data are regularly-sampled, and to calculate the sampling frequency.
If the sampling times are not uniform, your data would have to be resampled to create them as such. (This is not difficult in MATLAB.) The Fourier transform and the filters (if needed) require uniform, known sampling intervals.

Sign in to comment.

Categories

Find more on Fourier Analysis and Filtering in Help Center and File Exchange

Tags

Edited:

on 5 Nov 2018

Community Treasure Hunt

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

Start Hunting!