Smoothing filters

4 views (last 30 days)
Ivan Mohler
Ivan Mohler on 17 May 2012
Do any know some good code of smoothing filter for data (like temperatures, flows and so on)? I have 5 columns of 10 000 data and I need to smooth them.... Maybe to adjust the filter to smooth my outliers by some average values (every 5 values can calculate average)...or?
  1 Comment
Ivan Mohler
Ivan Mohler on 17 May 2012
Have someone hear of Loess filter in Matlab..I need something like this...or some tutorials how it works...
Maybe some similar filter to compare it with Loess?

Sign in to comment.

Answers (5)

Wayne King
Wayne King on 17 May 2012
It sounds like you just want a simple moving average filter (5 point). You can do that with
b = 1/5*ones(5,1);
output = filter(b,1,inputdata);

Image Analyst
Image Analyst on 17 May 2012
Another option is the Savitzky Golay filter where it fits the moving window to a polynomial. Done in MATLAB by the sgolay() function.

Image Analyst
Image Analyst on 17 May 2012
If it's outliers that you want to delete, Brett Schoelson (of the Mathworks) has this File Exchange submission: http://www.mathworks.com/matlabcentral/fileexchange/3961
We've also used this outlier detection method "the median absolute deviation":
Outliers are identified using modified Z-scores, based on median absolute deviation (Boris Iglewicz and David Hoaglin (1993), "Volume 16: How to Detect and Handle Outliers", The ASQC Basic References in Quality Control: Statistical Techniques, Edward F. Mykytka, Ph.D., Editor.). This method was selected because it doesn’t impose a normality assumption on the data, and it is known to be more robust with smaller data sets than a traditional method based on the z-score ((value-mean)/standard deviation). The algorithm relies on median values (median, median deviation, deviation from the median), as opposed to the mean and standard deviation values. The reason is that the median is much less sensitive to the presence of outliers, while the mean and standard deviation values are greatly influenced by the presence of outliers and their magnitude.

Wayne King
Wayne King on 17 May 2012
If you want loess smoothing then see smooth() in the Curve Fitting Toolbox. That offers loess and a number of other smoothing options.

Casey
Casey on 17 May 2012
Yeah just use. y=smooth(y,'loess');

Community Treasure Hunt

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

Start Hunting!