MATLAB and Simulink resources for Arduino, LEGO, and Raspberry Pi

Learn moreOpportunities for recent engineering grads.

Apply Today**New to MATLAB?**

Asked by Matthew
on 16 Nov 2012

Good morning, I have an array of data from a CSV file that I am plotting in MATLAB. However, the data is noisy, and I really would like to show just the fundamental shape of the data (the bold part of the signal).

Does anyone have any experience with this or any ideas which may help me? Thank you!

*No products are associated with this question.*

Answer by John Petersen
on 16 Nov 2012

Here are two ideas that should work. 1. Try a standard moving average with lead and lag data points. 2. Take small sample sets (10-20 for your data set) and throw out samples that are much different from the mean of the data set.

Answer by Image Analyst
on 17 Nov 2012

Try a Savitzky-Golay Filter, if you have the signal processing toolbox. It's a filter that has a moving window and the central element of the window is replaced by the value of a polynomial fitted through the data in the window. For order 1 (fitting to a line) I believe it's the same as using conv() but you might be able to get more pleasing fitting by using a larger window and fitting to a 2nd, 3rd, or 4th order polynomial. I have a demo if you want. It applies it to an image, first horizontally to rows, then vertically to columns.

Or you can try this: http://www.mathworks.com/matlabcentral/fileexchange/24443.

There is also a Curve Fitting Toolbox that has lots of curve fitting capabilities.

## 0 Comments