Filtering out high frequency content from test data

I've got test data in an Excel spreadsheet which is a time history from an accelerometer. I would like to filter out the high frequency content of this data which will smooth the data. From my searches so far it looks like I need to read in the data, run an FFT to see the frequencies and then use the linear filter with the cut-off frequency I choose from the FFT result. Is this correct?
I loaded my Excel data into Matlab and tried to use the matlab example given in the Help guide for the linear filter, but Matlab failed at the timeseries stage and I don't know why. I looked at my test data and at the start there's some data which is zero before the acceleration occurs and that the sample frequency at the start differs at about the 9th decimal place. Is this going to be a problem? I guess this process has been done lots of times before so is there a simple rountine for doing this?
Thanks
Stuart

Answers (3)

Wayne King
Wayne King on 30 Sep 2013
Edited: Wayne King on 30 Sep 2013
I would not worry about the sampling frequency differing at the 9th decimal place. Can you provide some more specifics:
When you read the data into MATLAB, is the accelerometer data just a (double-precision) vector?
If that is true, then it should be easy to look at the Fourier transform magnitudes as you suggest and pick a reasonable place to put your cutoff frequency.
Since you plan on lowpass filtering the data, I would also not worry about the intial zeros.
Can you attach just the accelerometer data for us to look at?
Okay, thanks for saying about the initial zero data and about the high precision of the time data and that I can ignore that.
The Excel data when loaded into Matlab is just a 2 column vector (1st column is time and 2nd column acceleration). I'm not sure about the double precision but the data is to quite a few decimal place as I would think double precision.
I will attached the Excel file tomorrow as it's on my other PC.
Thanks.

1 Comment

OK, it sounds like it will be very easy to do if you have the Signal Processing Toolbox.
If you don't have the Signal Processing Toolbox, you can still design a simple lowpass filter with base MATLAB.

Sign in to comment.

A simple low pass filter is just a box filter where you convolve your signal with a flat pulse - basically a sliding mean.
windowWidth = 9; % Whatever you want.
denoisedSignal = conv(signal, ones(1, windowWidth), 'same');
Fourier filtering would be good if you want a band pass filter because you have periodic noise but of course it will work with simple low pass filtering too - it just takes longer than a convolution. Another option is a median filter (a non-linear filter) which gets rid of impulse noise but doesn't blur out true edges or steps like a sliding mean filter would.
You could also look at John D'Errico's SLM or the curve fitting toolbox if you need something more sophisticated.

Tags

Asked:

on 30 Sep 2013

Answered:

on 30 Sep 2013

Community Treasure Hunt

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

Start Hunting!