Clear Filters
Clear Filters

How to apply moving average filter for continious strem of incomming data?

2 views (last 30 days)
i am having accelerometer and i am getting its x,y and z axis values(in g units) continuously from the serial port. i need to filter/smooth-en the incoming data. so i want to apply moving average filter/Savitzky-Golay smoothing filters.. how can i do it?. In http://in.mathworks.com/help/matlab/data_analysis/filtering-data.html they took an 24x3 array.. but in my case array size is not known or it keeps on increasing.. so how to solve this problem?

Accepted Answer

Star Strider
Star Strider on 20 Feb 2016
To do real-time filtering, you need the DSP System Toolbox. You probably also need specialised hardware. (I have no experience with the DSP System Toolbox, so I cannot help you with it.)
I seriously doubt that you could do a Savitzky-Golay filter in real time. Instead, save your raw signals and process them later. You will need to do a fft on your saved signals, determine the frequencies of the signals and the frequencies of the noise, then design a bandpass filter to eliminate the d-c offset and slow baseline drift on the low end, and noise at the high end. You cannot eliminate broadband noise with a frequency selective filter, so some noise will remain after the filtering process.

More Answers (0)

Community Treasure Hunt

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

Start Hunting!